Skip to content

Commit 1904642

Browse files
sd109jjo93sa
andauthored
Fix regex expression in ansible changed_when field (#919) (#920)
* Fix regex expression in ansible changed_when field (#919) * Proposed fix for regex. Deploy 0.16.2 leads to the following error: ``` TASK [azimuth_cloud.azimuth_ops.azimuth_capi_operator : Apply ACL annotations to non-current templates] *** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: re.error: missing ), unterminated subpattern at position 0 fatal: [azimuth-cl2-seed]: FAILED! => {"msg": "Unexpected failure during module execution: missing ), unterminated subpattern at position 0", "stdout": ""} ``` It seems the regex negative lookahead isn't correctly formatted, this change fixes that * Changes requested * Fix other 'no change' regex patterns --------- Co-authored-by: James Osborne <[email protected]>
1 parent a80f64f commit 1904642

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

roles/azimuth/tasks/move-caas-cluster.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
--type merge
4646
--patch '{"spec": {"paused": true}}'
4747
register: kubectl_patch_pause_cluster
48-
changed_when: kubectl_patch_pause_cluster.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
48+
changed_when: kubectl_patch_pause_cluster.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
4949

5050
- name: Copy cloud credentials secret to new namespace
5151
ansible.builtin.command: kubectl apply -f -
@@ -120,7 +120,7 @@
120120
azimuth_cluster_status_patch:
121121
status: "{{ cluster.status }}"
122122
register: kubectl_patch_cluster_status
123-
changed_when: kubectl_patch_cluster_status.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
123+
changed_when: kubectl_patch_cluster_status.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
124124

125125
- name: Get UID of new cluster object
126126
ansible.builtin.command: >-
@@ -148,7 +148,7 @@
148148
uid: "{{ azimuth_cluster_new_uid.stdout }}"
149149
blockOwnerDeletion: true
150150
register: kubectl_patch_owner_refs
151-
changed_when: kubectl_patch_owner_refs.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
151+
changed_when: kubectl_patch_owner_refs.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
152152

153153
- name: Resume new cluster
154154
ansible.builtin.command: >-
@@ -157,7 +157,7 @@
157157
--type merge
158158
--patch '{"spec": {"paused": false}}'
159159
register: kubectl_patch_resume_cluster
160-
changed_when: kubectl_patch_resume_cluster.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
160+
changed_when: kubectl_patch_resume_cluster.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
161161

162162
- name: Remove old cluster resources
163163
ansible.builtin.command: kubectl delete -f -

roles/azimuth_capi_operator/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
loop_control:
6363
label: "{{ item.metadata.name }}"
6464
register: kubectl_patch_acl_annotations
65-
changed_when: kubectl_patch_acl_annotations.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
65+
changed_when: kubectl_patch_acl_annotations.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
6666

6767
- name: Deprecate non-current templates
6868
ansible.builtin.command: >-
@@ -81,7 +81,7 @@
8181
loop_control:
8282
label: "{{ item.metadata.name }}"
8383
register: kubectl_patch_templates
84-
changed_when: kubectl_patch_templates.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
84+
changed_when: kubectl_patch_templates.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0
8585

8686
- name: Install Azimuth CAPI app templates
8787
ansible.builtin.command: kubectl apply -f -

roles/zenith/tasks/migrate-services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@
8282
map("split", ":")
8383
}}
8484
register: kubectl_patch_crd_pubkey
85-
changed_when: kubectl_patch_crd_pubkey.stdout_lines | select('match', '(?!.*\\(no change\\)$') | length > 0
85+
changed_when: kubectl_patch_crd_pubkey.stdout_lines | select('match', '(?!.*\\(no change\\)$)') | length > 0

0 commit comments

Comments
 (0)