Clean up roles data adjustment
1. The python_bin var is unused, so it should be removed. 2. Tasks should be seperated by a newline in order to easily see that they are seperate tasks. 3. The return code of 2 was in the wrong place. It should have been where the data was changed, as per the changed_when condition. 4. With the return code adjusted, the final task's condition also needed adjusting to match. Related-Bug: #1856865 Change-Id: I916c3ed394f54561fff2a106288a667c0b877360 (cherry picked from commit53377cdb14
) (cherry picked from commit967f3805d3
) (cherry picked from commit6c5631bb3d
)
This commit is contained in:
parent
7b1bf8f4f3
commit
204ca182ff
|
@ -53,8 +53,6 @@
|
|||
dest: "{{ roles_data }}.json"
|
||||
|
||||
- name: Ensure we set update_serial in roles data
|
||||
vars:
|
||||
python_bin: "{{ ansible_python_interpreter | default('python') }}"
|
||||
shell: |
|
||||
set -o pipefail
|
||||
if grep -q OS::TripleO::Services::Pacemaker "{{ roles_data }}.json"; then
|
||||
|
@ -62,15 +60,16 @@
|
|||
jq 'del(.[] | .update_serial ) |
|
||||
map(. |= (. += {update_serial: 25} )) |
|
||||
map( if .ServicesDefault | contains (["OS::TripleO::Services::Pacemaker"]) then . += {update_serial: 1} else . += {update_serial: 25} end )'
|
||||
exit 2
|
||||
else
|
||||
echo "No service defined, not modifying the role file"
|
||||
exit 2
|
||||
fi
|
||||
register: modified_roles_data
|
||||
failed_when: modified_roles_data.rc not in [0,2]
|
||||
changed_when: modified_roles_data.rc == 2
|
||||
|
||||
- name: "Dump the modified roles_data into {{ roles_data }}"
|
||||
copy:
|
||||
content: "{{ modified_roles_data.stdout | from_json | to_nice_yaml(indent=2) | trim}}"
|
||||
dest: "{{ roles_data }}"
|
||||
when: modified_roles_data.rc == 0
|
||||
when: modified_roles_data.rc == 2
|
||||
|
|
Loading…
Reference in New Issue