Skip to content

Commit

Permalink
using block-rescue instead of ignore errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sugetha24 committed Oct 7, 2024
1 parent f6a2e0f commit 1da3eec
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

- name: Cleanup orphan CC
run_once: true
uri:
ansible.legacy.uri:
url: https://{{ cv_server }}/api/resources/changecontrol/v1/ChangeControlConfig?key.id={{ cv_deploy_results.change_control.id }}
validate_certs: yes
return_content: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,31 @@

- name: Dynamically add inactive device avd-ci-core1 to group INACTIVE
run_once: true
add_host:
ansible.legacy.add_host:
name: avd-ci-core1
groups: INACTIVE

- name: Provision with cv_submit_workspace_force = false
run_once: true
delegate_to: localhost
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
cv_devices: [ avd-ci-leaf2, avd-ci-core1 ]
cv_submit_workspace_force: false
ignore_errors: yes

- name: Display CVP result
run_once: true
ansible.builtin.debug:
msg: '{{ cv_deploy_results }}'

- name: Check CVP returns
run_once: true
ansible.builtin.assert:
that:
# errors and warnings
- "'Failed to submit workspace' in cv_deploy_results.errors[0]"
block:
- name: Trigger errors
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
cv_devices: [ avd-ci-leaf2, avd-ci-core1 ]
cv_submit_workspace_force: false
rescue:
- name: Check CVP returns
run_once: true
ansible.builtin.assert:
that:
# errors and warnings
- "'Failed to submit workspace' in cv_deploy_results.errors[0]"

- name: Cleanup orphan workspace
run_once: true
uri:
ansible.legacy.uri:
url: https://{{ cv_server }}/api/resources/workspace/v1/WorkspaceConfig/some
validate_certs: yes
return_content: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

- name: Dynamically add inactive device avd-ci-core1 to group INACTIVE
run_once: true
add_host:
ansible.legacy.add_host:
name: avd-ci-core1
groups: INACTIVE

Expand All @@ -57,7 +57,7 @@

- name: Cleanup orphan CC
run_once: true
uri:
ansible.legacy.uri:
url: https://{{ cv_server }}/api/resources/changecontrol/v1/ChangeControlConfig?key.id={{ cv_deploy_results.change_control.id }}
validate_certs: yes
return_content: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

- name: Cleanup orphan workspace
run_once: true
uri:
ansible.legacy.uri:
url: https://{{ cv_server }}/api/resources/workspace/v1/WorkspaceConfig/some
validate_certs: yes
return_content: yes
Expand Down

0 comments on commit 1da3eec

Please sign in to comment.