Skip to content

Commit

Permalink
Add error handling to block statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii Chepeliuk authored and vchepeli committed Apr 18, 2018
1 parent 769399c commit 8045e01
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
19 changes: 9 additions & 10 deletions roles/bind-crc-apb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
register: crc_json_config_valid
ignore_errors: True

- asb_last_operation:
description: "config was not valid json. Could not bind"
when: crc_json_config_valid.failed
- block:
- asb_last_operation:
description: "config was not valid json. Could not bind"

- lineinfile:
line: 'config was not valid json. Could not bind'
path: '{{ crc_term_msg_filepath }}'
unsafe_writes: true
when: crc_json_config_valid.failed
- lineinfile:
line: 'config was not valid json. Could not bind'
path: '{{ crc_term_msg_filepath }}'
unsafe_writes: true

- fail:
msg: "config was not valid json. Could not bind"
- fail:
msg: "config was not valid json. Could not bind"
when: crc_json_config_valid.failed

- name: Creating CRC {{ CLIENT_ID }} configmap
Expand Down
19 changes: 9 additions & 10 deletions roles/provision-crc-apb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
register: crc_json_config_valid
ignore_errors: True

- asb_last_operation:
description: "config was not valid json. Could not provision"
when: crc_json_config_valid.failed
- block:
- asb_last_operation:
description: "config was not valid json. Could not provision"

- lineinfile:
line: 'config was not valid json. Could not provision'
path: '{{ crc_term_msg_filepath }}'
unsafe_writes: true
when: crc_json_config_valid.failed
- lineinfile:
line: 'config was not valid json. Could not provision'
path: '{{ crc_term_msg_filepath }}'
unsafe_writes: true

- fail:
msg: "config was not valid json. Could not provision"
- fail:
msg: "config was not valid json. Could not provision"
when: crc_json_config_valid.failed

- name: Creating CRC {{ crc_svc_config_name }} secrets
Expand Down

0 comments on commit 8045e01

Please sign in to comment.