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

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

<NodeType name="MySQL" shape="ellipse" color="#ffffff" image="mysql.png">
	<DerivedFrom typeRef="root" />
	<PropertiesDefinition element="MySQLProperties"
		type="tMySQLProperties" />
	<Interfaces>
		<Interface name="Install">
			<Operation name="compilePuppetTemplateHierarchy"></Operation>
		</Interface>
	</Interfaces>
	<CapabilityDefinitions>
		<CapabilityDefinition capabilityType="portsExposeCaps" />
	</CapabilityDefinitions>
</NodeType>
<NodeTypeImplementation nodeType="MySQL" name="MySQLImpl">
	<DeploymentArtifacts>
		<DeploymentArtifact name="MySQLPT.ftl"
			artifactType="PuppetTemplate" artifactRef="MySQLPT">
		</DeploymentArtifact>
		<DeploymentArtifact artifactType="PuppetModule"
			artifactRef="MySQLPM">
		</DeploymentArtifact>
	</DeploymentArtifacts>
</NodeTypeImplementation>
<ArtifactTemplate type="PuppetTemplate" id="MySQLPT">
	<ArtifactReferences>
		<ArtifactReference reference="Templates/MySQLPT.ftl"></ArtifactReference>
	</ArtifactReferences>
</ArtifactTemplate>
<ArtifactTemplate type="PuppetModule" id="MySQLPM">
	<Properties xmlns:co="http://docs.oasis-open.org/tosca/ns/2011/12/CloudOptingTypes">
		<co:PuppetModuleProperties>
			<co:module>mysql</co:module>
			<co:git>https://github.com/puppetlabs/puppetlabs-mysql</co:git>
		</co:PuppetModuleProperties>
	</Properties>
</ArtifactTemplate>

In the file CloudOptingTypes.xsd we can find the types tMySQLProperties and MySQLProperties defined:

	<xs:complexType name="tMySQLProperties">
		<xs:sequence>
			<xs:element name="root_password">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="MySQL Root DB password"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="remove_defaul_account">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:boolean">
							<xs:attribute name="title" fixed="Remove default account?"></xs:attribute>
							<xs:attribute name="formtype" fixed="boolean"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="package_ensure">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title"
								fixed="MySQL version ('present', 'absent','x.y.z')"></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 MySQLPT.ftl

class { 'mysql::server':
  <#if root_password?has_content>root_password => '${root_password}',</#if>
  <#if remove_defaul_account?has_content>remove_defaul_account => '${remove_defaul_account}',</#if>
  <#if package_ensure?has_content>package_ensure => '${package_ensure}',</#if>
}

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

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

Clone this wiki locally