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

Fix the misleading rollback error messages, when failure occurs in include_tasks. #83

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion redeploy/_scheme_addallnew_rmdisk_rollback/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
include_tasks: rescue.yml

- name: rescue | force fail from block so Jenkins gets error code. (If we prefer not to fail, we should otherwise 'meta end_play' to prevent tidying of pre-rescued VMs)
fail: { msg: "Task '{{ansible_failed_task.name}}' failed in block. Error message was: '{{ansible_failed_result.msg}}'" }
fail: { msg: ["Task '{{ansible_failed_task.name}}' failed in block (but rescued)", "{{ansible_failed_result.msg}}"] }
when: canary!="tidy"


Expand Down
8 changes: 4 additions & 4 deletions redeploy/_scheme_addnewvm_rmdisk_rollback/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

- name: Run redeploy per hosttype. Create one at a time, then stop previous.
include_tasks: redeploy_by_hosttype.yml
with_items: "{{ myhosttypes_array }}"
with_items: "{{ myhosttypes_array | default([]) }}"
loop_control:
loop_var: hosttype
vars:
cluster_hosts_target_by_hosttype: "{{cluster_hosts_target | dict_agg('hosttype')}}"
myhosttypes_array: "{%- if myhosttypes is defined -%} {{ myhosttypes.split(',') }} {%- else -%} {{ cluster_hosts_target_by_hosttype.keys() | list }} {%- endif -%}"
cluster_hosts_target_by_hosttype: "{{cluster_hosts_target | default({}) | dict_agg('hosttype') }}"
myhosttypes_array: "{%- if myhosttypes is defined -%}{{ myhosttypes.split(',') }}{%- elif cluster_hosts_target_by_hosttype is defined and cluster_hosts_target_by_hosttype.keys() | length -%}{{ cluster_hosts_target_by_hosttype.keys() | list }}{%- else -%}[]{%- endif -%}"

- name: Remove any other retiring VM(s) that might exist if we're redeploying to a smaller topology.
block:
Expand Down Expand Up @@ -63,7 +63,7 @@
include_tasks: rescue.yml

- name: rescue | force fail from block so Jenkins gets error code. (If we prefer not to fail, we should otherwise 'meta end_play' to prevent tidying of pre-rescued VMs)
fail: { msg: "Task '{{ansible_failed_task.name}}' failed in block. Error message was: '{{ansible_failed_result.msg}}'" }
fail: { msg: ["Task '{{ansible_failed_task.name}}' failed in block (but rescued)", "{{ansible_failed_result.msg}}"] }
when: canary!="tidy"


Expand Down
8 changes: 4 additions & 4 deletions redeploy/_scheme_rmvm_keepdisk_rollback/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

- name: Run redeploy per hosttype. Create one at a time, then stop previous.
include_tasks: by_hosttype.yml
with_items: "{{ myhosttypes_array }}"
with_items: "{{ myhosttypes_array | default([]) }}"
loop_control:
loop_var: hosttype
vars:
cluster_hosts_target_by_hosttype: "{{cluster_hosts_target | dict_agg('hosttype')}}"
myhosttypes_array: "{%- if myhosttypes is defined -%} {{ myhosttypes.split(',') }} {%- else -%} {{ cluster_hosts_target_by_hosttype.keys() | list }} {%- endif -%}"
cluster_hosts_target_by_hosttype: "{{cluster_hosts_target | default({}) | dict_agg('hosttype') }}"
myhosttypes_array: "{%- if myhosttypes is defined -%}{{ myhosttypes.split(',') }}{%- elif cluster_hosts_target_by_hosttype is defined and cluster_hosts_target_by_hosttype.keys() | length -%}{{ cluster_hosts_target_by_hosttype.keys() | list }}{%- else -%}[]{%- endif -%}"

- fail:
when: testfail is defined and testfail == "fail_1"
Expand Down Expand Up @@ -89,7 +89,7 @@
myhosttypes_array: "{%- if myhosttypes is defined -%} {{ myhosttypes.split(',') }} {%- else -%} {{ cluster_hosts_target_by_hosttype.keys() | list }} {%- endif -%}"

- name: rescue | force fail from block so Jenkins gets error code. (If we prefer not to fail, we should otherwise 'meta end_play' to prevent tidying of pre-rescued VMs)
fail: { msg: "Task '{{ansible_failed_task.name}}' failed in block. Error message was: '{{ansible_failed_result.msg}}'" }
fail: { msg: ["Task '{{ansible_failed_task.name}}' failed in block (but rescued)", "{{ansible_failed_result.msg}}"] }
when: canary!="tidy"


Expand Down