Add UpgradeInitCommand to deployed-server
authorJames Slagle <jslagle@redhat.com>
Sun, 8 Jan 2017 16:07:13 +0000 (11:07 -0500)
committerJames Slagle <jslagle@redhat.com>
Sun, 8 Jan 2017 16:07:13 +0000 (11:07 -0500)
The commands specified by UpgradeInitCommand need to be run before
InstanceIdDeployment in deployed-server.yaml, otherwise the upgrades
hang with the resource in progress. This is because the new
python-heat-agent-apply-config has not yet been installed on the
deployed server.

Adding the UpgradeInitCommand (and corresponding
SoftwareConfig/SoftwareDeployment to apply it) will cause the new repos
and python-heat-agent-* rpm's to be installed before
InstanceIdDeployment.

An open question is whether or not Heat should even be triggering the
InstanceIdDepoyment to IN_PROGRESS on upgrade when only the group is
changing from os-apply-config to apply-config. If that turns out to be a
Heat bug, then this patch wouldn't be necessary.

Change-Id: I9d87f995744415b110a7d0bca8d2309d7167148c

deployed-server/deployed-server.yaml

index 2929c5e..3ff6361 100644 (file)
@@ -38,6 +38,12 @@ parameters:
     type: json
     description: Optional scheduler hints to pass to nova
     default: {}
+  UpgradeInitCommand:
+    type: string
+    description: |
+      Command or script snippet to run on all overcloud nodes to
+      initialize the upgrade process. E.g. a repository switch.
+    default: ''
 
 resources:
   deployed-server:
@@ -46,6 +52,25 @@ resources:
       name: {get_param: name}
       software_config_transport: {get_param: software_config_transport}
 
+  UpgradeInitConfig:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      config:
+        list_join:
+        - ''
+        - - "#!/bin/bash\n\n"
+          - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
+          - get_param: UpgradeInitCommand
+
+  UpgradeInitDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      name: UpgradeInitDeployment
+      server: {get_resource: deployed-server}
+      config: {get_resource: UpgradeInitConfig}
+
+
   InstanceIdConfig:
     type: OS::Heat::StructuredConfig
     properties:
@@ -58,6 +83,7 @@ resources:
     properties:
       config: {get_resource: InstanceIdConfig}
       server: {get_resource: deployed-server}
+    depends_on: UpgradeInitDeployment
 
   HostsEntryConfig:
     type: OS::Heat::SoftwareConfig