Skip to content
Xavier Cases Camats edited this page Jul 7, 2016 · 4 revisions

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

<NodeType name="CronJob" shape="ellipse" color="#ffffff" image="cron-jobs.png">
	<DerivedFrom typeRef="root" />
	<PropertiesDefinition element="CronJobProperties"
		type="tCronJobProperties" />
	<Interfaces>
		<Interface name="Install">
			<Operation name="compilePuppetTemplateHierarchy"></Operation>
		</Interface>
	</Interfaces>
</NodeType>
<NodeTypeImplementation nodeType="CronJob"
	name="CronJobImpl">
	<DeploymentArtifacts>
		<DeploymentArtifact name="CronJobPT.ftl"
			artifactType="PuppetTemplate" artifactRef="CronJobPT">
		</DeploymentArtifact>
	</DeploymentArtifacts>
</NodeTypeImplementation>
<ArtifactTemplate type="PuppetTemplate" id="CronJobPT">
	<ArtifactReferences>
		<ArtifactReference reference="Templates/CronJobPT.ftl"></ArtifactReference>
	</ArtifactReferences>
</ArtifactTemplate>

In the file CloudOptingTypes.xsd we can find the types tCronJobProperties and CronJobProperties defined:

<xs:complexType name="tCronJobProperties">
		<xs:sequence>
			<xs:element name="name">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Cron Job name"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="minute">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Minute"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="hour">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Hour"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="date">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Date"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="month">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Month"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="weekday">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Weekday"></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="User"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="command">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Command"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="environment">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Environment"></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="CronJobProperties" type="tCronJobProperties" />

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

cron::job { '<#if name?has_content>${name}</#if>':
  <#if minute?has_content>minute => '${minute}',</#if>
  <#if hour?has_content>hour => '${hour}',</#if>
  <#if date?has_content>date => '${date}',</#if>
  <#if month?has_content>month => '${month}',</#if>
  <#if weekday?has_content>weekday => '${weekday}',</#if>
  <#if user?has_content>user => '${user}',</#if>
  <#if command?has_content>command => '${command}',</#if>
  <#if environment?has_content>environment => ${environment},</#if>
}

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

Clone this wiki locally