Преглед изворни кода

Fix corner-cases found through testing (aka ansible is nuts)

pull/642/head
Marcel Partap пре 6 година
родитељ
комит
cf452fdf0a
3 измењених фајлова са 11 додато и 5 уклоњено
  1. +1
    -0
      roles/matrix-synapse/tasks/workers/setup.yml
  2. +2
    -1
      roles/matrix-synapse/tasks/workers/setup_install.yml
  3. +8
    -4
      roles/matrix-synapse/tasks/workers/setup_uninstall.yml

+ 1
- 0
roles/matrix-synapse/tasks/workers/setup.yml Прегледај датотеку

@@ -1,4 +1,5 @@
--- ---
# a negative when condition will not actually prevent ansible from executing loops in imported tasks!


- import_tasks: "{{ role_path }}/tasks/workers/setup_install.yml" - import_tasks: "{{ role_path }}/tasks/workers/setup_install.yml"
when: "matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool" when: "matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool"


+ 2
- 1
roles/matrix-synapse/tasks/workers/setup_install.yml Прегледај датотеку

@@ -12,8 +12,9 @@
path: "{{ item.root + '/' + item.path }}" path: "{{ item.root + '/' + item.path }}"
state: absent state: absent
when: when:
- matrix_synapse_workers_enabled|bool
- item.state == 'link' - item.state == 'link'
- item.path is match('matrix-synapse-worker@*.service')
- item.path is match('matrix-synapse-worker@.*\\.service')
with_filetree: with_filetree:
- "{{ matrix_systemd_path }}/matrix-synapse.service.wants" - "{{ matrix_systemd_path }}/matrix-synapse.service.wants"




+ 8
- 4
roles/matrix-synapse/tasks/workers/setup_uninstall.yml Прегледај датотеку

@@ -1,10 +1,13 @@
--- ---


- name: Ensure individual worker services are stopped
- name: Populate service facts
service_facts:

- name: Ensure any worker services are stopped
service: service:
name: "matrix-synapse-worker@{{ item.worker }}:{{ item.port }}.service"
name: "{{ item.key }}"
state: stopped state: stopped
with_items: "{{ matrix_synapse_workers_enabled_list }}"
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker@.+\\.service')|list|items2dict }}"


# As we cannot know the ports of workers removed from the enabled_list.. # As we cannot know the ports of workers removed from the enabled_list..
# => .. just kill them all (FIXME?) # => .. just kill them all (FIXME?)
@@ -13,8 +16,9 @@
path: "{{ item.root + '/' + item.path }}" path: "{{ item.root + '/' + item.path }}"
state: absent state: absent
when: when:
- not matrix_synapse_workers_enabled|bool
- item.state == 'link' - item.state == 'link'
- item.path is match('matrix-synapse-worker@*.service')
- item.path is match('matrix-synapse-worker@.*\\.service')
with_filetree: with_filetree:
- "{{ matrix_systemd_path }}/matrix-synapse.service.wants" - "{{ matrix_systemd_path }}/matrix-synapse.service.wants"




Loading…
Откажи
Сачувај