KEERO-314 - Fix all occurrences of old names (keero, glazier) in conductor + CRLF->LF
This commit is contained in:
parent
fa938e8289
commit
84d0d23515
@ -1,8 +1,8 @@
|
||||
Glazier Conductor README
|
||||
Murano Conductor README
|
||||
========================
|
||||
Conductor is an Glazier orchestration engine that transforms object model sent by
|
||||
REST API service into a series of Heat and Glazier-Agent commands
|
||||
Conductor is an Murano orchestration engine that transforms object model sent by
|
||||
REST API service into a series of Heat and Murano-Agent commands
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
* `Keero <http://keero.mirantis.com>`__
|
||||
* `Murano <http://murano.mirantis.com>`__
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ps1
|
||||
|
||||
$WindowsAgentConfigBase64 = '%WINDOWS_AGENT_CONFIG_BASE64%'
|
||||
$WindowsAgentConfigFile = "C:\Keero\Agent\WindowsAgent.exe.config"
|
||||
$WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config"
|
||||
|
||||
$NewComputerName = '%INTERNAL_HOSTNAME%'
|
||||
|
||||
@ -9,12 +9,12 @@ $RestartRequired = $false
|
||||
|
||||
Import-Module CoreFunctions
|
||||
|
||||
Write-Log "Updating Keero Windows Agent."
|
||||
Stop-Service "Keero Agent"
|
||||
Write-Log "Updating Murano Windows Agent."
|
||||
Stop-Service "Murano Agent"
|
||||
Backup-File $WindowsAgentConfigFile
|
||||
Remove-Item $WindowsAgentConfigFile -Force
|
||||
ConvertFrom-Base64String -Base64String $WindowsAgentConfigBase64 -Path $WindowsAgentConfigFile
|
||||
Exec sc.exe 'config','"Keero Agent"','start=','delayed-auto'
|
||||
Exec sc.exe 'config','"Murano Agent"','start=','delayed-auto'
|
||||
Write-Log "Service has been updated."
|
||||
|
||||
Write-Log "Renaming computer ..."
|
||||
@ -29,5 +29,5 @@ if ( $RestartRequired ) {
|
||||
Restart-Computer -Force
|
||||
}
|
||||
else {
|
||||
Start-Service 'Keero Agent'
|
||||
Start-Service 'Murano Agent'
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
"KeyName" : {
|
||||
"Description" : "Name of an existing Amazon EC2 key pair for RDP access",
|
||||
"Type" : "String",
|
||||
"Default" : "keero_key"
|
||||
"Default" : "murano-keys"
|
||||
},
|
||||
"InstanceType" : {
|
||||
"Description" : "Amazon EC2 instance type",
|
||||
|
@ -1,218 +1,218 @@
|
||||
<workflow>
|
||||
<rule match="$.services.activeDirectories[?(@.domain)].units[?(not @.isMaster)]">
|
||||
<set path="domain">
|
||||
<select path="::domain"/>
|
||||
</set>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.hostname and not @.state.instanceName)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating instance <select path="name"/></parameter>
|
||||
</report>
|
||||
<update-cf-stack template="Windows">
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="instanceName"><select path="::name"/>-<select path="name"/></mapping>
|
||||
<mapping name="userData">
|
||||
<prepare-user-data>
|
||||
<parameter name="hostname"><select path="state.hostname"/></parameter>
|
||||
<parameter name="unit"><select path="name"/></parameter>
|
||||
<parameter name="service"><select path="::id"/></parameter>
|
||||
</prepare-user-data>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<parameter name="arguments">
|
||||
<map>
|
||||
<argument name="KeyName">keero-keys</argument>
|
||||
<argument name="InstanceType">m1.medium</argument>
|
||||
<argument name="ImageName">ws-2012-full</argument>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.instanceName"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Instance <select path="name"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</update-cf-stack>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.instanceName and @.adminPassword and @.adminPassword != @.state.adminPassword)]">
|
||||
<send-command template="SetPassword">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="adminPassword">
|
||||
<select path="adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.adminPassword">
|
||||
<select path="adminPassword"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.adminPassword and @.adminPassword != @.state.domainAdminPassword)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<send-command template="SetPassword">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="adminPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.domainAdminPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.state.primaryDc is None)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating Primary Domain Controller on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="CreatePrimaryDC">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="domain">
|
||||
<select path="::domain"/>
|
||||
</mapping>
|
||||
<mapping name="recoveryPassword">
|
||||
<select path="recoveryPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.primaryDc"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Primary Domain Controller created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.state.primaryDc and not @.state.primaryDcIp)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<send-command template="AskDnsIp" result="ip">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.primaryDcIp">
|
||||
<select source="ip" path="0.Result.0"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$..units[?(@.state.instanceName and @.domain and @.domain != @.state.domain)]">
|
||||
<set path="#unit">
|
||||
<select/>
|
||||
</set>
|
||||
<set path="#service">
|
||||
<select path="::"/>
|
||||
</set>
|
||||
<rule>
|
||||
<parameter name="match">/$.services.activeDirectories[?(@.domain == '<select path="domain"/>' and @.state.primaryDcIp)]</parameter>
|
||||
|
||||
<send-command template="JoinDomain">
|
||||
<parameter name="host">
|
||||
<select path="name" source="unit"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="id" source="service"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="domain">
|
||||
<select path="domain"/>
|
||||
</mapping>
|
||||
<mapping name="domainPassword">
|
||||
<select path="adminPassword"/>
|
||||
</mapping>
|
||||
<mapping name="dnsIp">
|
||||
<select path="state.primaryDcIp"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.domain" target="unit">
|
||||
<select path="domain"/>
|
||||
</set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id" source="unit"/></parameter>
|
||||
<parameter name="text">Unit <select path="name" source="unit"/> has joined domain <select path="domain"/></parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.domain and not @.isMaster and not @.state.installed)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating Secondary Domain Controller on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="CreateSecondaryDC">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="recoveryPassword">
|
||||
<select path="recoveryPassword"/>
|
||||
</mapping>
|
||||
<mapping name="domainPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.installed"><true/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Secondary Domain Controller created</parameter>
|
||||
</report>
|
||||
<report entity="service">
|
||||
<parameter name="id"><select path="::id"/></parameter>
|
||||
<parameter name="text">Domain <select path="::domain"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
<workflow>
|
||||
<rule match="$.services.activeDirectories[?(@.domain)].units[?(not @.isMaster)]">
|
||||
<set path="domain">
|
||||
<select path="::domain"/>
|
||||
</set>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.hostname and not @.state.instanceName)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating instance <select path="name"/></parameter>
|
||||
</report>
|
||||
<update-cf-stack template="Windows">
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="instanceName"><select path="::name"/>-<select path="name"/></mapping>
|
||||
<mapping name="userData">
|
||||
<prepare-user-data>
|
||||
<parameter name="hostname"><select path="state.hostname"/></parameter>
|
||||
<parameter name="unit"><select path="name"/></parameter>
|
||||
<parameter name="service"><select path="::id"/></parameter>
|
||||
</prepare-user-data>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<parameter name="arguments">
|
||||
<map>
|
||||
<argument name="KeyName">murano-keys</argument>
|
||||
<argument name="InstanceType">m1.medium</argument>
|
||||
<argument name="ImageName">ws-2012-full</argument>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.instanceName"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Instance <select path="name"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</update-cf-stack>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.instanceName and @.adminPassword and @.adminPassword != @.state.adminPassword)]">
|
||||
<send-command template="SetPassword">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="adminPassword">
|
||||
<select path="adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.adminPassword">
|
||||
<select path="adminPassword"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.adminPassword and @.adminPassword != @.state.domainAdminPassword)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<send-command template="SetPassword">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="adminPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.domainAdminPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.state.primaryDc is None)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating Primary Domain Controller on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="CreatePrimaryDC">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="domain">
|
||||
<select path="::domain"/>
|
||||
</mapping>
|
||||
<mapping name="recoveryPassword">
|
||||
<select path="recoveryPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.primaryDc"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Primary Domain Controller created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.activeDirectories[?(@.state.primaryDc and not @.state.primaryDcIp)].units[?(@.state.instanceName and @.isMaster)]">
|
||||
<send-command template="AskDnsIp" result="ip">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="::state.primaryDcIp">
|
||||
<select source="ip" path="0.Result.0"/>
|
||||
</set>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
|
||||
<rule match="$..units[?(@.state.instanceName and @.domain and @.domain != @.state.domain)]">
|
||||
<set path="#unit">
|
||||
<select/>
|
||||
</set>
|
||||
<set path="#service">
|
||||
<select path="::"/>
|
||||
</set>
|
||||
<rule>
|
||||
<parameter name="match">/$.services.activeDirectories[?(@.domain == '<select path="domain"/>' and @.state.primaryDcIp)]</parameter>
|
||||
|
||||
<send-command template="JoinDomain">
|
||||
<parameter name="host">
|
||||
<select path="name" source="unit"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="id" source="service"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="domain">
|
||||
<select path="domain"/>
|
||||
</mapping>
|
||||
<mapping name="domainPassword">
|
||||
<select path="adminPassword"/>
|
||||
</mapping>
|
||||
<mapping name="dnsIp">
|
||||
<select path="state.primaryDcIp"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.domain" target="unit">
|
||||
<select path="domain"/>
|
||||
</set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id" source="unit"/></parameter>
|
||||
<parameter name="text">Unit <select path="name" source="unit"/> has joined domain <select path="domain"/></parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule match="$.services.activeDirectories[*].units[?(@.state.domain and not @.isMaster and not @.state.installed)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating Secondary Domain Controller on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="CreateSecondaryDC">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="recoveryPassword">
|
||||
<select path="recoveryPassword"/>
|
||||
</mapping>
|
||||
<mapping name="domainPassword">
|
||||
<select path="::adminPassword"/>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.installed"><true/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Secondary Domain Controller created</parameter>
|
||||
</report>
|
||||
<report entity="service">
|
||||
<parameter name="id"><select path="::id"/></parameter>
|
||||
<parameter name="text">Domain <select path="::domain"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
</workflow>
|
@ -1,19 +1,19 @@
|
||||
<workflow>
|
||||
|
||||
<rule match="$.services[*][*].units[?(@.state.hostname is None)]">
|
||||
<set path="state.hostname"><generate-hostname/></set>
|
||||
</rule>
|
||||
|
||||
<rule match="$[?(not @.state.deleted)]">
|
||||
<rule match="$.services[*][*].units[*]">
|
||||
<empty>
|
||||
<delete-cf-stack>
|
||||
<success>
|
||||
<set path="/state.deleted"><true/></set>
|
||||
</success>
|
||||
</delete-cf-stack>
|
||||
</empty>
|
||||
</rule>
|
||||
</rule>
|
||||
|
||||
<workflow>
|
||||
|
||||
<rule match="$.services[*][*].units[?(@.state.hostname is None)]">
|
||||
<set path="state.hostname"><generate-hostname/></set>
|
||||
</rule>
|
||||
|
||||
<rule match="$[?(not @.state.deleted)]">
|
||||
<rule match="$.services[*][*].units[*]">
|
||||
<empty>
|
||||
<delete-cf-stack>
|
||||
<success>
|
||||
<set path="/state.deleted"><true/></set>
|
||||
</success>
|
||||
</delete-cf-stack>
|
||||
</empty>
|
||||
</rule>
|
||||
</rule>
|
||||
|
||||
</workflow>
|
@ -1,65 +1,65 @@
|
||||
<workflow>
|
||||
<rule match="$.services.webServers[?(@.domain)].units[*]">
|
||||
<set path="domain">
|
||||
<select path="::domain"/>
|
||||
</set>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.webServers[*].units[?(@.state.hostname and not @.state.instanceName)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating instance <select path="name"/></parameter>
|
||||
</report>
|
||||
<update-cf-stack template="Windows">
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="instanceName"><select path="::name"/>-<select path="name"/></mapping>
|
||||
<mapping name="userData">
|
||||
<prepare-user-data>
|
||||
<parameter name="hostname"><select path="state.hostname"/></parameter>
|
||||
<parameter name="unit"><select path="name"/></parameter>
|
||||
<parameter name="service"><select path="::id"/></parameter>
|
||||
</prepare-user-data>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<parameter name="arguments">
|
||||
<map>
|
||||
<argument name="KeyName">keero-keys</argument>
|
||||
<argument name="InstanceType">m1.medium</argument>
|
||||
<argument name="ImageName">ws-2012-full</argument>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.instanceName"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Instance <select path="name"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</update-cf-stack>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.webServers[*].units[?(@.state.instanceName and not @.state.iisInstalled)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating IIS Web Server on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="InstallIIS">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.iisInstalled"><true/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">IIS <select path="name"/> has started</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
<workflow>
|
||||
<rule match="$.services.webServers[?(@.domain)].units[*]">
|
||||
<set path="domain">
|
||||
<select path="::domain"/>
|
||||
</set>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.webServers[*].units[?(@.state.hostname and not @.state.instanceName)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating instance <select path="name"/></parameter>
|
||||
</report>
|
||||
<update-cf-stack template="Windows">
|
||||
<parameter name="mappings">
|
||||
<map>
|
||||
<mapping name="instanceName"><select path="::name"/>-<select path="name"/></mapping>
|
||||
<mapping name="userData">
|
||||
<prepare-user-data>
|
||||
<parameter name="hostname"><select path="state.hostname"/></parameter>
|
||||
<parameter name="unit"><select path="name"/></parameter>
|
||||
<parameter name="service"><select path="::id"/></parameter>
|
||||
</prepare-user-data>
|
||||
</mapping>
|
||||
</map>
|
||||
</parameter>
|
||||
<parameter name="arguments">
|
||||
<map>
|
||||
<argument name="KeyName">murano-keys</argument>
|
||||
<argument name="InstanceType">m1.medium</argument>
|
||||
<argument name="ImageName">ws-2012-full</argument>
|
||||
</map>
|
||||
</parameter>
|
||||
|
||||
<success>
|
||||
<set path="state.instanceName"><select path="name"/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Instance <select path="name"/> created</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</update-cf-stack>
|
||||
</rule>
|
||||
|
||||
<rule match="$.services.webServers[*].units[?(@.state.instanceName and not @.state.iisInstalled)]">
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">Creating IIS Web Server on unit <select path="name"/></parameter>
|
||||
</report>
|
||||
<send-command template="InstallIIS">
|
||||
<parameter name="host">
|
||||
<select path="name"/>
|
||||
</parameter>
|
||||
<parameter name="service">
|
||||
<select path="::id"/>
|
||||
</parameter>
|
||||
<success>
|
||||
<set path="state.iisInstalled"><true/></set>
|
||||
<report entity="unit">
|
||||
<parameter name="id"><select path="id"/></parameter>
|
||||
<parameter name="text">IIS <select path="name"/> has started</parameter>
|
||||
</report>
|
||||
</success>
|
||||
</send-command>
|
||||
</rule>
|
||||
</workflow>
|
@ -218,7 +218,7 @@ htmlhelp_basename = 'conductordoc'
|
||||
# documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'Conductor.tex', u'Conductor Documentation',
|
||||
u'Keero Team', 'manual'),
|
||||
u'Murano Team', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
@ -15,11 +15,11 @@
|
||||
under the License.
|
||||
|
||||
=======================================================
|
||||
Welcome to Conductor, the Glazier orchestration engine!
|
||||
Welcome to Conductor, the Murano orchestration engine!
|
||||
=======================================================
|
||||
|
||||
Conductor is an Glazier orchestration engine that transforms object model sent by
|
||||
REST API service into a series of Heat and Glazier-Agent commands
|
||||
Conductor is an Murano orchestration engine that transforms object model sent by
|
||||
REST API service into a series of Heat and Murano-Agent commands
|
||||
|
||||
This document describes Conductor for contributors of the project.
|
||||
|
||||
@ -31,20 +31,20 @@ Installation Guide
|
||||
Install
|
||||
-------
|
||||
|
||||
Check out sources to some directory (<home>/glazier):
|
||||
Check out sources to some directory (<home>/murano):
|
||||
|
||||
smelikyan@work:~/git clone ssh://<user>@gerrit.mirantis.com:29418/keero/keero.git
|
||||
smelikyan@work:~/git clone https://github.com/Mirantis/murano-conductor.git
|
||||
|
||||
Install Conductor:
|
||||
|
||||
smelikyan@work:~/cd glazier/conductor && sudo python setup.py install
|
||||
smelikyan@work:~/cd murano/conductor && sudo python setup.py install
|
||||
|
||||
Configure
|
||||
---------
|
||||
|
||||
Open configuration file for editing:
|
||||
|
||||
smelikyan@work:~/cd glazier/conductor/etc && nano conductor.conf
|
||||
smelikyan@work:~/cd murano/conductor/etc && nano conductor.conf
|
||||
|
||||
Configure according to you environment:
|
||||
[DEFAULT]
|
||||
@ -59,14 +59,14 @@ Configure
|
||||
# this must be IP or hostname accessible from instances (VMs)
|
||||
host = YOUR.REAL.IP.HERE
|
||||
port = 5672
|
||||
virtual_host = glazier
|
||||
login = glazier
|
||||
password = glazier
|
||||
virtual_host = murano
|
||||
login = murano
|
||||
password = murano
|
||||
|
||||
Run
|
||||
----
|
||||
|
||||
Run Conductor and supply valid configuration file:
|
||||
|
||||
smelikyan@work:~/cd glazier/conductor && conductor --config-file=./glazier/conductor/etc/conductor.conf
|
||||
smelikyan@work:~/cd murano/conductor && conductor --config-file=./murano/conductor/etc/conductor.conf
|
||||
|
||||
|
@ -9,6 +9,6 @@ auth_url = http://172.18.124.101:5000/v2.0
|
||||
[rabbitmq]
|
||||
host = 172.18.124.101
|
||||
port = 5672
|
||||
virtual_host = keero
|
||||
login = keero
|
||||
password = keero
|
||||
virtual_host = murano
|
||||
login = murano
|
||||
password = murano
|
@ -1,171 +1,171 @@
|
||||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
import mockfs
|
||||
import heatclient.exc
|
||||
|
||||
from conductor.commands.cloud_formation import HeatExecutor
|
||||
|
||||
|
||||
class TestHeatExecutor(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mfs = mockfs.replace_builtins()
|
||||
template = {
|
||||
"$name": {
|
||||
"$key": "$value"
|
||||
}
|
||||
}
|
||||
self.mfs.add_entries({
|
||||
'./data/templates/cf/test.template': json.dumps(template)})
|
||||
|
||||
def tearDown(self):
|
||||
mockfs.restore_builtins()
|
||||
|
||||
def _init(self, config_mock, ksclient_mock):
|
||||
config_mock.heat.auth_url = 'http://invalid.url'
|
||||
|
||||
auth_data = ksclient_mock().tokens.authenticate()
|
||||
auth_data.id = '123456'
|
||||
auth_data.serviceCatalog = [{
|
||||
'name': 'heat',
|
||||
'endpoints': [{'publicURL': 'http://invalid.heat.url'}]
|
||||
}]
|
||||
|
||||
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_create_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='CreateOrUpdate',
|
||||
mappings={
|
||||
'name': 'testName',
|
||||
'key': 'testKey',
|
||||
'value': 'testValue'},
|
||||
arguments={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
callback=callback)
|
||||
|
||||
|
||||
heat_mock().stacks.get().stack_status = 'CREATE_COMPLETE'
|
||||
heat_mock().stacks.template = mock.MagicMock(
|
||||
side_effect=heatclient.exc.HTTPNotFound)
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.create.assert_called_with(
|
||||
stack_name='stack',
|
||||
parameters={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
template={
|
||||
"testName": {
|
||||
"testKey": "testValue"
|
||||
}
|
||||
})
|
||||
callback.assert_called_with(True)
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_update_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='CreateOrUpdate',
|
||||
mappings={
|
||||
'name': 'testName',
|
||||
'key': 'testKey',
|
||||
'value': 'testValue'},
|
||||
arguments={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
callback=callback)
|
||||
|
||||
get_mock = heat_mock().stacks.get()
|
||||
get_mock.stack_name = 'stack'
|
||||
get_mock.id = 'stack'
|
||||
get_mock.parameters = {}
|
||||
get_mock.stack_status = ''
|
||||
get_mock._status_index = 0
|
||||
|
||||
def side_effect(*args, **kwargs):
|
||||
if get_mock._status_index < 2:
|
||||
get_mock.stack_status = 'IN_PROGRESS'
|
||||
else:
|
||||
get_mock.stack_status = 'UPDATE_COMPLETE'
|
||||
get_mock._status_index += 1
|
||||
return get_mock
|
||||
|
||||
|
||||
heat_mock().stacks.get = mock.MagicMock(side_effect=side_effect)
|
||||
|
||||
heat_mock().stacks.template = mock.MagicMock(
|
||||
return_value={'instance': {}})
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.update.assert_called_with(
|
||||
stack_id='stack',
|
||||
parameters={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
template={
|
||||
'instance': {},
|
||||
"testName": {
|
||||
"testKey": "testValue"
|
||||
}
|
||||
})
|
||||
callback.assert_called_with(True)
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_delete_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='Delete',
|
||||
callback=callback)
|
||||
|
||||
|
||||
heat_mock().stacks.get = mock.MagicMock(
|
||||
side_effect=heatclient.exc.HTTPNotFound)
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.delete.assert_called_with(stack_id='stack')
|
||||
callback.assert_called_with(True)
|
||||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
import mockfs
|
||||
import heatclient.exc
|
||||
|
||||
from conductor.commands.cloud_formation import HeatExecutor
|
||||
|
||||
|
||||
class TestHeatExecutor(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mfs = mockfs.replace_builtins()
|
||||
template = {
|
||||
"$name": {
|
||||
"$key": "$value"
|
||||
}
|
||||
}
|
||||
self.mfs.add_entries({
|
||||
'./data/templates/cf/test.template': json.dumps(template)})
|
||||
|
||||
def tearDown(self):
|
||||
mockfs.restore_builtins()
|
||||
|
||||
def _init(self, config_mock, ksclient_mock):
|
||||
config_mock.heat.auth_url = 'http://invalid.url'
|
||||
|
||||
auth_data = ksclient_mock().tokens.authenticate()
|
||||
auth_data.id = '123456'
|
||||
auth_data.serviceCatalog = [{
|
||||
'name': 'heat',
|
||||
'endpoints': [{'publicURL': 'http://invalid.heat.url'}]
|
||||
}]
|
||||
|
||||
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_create_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='CreateOrUpdate',
|
||||
mappings={
|
||||
'name': 'testName',
|
||||
'key': 'testKey',
|
||||
'value': 'testValue'},
|
||||
arguments={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
callback=callback)
|
||||
|
||||
|
||||
heat_mock().stacks.get().stack_status = 'CREATE_COMPLETE'
|
||||
heat_mock().stacks.template = mock.MagicMock(
|
||||
side_effect=heatclient.exc.HTTPNotFound)
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.create.assert_called_with(
|
||||
stack_name='stack',
|
||||
parameters={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
template={
|
||||
"testName": {
|
||||
"testKey": "testValue"
|
||||
}
|
||||
})
|
||||
callback.assert_called_with(True)
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_update_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='CreateOrUpdate',
|
||||
mappings={
|
||||
'name': 'testName',
|
||||
'key': 'testKey',
|
||||
'value': 'testValue'},
|
||||
arguments={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
callback=callback)
|
||||
|
||||
get_mock = heat_mock().stacks.get()
|
||||
get_mock.stack_name = 'stack'
|
||||
get_mock.id = 'stack'
|
||||
get_mock.parameters = {}
|
||||
get_mock.stack_status = ''
|
||||
get_mock._status_index = 0
|
||||
|
||||
def side_effect(*args, **kwargs):
|
||||
if get_mock._status_index < 2:
|
||||
get_mock.stack_status = 'IN_PROGRESS'
|
||||
else:
|
||||
get_mock.stack_status = 'UPDATE_COMPLETE'
|
||||
get_mock._status_index += 1
|
||||
return get_mock
|
||||
|
||||
|
||||
heat_mock().stacks.get = mock.MagicMock(side_effect=side_effect)
|
||||
|
||||
heat_mock().stacks.template = mock.MagicMock(
|
||||
return_value={'instance': {}})
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.update.assert_called_with(
|
||||
stack_id='stack',
|
||||
parameters={
|
||||
'arg1': 'arg1Value',
|
||||
'arg2': 'arg2Value'},
|
||||
template={
|
||||
'instance': {},
|
||||
"testName": {
|
||||
"testKey": "testValue"
|
||||
}
|
||||
})
|
||||
callback.assert_called_with(True)
|
||||
|
||||
@mock.patch('heatclient.v1.client.Client')
|
||||
@mock.patch('keystoneclient.v2_0.client.Client')
|
||||
@mock.patch('conductor.config.CONF')
|
||||
def test_delete_stack(self, config_mock, ksclient_mock, heat_mock):
|
||||
self._init(config_mock, ksclient_mock)
|
||||
executor = HeatExecutor('stack', 'token', 'tenant_id')
|
||||
callback = mock.MagicMock()
|
||||
|
||||
executor.execute(
|
||||
template='test',
|
||||
command='Delete',
|
||||
callback=callback)
|
||||
|
||||
|
||||
heat_mock().stacks.get = mock.MagicMock(
|
||||
side_effect=heatclient.exc.HTTPNotFound)
|
||||
|
||||
self.assertTrue(executor.has_pending_commands())
|
||||
result = executor.execute_pending()
|
||||
self.assertTrue(result)
|
||||
heat_mock().stacks.delete.assert_called_with(stack_id='stack')
|
||||
callback.assert_called_with(True)
|
||||
|
@ -1,99 +1,99 @@
|
||||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
|
||||
import deep
|
||||
import mock
|
||||
import mockfs
|
||||
|
||||
from conductor.workflow import Workflow
|
||||
|
||||
|
||||
def load_sample(name):
|
||||
with mockfs.storage.original_open(os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'sample_data',
|
||||
name)) as sample_file:
|
||||
return sample_file.read()
|
||||
|
||||
|
||||
class TestWorkflow(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.mfs = mockfs.replace_builtins()
|
||||
self.model = json.loads(load_sample('objectModel1.json'))
|
||||
self.original_model = json.loads(load_sample('objectModel1.json'))
|
||||
|
||||
def tearDown(self):
|
||||
mockfs.restore_builtins()
|
||||
|
||||
def _execute_workflow(self, xml):
|
||||
self.mfs.add_entries({'test': xml})
|
||||
stub = mock.MagicMock()
|
||||
stub.side_effect = RuntimeError
|
||||
workflow = Workflow('test', self.model, stub, stub, stub)
|
||||
workflow.execute()
|
||||
|
||||
def test_empty_workflow_leaves_object_model_unchanged(self):
|
||||
xml = '<workflow/>'
|
||||
self._execute_workflow(xml)
|
||||
self.assertIsNone(deep.diff(self.original_model, self.model))
|
||||
|
||||
def test_modifying_object_model_from_workflow(self):
|
||||
xml = '''
|
||||
<workflow>
|
||||
<rule match="$.services[*][?(@.id ==
|
||||
'9571747991184642B95F430A014616F9'
|
||||
and not @.state.invalid)]">
|
||||
<set path="state.invalid">value</set>
|
||||
</rule>
|
||||
</workflow>
|
||||
'''
|
||||
self.assertNotIn(
|
||||
'state',
|
||||
self.model['services']['activeDirectories'][0])
|
||||
|
||||
self._execute_workflow(xml)
|
||||
|
||||
self.assertEqual(
|
||||
self.model['services']['activeDirectories'][0]['state']['invalid'],
|
||||
'value')
|
||||
|
||||
self.assertIsNotNone(deep.diff(self.original_model, self.model))
|
||||
del self.model['services']['activeDirectories'][0]['state']
|
||||
self.assertIsNone(deep.diff(self.original_model, self.model))
|
||||
|
||||
def test_selecting_properties_from_object_model_within_workflow(self):
|
||||
xml = '''
|
||||
<workflow>
|
||||
<rule match="$.services[*][?(@.id ==
|
||||
'9571747991184642B95F430A014616F9'
|
||||
and not @.test)]">
|
||||
<set path="test">
|
||||
Domain <select
|
||||
path="domain"/> with primary DC <select
|
||||
path="units.0.name"/>
|
||||
</set>
|
||||
</rule>
|
||||
</workflow>
|
||||
'''
|
||||
|
||||
self._execute_workflow(xml)
|
||||
self.assertEqual(
|
||||
self.model['services']['activeDirectories'][0]['test'],
|
||||
'Domain acme.loc with primary DC dc01')
|
||||
|
||||
# Copyright (c) 2013 Mirantis Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
|
||||
import deep
|
||||
import mock
|
||||
import mockfs
|
||||
|
||||
from conductor.workflow import Workflow
|
||||
|
||||
|
||||
def load_sample(name):
|
||||
with mockfs.storage.original_open(os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'sample_data',
|
||||
name)) as sample_file:
|
||||
return sample_file.read()
|
||||
|
||||
|
||||
class TestWorkflow(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.mfs = mockfs.replace_builtins()
|
||||
self.model = json.loads(load_sample('objectModel1.json'))
|
||||
self.original_model = json.loads(load_sample('objectModel1.json'))
|
||||
|
||||
def tearDown(self):
|
||||
mockfs.restore_builtins()
|
||||
|
||||
def _execute_workflow(self, xml):
|
||||
self.mfs.add_entries({'test': xml})
|
||||
stub = mock.MagicMock()
|
||||
stub.side_effect = RuntimeError
|
||||
workflow = Workflow('test', self.model, stub, stub, stub)
|
||||
workflow.execute()
|
||||
|
||||
def test_empty_workflow_leaves_object_model_unchanged(self):
|
||||
xml = '<workflow/>'
|
||||
self._execute_workflow(xml)
|
||||
self.assertIsNone(deep.diff(self.original_model, self.model))
|
||||
|
||||
def test_modifying_object_model_from_workflow(self):
|
||||
xml = '''
|
||||
<workflow>
|
||||
<rule match="$.services[*][?(@.id ==
|
||||
'9571747991184642B95F430A014616F9'
|
||||
and not @.state.invalid)]">
|
||||
<set path="state.invalid">value</set>
|
||||
</rule>
|
||||
</workflow>
|
||||
'''
|
||||
self.assertNotIn(
|
||||
'state',
|
||||
self.model['services']['activeDirectories'][0])
|
||||
|
||||
self._execute_workflow(xml)
|
||||
|
||||
self.assertEqual(
|
||||
self.model['services']['activeDirectories'][0]['state']['invalid'],
|
||||
'value')
|
||||
|
||||
self.assertIsNotNone(deep.diff(self.original_model, self.model))
|
||||
del self.model['services']['activeDirectories'][0]['state']
|
||||
self.assertIsNone(deep.diff(self.original_model, self.model))
|
||||
|
||||
def test_selecting_properties_from_object_model_within_workflow(self):
|
||||
xml = '''
|
||||
<workflow>
|
||||
<rule match="$.services[*][?(@.id ==
|
||||
'9571747991184642B95F430A014616F9'
|
||||
and not @.test)]">
|
||||
<set path="test">
|
||||
Domain <select
|
||||
path="domain"/> with primary DC <select
|
||||
path="units.0.name"/>
|
||||
</set>
|
||||
</rule>
|
||||
</workflow>
|
||||
'''
|
||||
|
||||
self._execute_workflow(xml)
|
||||
self.assertEqual(
|
||||
self.model['services']['activeDirectories'][0]['test'],
|
||||
'Domain acme.loc with primary DC dc01')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user