Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-25577

edpm_boostrap_command ignores failures except for the last command

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • rhos-18.0.z
    • documentation
    • None
    • Moderate

      To Reproduce Steps to reproduce the behavior:

      • Provide `edpm_bootstrap_command` with multiple commands, where one of the commands fails but the last one succeeds.
      • The bootstrap as a whole is considered successful and the `edpm.bootstrap.hash` fact is written to prevent re-executing the same command.

      Expected behavior

      • If one command in the `edpm_bootstrap_command` fails, i'd expect the bootstrap as a whole to fail. If there are commands that can fail expectedly, they should be suffixed with `|| true`.
      • I believe we should unconditionally prepend `set -e` to edpm_bootstrap_command when we execute it, to ensure any failed command somewhere in the middle of the bootstrap snippet fails the whole bootstrap.

      Bug impact

      • This came to bite us at a customer. Will link the relevant conversation in a private comment.

      Known workaround

      • Include `set -e` at the beginning when setting the value for `edpm_bootstrap_command` variable.

       

      Relevant code: https://github.com/openstack-k8s-operators/edpm-ansible/blob/43c8ae13d85939e9a3f9cddbe838cbe4616199f7/roles/edpm_bootstrap/tasks/bootstrap_command.yml 

              erpeters@redhat.com Erin Peterson
              jstransk@redhat.com Jiri Stransky
              rhos-dfg-df
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: