Skip to content

Commit

Permalink
Ansible Dataset Loader: Filter out ALL CDN before performing CDN snap…
Browse files Browse the repository at this point in the history
…shots or queueing CDNs (#6975)

This is a preventative measure should a CDN name be supplied that is alphabetically before ALL (not the default behavior with MKGA).
  • Loading branch information
zrhoffman authored Aug 8, 2022
1 parent 9893f14 commit 743f1d4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1035,26 +1035,30 @@
uri:
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/snapshot?cdn={{ item.name }}"
method: PUT
with_items: "{{ get_all_cdns.json.response[1:] }}"
with_items: "{{ get_all_cdns.json | json_query(no_all_cdn_query) }}"
register: snapshot_out
failed_when: (snapshot_out.status == 400 and snapshot_out.json | to_json | from_json | json_query(error_query) | length != 0) or (snapshot_out.status > 400 and snapshot_out.status < 600)
no_log: true
retries: 10
delay: 10
vars:
error_query: "alerts[?level=='error'].text[?!contains(@,'already exists')]"
all_cdn: ALL
no_all_cdn_query: "response[?name != `{{ all_cdn }}`]"

- name: Queue Caches in all CDNs
uri:
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/cdns/{{ item.id }}/queue_update"
method: POST
body:
action: "queue"
with_items: "{{ get_all_cdns.json.response[1:] }}"
with_items: "{{ get_all_cdns.json | json_query(no_all_cdn_query) }}"
register: queue_out
failed_when: (queue_out.status == 400 and queue_out.json | to_json | from_json | json_query(error_query) | length != 0) or (queue_out.status > 400 and queue_out.status < 600)
no_log: true
retries: 10
delay: 10
vars:
error_query: "alerts[?level=='error'].text[?!contains(@,'action must be')]"
all_cdn: ALL
no_all_cdn_query: "response[?name != `{{ all_cdn }}`]"

0 comments on commit 743f1d4

Please sign in to comment.