Always redo heat stack create/update on each deployment

Change-Id: Id8af90102a1ac62c63097aea8e15df6bd24416e7
This commit is contained in:
Stan Lagun 2013-08-05 19:47:03 +04:00
parent ab7a9305ce
commit d6b62531f4
5 changed files with 42 additions and 20 deletions

View File

@ -6,7 +6,7 @@
</set>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]"
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.hostname and @.state.osImageName and not @.temp.instanceName)]"
desc="Units of AD services which have got hostname and image assigned, but instances not deployed yet">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
@ -34,7 +34,7 @@
</parameter>
<success>
<set path="state.instanceName"><select path="name"/></set>
<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>
@ -43,7 +43,7 @@
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.instanceName and @.adminPassword and @.adminPassword != @.state.adminPassword)]"
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.temp.instanceName and @.adminPassword and @.adminPassword != @.state.adminPassword)]"
desc="Units of AD services which have got instances deployed but the local admin passwords not set yet">
<send-command template="SetPassword">
<parameter name="unit">
@ -67,7 +67,7 @@
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.adminPassword and @.adminPassword != @.state.domainAdminPassword)].units[?(@.state.instanceName and @.isMaster)]"
<rule match="$.services[?(@.type == 'activeDirectory' and @.adminPassword and @.adminPassword != @.state.domainAdminPassword)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Deployed master-units of AD services for which the domain admin password is not set yet">
<send-command template="SetPassword">
<parameter name="unit">
@ -91,7 +91,7 @@
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc is None)].units[?(@.state.instanceName and @.isMaster)]"
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc is None)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Deployed master-units of AD services on which the Primary DC has not been installed yet ">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
@ -124,7 +124,7 @@
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc and not @.state.primaryDcIp)].units[?(@.state.instanceName and @.isMaster)]"
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc and not @.state.primaryDcIp)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Master Units of AD services on which the Primary Domain Controller has been configured but DNS ip has not been asked for">
<send-command template="AskDnsIp" result="ip">
<parameter name="unit">
@ -168,7 +168,7 @@
</send-command>
</rule>
<rule match="$..units[?(@.state.instanceName and @.domain and @.domain != @.state.domain)]"
<rule match="$..units[?(@.temp.instanceName and @.domain and @.domain != @.state.domain)]"
desc="Any deployed unit which need to enter the domain">
<set path="#unit">
<select/>

View File

@ -6,7 +6,7 @@
</set>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]"
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.state.hostname and @.state.osImageName and not @.temp.instanceName)]"
desc="Units of web services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
@ -34,7 +34,7 @@
</parameter>
<success>
<set path="state.instanceName"><select path="name"/></set>
<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>
@ -60,7 +60,7 @@
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.state.instanceName)]"
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of web services which have got an instance deployed but has not got a correct admin password ">
<send-command template="SetPassword">
<parameter name="unit">
@ -85,7 +85,7 @@
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.state.instanceName and not @.state.iisInstalled)]"
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.temp.instanceName and not @.state.iisInstalled)]"
desc="Units of web services which have got an instance deployed but have not got an IIS installed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>

View File

@ -7,7 +7,7 @@
</set>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]"
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.hostname and @.state.osImageName and not @.temp.instanceName)]"
desc="Units of SQL Server Cluster services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
@ -35,7 +35,7 @@
</parameter>
<success>
<set path="state.instanceName"><select path="name"/></set>
<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>
@ -56,7 +56,7 @@
</rule>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.state.instanceName)]"
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of SQL Server Cluster services which have got an instance deployed but has not got a correct admin password">
<send-command template="SetPassword">
<parameter name="unit">

View File

@ -6,7 +6,7 @@
</set>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]"
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.state.hostname and @.state.osImageName and not @.temp.instanceName)]"
desc="Units of SQL Server services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
@ -34,7 +34,7 @@
</parameter>
<success>
<set path="state.instanceName"><select path="name"/></set>
<set path="instanceName.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>
@ -43,7 +43,7 @@
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.state.instanceName)]"
<rule match="$.services[?(@.type == 'msSqlServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of SQL Server services which have got an instance deployed but has not got a correct admin password">
<send-command template="SetPassword">
<parameter name="unit">
@ -68,7 +68,7 @@
</rule>
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.state.instanceName and not @.state.msSqlServerInstalled)]"
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.temp.instanceName and not @.state.msSqlServerInstalled)]"
desc="Units of SQL Server services which have got an instance deployed but have not got an SQL Server installed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>

View File

@ -124,8 +124,7 @@ class ConductorWorkflowService(service.Service):
reporter.report_generic("Unexpected error has occurred",
e.message, 'error')
finally:
if 'token' in task:
del task['token']
self.cleanup(task, reporter)
result_msg = Message()
result_msg.body = task
result_msg.id = message_id
@ -134,3 +133,26 @@ class ConductorWorkflowService(service.Service):
message.ack()
log.info('Finished processing task {0}. Result = {1}'.format(
message_id, anyjson.dumps(task)))
def cleanup(self, model, reporter):
try:
if 'token' in model:
del model['token']
if 'temp' in model:
del model['temp']
services = model.get('services', [])
for service in services:
if 'temp' in service:
del service['temp']
units = service.get('units', [])
for unit in units:
if 'temp' in unit:
del unit['temp']
except Exception as e:
log.exception("Unexpected exception has occurred")
if reporter:
reporter.report_generic("Unexpected error has occurred",
e.message, 'error')