Skip to content

Commit

Permalink
Improve error handling of get CA bundle data task
Browse files Browse the repository at this point in the history
This role sometimes fails Molecule, as we are ignoring errors we can't
see why. It's likely just a time out issue but let's be sure.

This patch prints the error and continues to ignore it.
  • Loading branch information
lewisdenny authored and openshift-merge-bot[bot] committed Aug 6, 2024
1 parent 34b2b1c commit 5c9cff6
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions roles/install_openstack_ca/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,25 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Get CA bundle data with retries
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command:
cmd: 'oc get secret combined-ca-bundle -n openstack -o "jsonpath={.data.tls-ca-bundle\.pem}"'
retries: 10
no_log: true
delay: 3
until: ca_bundle_data.rc == 0
register: ca_bundle_data
ignore_errors: true
# Here we rescue and not force error to preseve
# the ignore_errors: true
- name: Try/catch block
block:
- name: Get CA bundle data with retries
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command:
cmd: 'oc get secret combined-ca-bundle -n openstack -o "jsonpath={.data.tls-ca-bundle\.pem}"'
retries: 10
no_log: true
delay: 3
until: ca_bundle_data.rc == 0
register: ca_bundle_data
rescue:
- name: Dump ca_bundle_data var
ansible.builtin.debug:
var: ca_bundle_data

- name: Get CA bundle
when: ca_bundle_data.rc == 0
Expand All @@ -49,7 +56,7 @@
get_checksum: false
get_mime: false

- name: Inject OpenStackControlplane CA bundle # noqa: no-handler
- name: Inject OpenStackControlplane CA bundle # noqa: no-handler
when: _ca_bundle_file.stat.exists
vars:
cifmw_install_ca_bundle_src: "{{ _ca_bundle_file.stat.path }}"
Expand Down

0 comments on commit 5c9cff6

Please sign in to comment.