Skip to content
Ciprian Pavel edited this page Jul 11, 2016 · 2 revisions

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

<NodeType name="MySQLDatabase" shape="ellipse" color="#ffffff" image="mysqldb.png">
	<DerivedFrom typeRef="root" />
	<PropertiesDefinition element="MySQLDatabaseProperties"
		type="tMySQLDatabaseProperties" />
	<Interfaces>
		<Interface name="Install">
			<Operation name="compilePuppetTemplateHierarchy"></Operation>
		</Interface>
	</Interfaces>
</NodeType>
<NodeTypeImplementation nodeType="MySQLDatabase"
	name="MySQLDatabaseImpl">
	<DeploymentArtifacts>
		<DeploymentArtifact name="MySQLDatabasePT.ftl"
			artifactType="PuppetTemplate" artifactRef="MySQLDatabasePT">
		</DeploymentArtifact>
	</DeploymentArtifacts>
</NodeTypeImplementation>
<ArtifactTemplate type="PuppetTemplate" id="MySQLDatabasePT">
	<ArtifactReferences>
		<ArtifactReference reference="Templates/MySQLDatabasePT.ftl"></ArtifactReference>
	</ArtifactReferences>
</ArtifactTemplate>

In the file CloudOptingTypes.xsd we can find the types tMySQLDatabaseProperties and MySQLDatabaseProperties defined:

<xs:complexType name="tMySQLDatabaseProperties">
		<xs:sequence>
			<xs:element name="password">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="MySQL DB password"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="host">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="MySQL Host"></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="MySQL 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="MySQL DB name"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="sql">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="SQL file"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="grant">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="MySQL Grant"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

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

mysql::db { '<#if dbname?has_content>${dbname}</#if>':
  user     => '<#if user?has_content>${user}</#if>',
  password => '<#if password?has_content>${password}</#if>',
  host     => '<#if host?has_content>${host}</#if>',
  grant    => ['SELECT', 'UPDATE'],
}
mysql::db { "<#if dbname?has_content>${dbname}</#if>_${fqdn}":
  user     => '<#if user?has_content>${user}</#if>',
  password => '<#if password?has_content>${password}</#if>',
  dbname   => '<#if dbname?has_content>${dbname}</#if>',
  host     => $::fqdn,
  grant    => ['SELECT', 'UPDATE'],
  tag      => $domain,
}

<#foreach childTemplate in childtemplates>
${childTemplate}
</#foreach>

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

Clone this wiki locally