Octavia: do not attempt container restart on empty list

With composable roles, the node with the octavia agents may not have any
processes running when we hit step 5 external deploy tasks, resulting in
our "one line" restart failing. This patch splits the query for octavia
containers out into a separate task and we conditionally run the restart
task depending on whether there are containers found.

Change-Id: I08a06b300d43aca7db2c9e3341a07bc903163d26
Closes-Bug: #1861413
This commit is contained in:
Brent Eagles 2020-01-30 15:33:56 -03:30
parent 6f33d53d51
commit 1bafe4df85
1 changed files with 11 additions and 1 deletions

View File

@ -49,12 +49,22 @@
when:
- octavia_config_updated
- name: get list of running octavia containers
become: true
shell: |
sudo "{{ container_cli }}" ps -f name=octavia -q
register: running_octavia_containers
when:
- octavia_config_updated
- name: restart octavia containers
become: true
become_user: root
shell: "{{ container_cli }} restart $(sudo {{ container_cli }} ps -f name=octavia -q)"
shell: "{{ container_cli }} restart {{ running_octavia_containers.stdout }}"
when:
- octavia_config_updated
- running_octavia_containers.rc != 0
- (running_octavia_containers.stdout|length) > 0
- name: remove directory /etc/octavia/conf.d/common (LP#1836074)
file: