Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1435446 - Trigger yum update after RHELRegistration in initial deployment
Trigger yum update after RHELRegistration in initial deployment
Status: CLOSED ERRATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates (Show other bugs)
10.0 (Newton)
Unspecified Unspecified
medium Severity medium
: ga
: 12.0 (Pike)
Assigned To: Alex Schultz
Gurenko Alex
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-23 16:20 EDT by Andreas Karis
Modified: 2018-03-07 05:12 EST (History)
5 users (show)

See Also:
Fixed In Version: openstack-tripleo-heat-templates-7.0.0-0.20170616123155.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-12-13 16:20:39 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1640894 None None None 2017-03-24 12:42 EDT
OpenStack gerrit 449724 None None None 2017-03-24 12:43 EDT
Red Hat Product Errata RHEA-2017:3462 normal SHIPPED_LIVE Red Hat OpenStack Platform 12.0 Enhancement Advisory 2018-02-15 20:43:25 EST

  None (edit)
Description Andreas Karis 2017-03-23 16:20:03 EDT
Description of problem:
Packages are not updated after RHEL Registration to Satellite server in initial stack creation. This seems to be an order of operations problem (or a design choice???)

UpdateDeployment stack resource is deployed before RHELRegistrationDeployment stack, therefore no packages updates are made. I have changed Compute and Controller Role YAML files as highlighted below to have all overcloud updated with all packages when overcloud is deployed. 

Version-Release number of selected component (if applicable):
[stack@undercloud-4 rhel-registration]$ rpm -qa | grep templates  | grep tripleo
openstack-tripleo-heat-templates-5.2.0-3.el7ost.noarch

How reproducible:
Deploy stack and register to satellite

Additional info:
In order to work around this, we made the following change (which still needs to be tested in the environment, but it should work):

Follow the documentation: https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/10/html-single/advanced_overcloud_customization/#sect-Registering_the_Overcloud

It suggests to copy the registration files from the Heat template collection:
~~~
$ cp -r /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration ~/templates/.
~~~

And then include those copied files:
~~~
$ openstack overcloud deploy --templates [...] -e /home/stack/templates/rhel-registration/environment-rhel-registration.yaml -e /home/stack/templates/rhel-registration/rhel-registration-resource-registry.yaml
~~~

What you can then do is, push your modification into 
/home/stack/templates/rhel-registration/rhel-registration.yaml

~~~
[stack@undercloud-4 rhel-registration]$ diff -c /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml /home/stack/templates/rhel-registration/rhel-registration.yaml 
*** /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml	2017-01-02 19:14:26.000000000 -0500
--- /home/stack/templates/rhel-registration/rhel-registration.yaml	2017-03-23 16:09:35.659288981 -0400
***************
*** 118,123 ****
--- 118,154 ----
        input_values:
          REG_METHOD: {get_param: rhel_reg_method}
  
+    YumUpdateConfigurationAfterRHELRegistration:
+      type: OS::Heat::SoftwareConfig
+      properties:
+        group: script
+        config: |
+          #!/bin/bash
+          set -x
+          list_updates=$(yum list -q updates)
+          if [[ "$list_updates" == "" ]]; then
+             echo "No packages require updating"
+             exit 0
+          fi
+          full_command="yum -q -y update"
+          echo "Running: $full_command"
+          result=$($full_command)
+          return_code=$?
+          echo "$result"
+          echo "yum return code: $return_code"
+  
+    UpdateDeploymentAfterRHELRegistration:
+      type: OS::Heat::SoftwareDeployment
+      depends_on: RHELRegistrationDeployment
+      properties:
+        name: UpdateDeploymentAfterRHELRegistration
+        config: {get_resource: YumUpdateConfigurationAfterRHELRegistration}
+        server:  {get_param: server}
+        actions: ['CREATE'] # Only do this on CREATE
+        input_values:
+          update_identifier:
+            get_param: DeployIdentifier
+ 
  outputs:
    deploy_stdout:
      description: Deployment reference, used to trigger puppet apply on changes
~~~

Can we add this **by default** to the RHELRegistration templates?
Comment 1 Andreas Karis 2017-03-23 16:35:06 EDT
[stack@undercloud-4 rhel-registration]$ diff -c /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml /home/stack/templates/rhel-registration/rhel-registration.yaml 
*** /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml	2017-01-02 19:14:26.000000000 -0500
--- /home/stack/templates/rhel-registration/rhel-registration.yaml	2017-03-23 16:34:13.541312274 -0400
***************
*** 118,123 ****
--- 118,151 ----
        input_values:
          REG_METHOD: {get_param: rhel_reg_method}
  
+    YumUpdateConfigurationAfterRHELRegistration:
+      type: OS::Heat::SoftwareConfig
+      properties:
+        group: script
+        config: |
+          #!/bin/bash
+          set -x
+          list_updates=$(yum list -q updates)
+          if [[ "$list_updates" == "" ]]; then
+             echo "No packages require updating"
+             exit 0
+          fi
+          full_command="yum -q -y update"
+          echo "Running: $full_command"
+          result=$($full_command)
+          return_code=$?
+          echo "$result"
+          echo "yum return code: $return_code"
+  
+    UpdateDeploymentAfterRHELRegistration:
+      type: OS::Heat::SoftwareDeployment
+      depends_on: RHELRegistrationDeployment
+      properties:
+        name: UpdateDeploymentAfterRHELRegistration
+        config: {get_resource: YumUpdateConfigurationAfterRHELRegistration}
+        server:  {get_param: server}
+        actions: ['CREATE'] # Only do this on CREATE
+ 
  outputs:
    deploy_stdout:
      description: Deployment reference, used to trigger puppet apply on changes
Comment 2 Andreas Karis 2017-03-24 12:23:29 EDT
Coming to think of it, this may actually be a design decision (not to run any packet updates). If this is the case, feel free to close out this bug report.
Comment 3 Alex Schultz 2017-03-24 12:42:43 EDT
No we have a similar bug upstream LP#1640894 which describes something similar situation so this sounds like a reasonable feature request for future releases. I'm not sure on a backport but I'll at least propose it upstream.
Comment 4 Andreas Karis 2017-03-24 12:59:08 EDT
Looking at the upstream bug, does this mean that if we simply set a dummy value for: UpdateIdentifer
... that this will trigger an initial update?
Comment 5 Alex Schultz 2017-03-24 14:23:06 EDT
So tracing through, it seems that if you set UpdateIdentifier it will perform a yum -y update as part of the deployment and switch to use the latest version of the packages available.  So would that work for you in this case or do we need to specifically need to run a yum update immediately after registering and before doing anything else?
Comment 10 Gurenko Alex 2017-12-13 04:13:25 EST
Verified with build 2017-12-06.2
Comment 13 errata-xmlrpc 2017-12-13 16:20:39 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:3462

Note You need to log in before you can comment on or make changes to this bug.