Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1829836: Remove the ansible_failed_task variable from all block/rescue instances. #1208

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@
# Validate user-provided Hive TLS configuration when top-level spec.tls.enabled is set to false
#
- name: Validate the user-provided Hive TLS configuration
include_tasks: validate_hive_tls.yml
block:
- include_tasks: validate_hive_tls.yml
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: not meteringconfig_tls_enabled

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@
# Validate user-provided Presto TLS configuration when top-level spec.tls.enabled is set to false
#
- name: Validate the user-provided Presto TLS configuration
include_tasks: validate_presto_tls.yml
block:
- include_tasks: validate_presto_tls.yml
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: not meteringconfig_tls_enabled

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,21 @@
# Reporting Operator Openshift Auth-Proxy
#
- name: Validate the user-provided authProxy configuration
include_tasks: validate_reporting_operator_tls.yml
block:
- include_tasks: validate_reporting_operator_tls.yml
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: not meteringconfig_tls_enabled

- name: Check for the existence of reporting-operator authProxy-related secret data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@
current_conditions:
type: "Invalid"
status: "True"
message: "The task \"{{ ansible_failed_task.name }}\" failed with the following message: {{ ansible_failed_result.msg }}"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when: ansible_failed_result and (ansible_failed_result.msg | length > 0)
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
vars:
s3_credentials_secret_exists: "{{ operator_s3_credentials_secret.resources and operator_s3_credentials_secret.resources | length > 0 }}"
s3_use_dualstack_endpoint: "{{ _ocp_enabled_use_ipv6_networking }}"
Expand Down Expand Up @@ -102,10 +105,13 @@
current_conditions:
type: "Invalid"
status: "True"
message: "The task \"{{ ansible_failed_task.name }}\" failed with the following message: {{ ansible_failed_result.msg }}"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when: ansible_failed_result and (ansible_failed_result.msg | length > 0)
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: meteringconfig_storage_hive_storage_type == 's3Compatible'

#
Expand Down Expand Up @@ -135,10 +141,13 @@
current_conditions:
type: "Invalid"
status: "True"
message: "The task \"{{ ansible_failed_task.name }}\" failed with the following message: {{ ansible_failed_result.msg }}"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when: ansible_failed_result and (ansible_failed_result.msg | length > 0)
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: meteringconfig_storage_hive_storage_type == 'azure' and not meteringconfig_storage_azure_create_secret

- name: Configure Azure Storage
Expand All @@ -161,10 +170,13 @@
current_conditions:
type: "Invalid"
status: "True"
message: "The task \"{{ ansible_failed_task.name }}\" failed with the following message: {{ ansible_failed_result.msg }}"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when: ansible_failed_result and (ansible_failed_result.msg | length > 0)
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: meteringconfig_storage_hive_storage_type == 'azure' and meteringconfig_storage_azure_create_secret

#
Expand Down Expand Up @@ -197,10 +209,13 @@
current_conditions:
type: "Invalid"
status: "True"
message: "The task \"{{ ansible_failed_task.name }}\" failed with the following message: {{ ansible_failed_result.msg }}"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when: ansible_failed_result and (ansible_failed_result.msg | length > 0)
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: meteringconfig_storage_hive_storage_type == 'gcs'

- include_tasks: update_meteringconfig_status.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
always:
- name: Cleanup the temporary directory which held the certificates and keys
file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@
no_log: "{{ not meteringconfig_log_helm_template }}"
register: template_results
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
failed_result: "{{ ansible_failed_result.results | first }}"
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed command: {{ failed_result.cmd | replace('...', '') | to_nice_yaml(indent=8, width=1337) }} "
"Error message: {{ failed_result.stderr_lines | to_nice_yaml }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when: ansible_failed_result and ansible_failed_result.results and (ansible_failed_result.results | length > 0)
- include_tasks: update_meteringconfig_status.yml
vars:
failed_result: "{{ ansible_failed_result.results | first }}"
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |-
"{{ failed_result.stderr | to_nice_yaml }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when:
- ansible_failed_result is defined
- ansible_failed_result.results is defined
- ansible_failed_result.results | length > 0

- name: Add prune label to resources
vars:
Expand Down Expand Up @@ -62,19 +64,21 @@
definition: "{{ updated_template_results | flatten }}"
merge_type: ['merge', 'strategic-merge']
rescue:
# Note for ansible_failed_return:
# there's no guarantee that more fields besides msg will be available
# as the return object varies depending on the type of error encountered
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
when: ansible_failed_result is defined and (ansible_failed_result.msg | length > 0)
# Note for ansible_failed_return:
# there's no guarantee that more fields besides msg will be available
# as the return object varies depending on the type of error encountered
- include_tasks: update_meteringconfig_status.yml
vars:
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: template_results.changed and resource is not none

- name: Prune resources
Expand All @@ -87,13 +91,16 @@
loop_var: resource
label: "{{ resource.template_file }}"
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
- include_tasks: update_meteringconfig_status.yml
vars:
current_conditions:
type: "Invalid"
status: "True"
message: |
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: not (resource.create | default(true))
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: meteringconfig_ocp_disabled

#
Expand All @@ -71,14 +73,16 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0

- include_tasks: update_meteringconfig_status.yml
vars:
Expand All @@ -104,4 +108,3 @@
kind: MeteringConfig
name: "{{ meta.name }}"
namespace: "{{ meta.namespace }}"

Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: hiveStorageType == 'gcs'

#
Expand All @@ -66,14 +68,16 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: hiveStorageType == 'azure' and not meteringconfig_storage_azure_create_secret

#
Expand Down Expand Up @@ -109,12 +113,14 @@
rescue:
- include_tasks: update_meteringconfig_status.yml
vars:
end_play_after_updating_status: true
current_conditions:
type: "Invalid"
status: "True"
message: |
"Failed task name: {{ ansible_failed_task.name }}"
"Failed task message: {{ ansible_failed_result.msg }}"
"{{ ansible_failed_result.msg }}"
lastTransitionTime: "{{ now(utc=False).isoformat() + 'Z' }}"
end_play_after_updating_status: true
when:
- ansible_failed_result is defined
- ansible_failed_result.msg | length > 0
when: hiveStorageType == 's3Compatible'