Cherry-pick from release-0.2: "Add Demo service "
* Prepare conductor and data for Fuel demo * Image parameter is preconfigured * Exclude send-command rule from Demo workflow * Typos in agent.config for CirrOS * Demo.xml sends command to agent again Change-Id: Ia9da70e5ed9222c5f665786c49207a8e0452c1b0
This commit is contained in:
parent
23015e5ab0
commit
4ee5016006
7
data/demo_init.sh
Normal file
7
data/demo_init.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
AgentConfigBase64='%AGENT_CONFIG_BASE64%'
|
||||
|
||||
mkdir /etc/murano
|
||||
|
||||
echo AgentConfigBase64 | base64 -d > /etc/murano/agent.config
|
@ -1,6 +1,6 @@
|
||||
#ps1
|
||||
|
||||
$WindowsAgentConfigBase64 = '%WINDOWS_AGENT_CONFIG_BASE64%'
|
||||
$WindowsAgentConfigBase64 = '%AGENT_CONFIG_BASE64%'
|
||||
$WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config"
|
||||
$WindowsAgentLogFile = "C:\Murano\Agent\log.txt"
|
||||
|
||||
|
8
data/templates/agent-config/Demo.template
Normal file
8
data/templates/agent-config/Demo.template
Normal file
@ -0,0 +1,8 @@
|
||||
RABBITMQ_HOST = "%RABBITMQ_HOST%"
|
||||
RABBITMQ_PORT = "%RABBITMQ_PORT%"
|
||||
RABBITMQ_USERNAME = "%RABBITMQ_USER%"
|
||||
RABBITMQ_PASSWORD = "%RABBITMQ_PASSWORD%"
|
||||
RABBITMQ_VHOST = "%RABBITMQ_VHOST%"
|
||||
RABBITMQ_INPUT_QUEUE = "%RABBITMQ_INPUT_QUEUE%"
|
||||
RESULT_QUEUE = "%RESULT_QUEUE%"
|
||||
RABBITMQ_RESULT_ROUTING_KEY = "%RESULT_QUEUE%"
|
7
data/templates/agent/Demo.template
Normal file
7
data/templates/agent/Demo.template
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Scripts": [
|
||||
],
|
||||
"Commands": [
|
||||
],
|
||||
"RebootOnCompletion": 0
|
||||
}
|
26
data/templates/cf/Demo.template
Normal file
26
data/templates/cf/Demo.template
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||
|
||||
"Parameters" : {
|
||||
"KeyName" : {
|
||||
"Description" : "Key Pair name for Load Balancer",
|
||||
"Type" : "String",
|
||||
"Default" : "murano-lb-key"
|
||||
}
|
||||
},
|
||||
|
||||
"Resources" : {
|
||||
"$instanceName": {
|
||||
"Type" : "AWS::EC2::Instance",
|
||||
"Properties": {
|
||||
"InstanceType" : "$instanceType",
|
||||
"ImageId" :"$imageName",
|
||||
"AvailabilityZone" : "$availabilityZone",
|
||||
"UserData": "$userData"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Outputs" : {
|
||||
}
|
||||
}
|
76
data/workflows/Demo.xml
Normal file
76
data/workflows/Demo.xml
Normal file
@ -0,0 +1,76 @@
|
||||
<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>
|
@ -76,10 +76,10 @@ def delete_cf_stack(engine, context, body, **kwargs):
|
||||
|
||||
|
||||
def prepare_user_data(context, hostname, service, unit,
|
||||
template='Default', **kwargs):
|
||||
template='Default', initFile='init.ps1', **kwargs):
|
||||
settings = config.CONF.rabbitmq
|
||||
|
||||
with open('data/init.ps1') as init_script_file:
|
||||
with open('data/{0}'.format(initFile)) as init_script_file:
|
||||
with open('data/templates/agent-config/{0}.template'.format(
|
||||
template)) as template_file:
|
||||
init_script = init_script_file.read()
|
||||
@ -102,7 +102,7 @@ def prepare_user_data(context, hostname, service, unit,
|
||||
template_data = set_config_params(template_data, replacements)
|
||||
|
||||
init_script = init_script.replace(
|
||||
'%WINDOWS_AGENT_CONFIG_BASE64%',
|
||||
'%AGENT_CONFIG_BASE64%',
|
||||
base64.b64encode(template_data))
|
||||
|
||||
init_script = init_script.replace('%INTERNAL_HOSTNAME%', hostname)
|
||||
|
Loading…
x
Reference in New Issue
Block a user