[QUEENS ONLY] Don't check openvswitch service if no ovs package.

We only try to restart the ovs service if the package is present on
the host.

We also make sure that some tasks don't run on every step by providing
the necessary conditionals.

Queens only because:
 - master to stein ovs tasks are refactor to use an ansible module and
   we are careful to not error out when ovs isn't present.
 - rocky doesn't have the update tasks workaround for ovs.

Change-Id: I7b16f409cceb1c41ceedf8dfdae6ffd06ec59410
Closes-Bug: #1875743
This commit is contained in:
Sofer Athlan-Guyot 2020-05-11 18:37:46 +02:00
parent 83a2c0d24e
commit 91765ac599
1 changed files with 14 additions and 2 deletions

View File

@ -135,9 +135,13 @@ outputs:
register: ovs_pkg_out
shell:
rpm -qa | awk -F- '/^(openvswitch[0-9]+\.[0-9]+-[0-9]+\.[0-9]+\.[-0]+-|openvswitch-2)/{print $1}'
when:
- step|int == 2
- name: Don't update if not present
set_fact:
run_ovs_update: "{{ (ovs_pkg_out.stdout | length) > 0 }}"
when:
- step|int == 2
- name: Block for gathering information for upgrading OpenvSwitch layered product packaging
when:
- step|int == 2
@ -245,7 +249,9 @@ outputs:
# do anything to prevent the systemd service from being removed and it is not
# re-enabled by default by the new package.
- name: Always ensure the openvswitch service is enabled and running after upgrades
when: step|int == 2
when:
- step|int == 2
- run_ovs_update|bool
service:
name: openvswitch
enabled: yes
@ -326,9 +332,13 @@ outputs:
register: ovs_pkg_out
shell:
rpm -qa | awk -F- '/^(openvswitch[0-9]+\.[0-9]+-[0-9]+\.[0-9]+\.[-0]+-|openvswitch-2)/{print $1}'
when:
- step|int == 2 or step|int == 3
- name: Don't update if not present
set_fact:
run_ovs_update: "{{ (ovs_pkg_out.stdout | length) > 0 }}"
when:
- step|int == 2 or step|int == 3
- name: Block for gathering information for upgrading OpenvSwitch layered product packaging
when:
- step|int == 2
@ -415,7 +425,9 @@ outputs:
update_cache: yes
# This is failsafe unless openvswitch package does something to the systemd service state.
- name: Ensure openvswitch is running after update
when: step|int == 3
when:
- step|int == 3
- run_ovs_update|bool
service:
name: openvswitch
enabled: yes