Skip to content

NodeType MongoDB_db

Xavier Cases Camats edited this page Jul 7, 2016 · 3 revisions

Here you can see the content of the file mongodbdb.xml explained:

<NodeType name="MongoDBDatabase" shape="ellipse" color="#332299" image="docker.png">
	<DerivedFrom typeRef="root" />
	<PropertiesDefinition element="MongoDBDatabaseProperties"
		type="tMongoDBDatabaseProperties" />
	<Interfaces>
		<Interface name="Install">
			<Operation name="compilePuppetTemplateHierarchy"></Operation>
		</Interface>
	</Interfaces>
</NodeType>
<NodeTypeImplementation nodeType="MongoDBDatabase"
	name="MongoDBDatabaseImpl">
	<DeploymentArtifacts>
		<DeploymentArtifact name="MongoDBDatabasePT.ftl"
			artifactType="PuppetTemplate" artifactRef="MongoDBDatabasePT">
		</DeploymentArtifact>
	</DeploymentArtifacts>
</NodeTypeImplementation>
<ArtifactTemplate type="PuppetTemplate" id="MongoDBDatabasePT">
	<ArtifactReferences>
		<ArtifactReference reference="Templates/MongoDBDatabasePT.ftl"></ArtifactReference>
	</ArtifactReferences>
</ArtifactTemplate>

In the file CloudOptingTypes.xsd we can find the types tMongoDBDatabaseProperties and MongoDBDatabaseProperties defined:

	<xs:complexType name="tMongoDBDatabaseProperties">
		<xs:sequence>
			<xs:element name="password">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="DB password"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="user">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="DB user"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="dbname">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="DB name"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="MongoDBDatabaseProperties" type="tMongoDBDatabaseProperties" />

The defined params have to match with the puppetfile MongoDBDatabasePT.ftl

mongodb_database { '<#if dbname?has_content>${dbname}</#if>':
      <#if user?has_content>user    => '${user}',</#if>
      <#if password?has_content>password => ${password},</#if>
      require => Class['mongodb::server']
}

With this nodetype what we can see on the TOSCA IDE is the following: image

Clone this wiki locally