Treat omitted host_apps.enabled as true (#36)
Sync runner checkout / sync (push) Successful in 6s
Sync runner checkout / sync (push) Successful in 6s
Closes #35. ## Summary - `#33` used Jinja `rejectattr('enabled', 'equalto', false)` to skip stopped apps. That filter **requires** the key, so every `host_apps` row that omits `enabled` (the documented default) crashed deploy on all webservers before git/compose. - Filter with `item.enabled | default(true)` instead, in `app-deploy` and `web-static`. `print_forge` (`enabled: false`) still skipped. `url_shortening_service` and every other omitted-key row deploy again. ## Test plan - [ ] `ansible-playbook playbooks/deploy-apps.yml --syntax-check` - [ ] Redeploy `url_shortening_service` beta: `deploy.sh --app url_shortening_service --env beta --ref <sha>` - [ ] Confirm `print_forge` is still not started (no compose up on 8007/8019) Reviewed-on: #36
This commit was merged in pull request #36.
This commit is contained in:
@@ -35,14 +35,24 @@
|
||||
- app_env is defined
|
||||
- matching_host_apps | length == 0
|
||||
|
||||
# rejectattr('enabled', …) raises when the key is omitted. Omit = enabled (#35).
|
||||
- name: Reset deploy targets
|
||||
ansible.builtin.set_fact:
|
||||
deploy_targets: []
|
||||
|
||||
- name: "Drop disabled host_apps (enabled: false)"
|
||||
ansible.builtin.set_fact:
|
||||
deploy_targets: "{{ matching_host_apps | rejectattr('enabled', 'equalto', false) | list }}"
|
||||
deploy_targets: "{{ deploy_targets + [item] }}"
|
||||
loop: "{{ matching_host_apps }}"
|
||||
when: item.enabled | default(true)
|
||||
loop_control:
|
||||
label: "{{ item.name }}/{{ item.env }}"
|
||||
|
||||
- name: Show skipped disabled apps
|
||||
ansible.builtin.debug:
|
||||
msg: "skip disabled {{ item.name }}/{{ item.env }} on {{ inventory_hostname }}"
|
||||
loop: "{{ matching_host_apps | selectattr('enabled', 'equalto', false) | list }}"
|
||||
loop: "{{ matching_host_apps }}"
|
||||
when: not (item.enabled | default(true))
|
||||
loop_control:
|
||||
label: "{{ item.name }}/{{ item.env }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user