77 lines
3.3 KiB
XML
77 lines
3.3 KiB
XML
<workflow>
|
|
<rule match="$.services[?(@.type == 'demoService')].units[*]"
|
|
desc='Service for demo purpose'>
|
|
</rule>
|
|
|
|
<rule match="$.services[?(@.type == 'demoService')].units[?(@.state.hostname and not @.temp.instanceName)]"
|
|
desc="Units of demo service having hostname and image names assigned but without instances">
|
|
<report entity="unit">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
|
|
</report>
|
|
<update-cf-stack template="Demo" error="exception">
|
|
<parameter name="mappings">
|
|
<map>
|
|
<mapping name="instanceName"><select path="state.hostname"/></mapping>
|
|
<mapping name="userData">
|
|
<prepare-user-data template="Demo" initFile="demo_init.sh">
|
|
<parameter name="hostname"><select path="state.hostname"/></parameter>
|
|
<parameter name="unit"><select path="id"/></parameter>
|
|
<parameter name="service"><select path="::id"/></parameter>
|
|
</prepare-user-data>
|
|
</mapping>
|
|
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
|
|
<mapping name="imageName"><select path="::osImage.name"/></mapping>
|
|
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
|
|
</map>
|
|
</parameter>
|
|
<success>
|
|
<set path="temp.instanceName"><select path="name"/></set>
|
|
<report entity="unit">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created!</parameter>
|
|
</report>
|
|
</success>
|
|
<failure>
|
|
<report entity="unit" level="error">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
|
|
</report>
|
|
<stop/>
|
|
</failure>
|
|
</update-cf-stack>
|
|
</rule>
|
|
|
|
|
|
<rule match="$.services[?(@.type == 'demoService')].units[?(@.temp.instanceName and not @.state.demoInstalled)]"
|
|
desc="Units of demo service which have got an instance deployed but have not got demo service installed">
|
|
<report entity="unit">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Creating demo service on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
|
|
</report>
|
|
<send-command template="Demo" error='exception'>
|
|
<parameter name="unit">
|
|
<select path="id"/>
|
|
</parameter>
|
|
<parameter name="service">
|
|
<select path="::id"/>
|
|
</parameter>
|
|
<success>
|
|
<set path="state.demoInstalled"><true/></set>
|
|
<report entity="unit">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Demo service <select path="state.hostname"/> (<select path="name"/>) has started</parameter>
|
|
</report>
|
|
</success>
|
|
<failure>
|
|
<report entity="unit" level="error">
|
|
<parameter name="id"><select path="id"/></parameter>
|
|
<parameter name="text">Unable to install demo service on <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
|
|
</report>
|
|
<stop/>
|
|
</failure>
|
|
</send-command>
|
|
</rule>
|
|
|
|
</workflow>
|