Correctly match openvswitch package

The current regex will match more than one package if the
openvswitchX.YZ-test package is installed.

eg:
rpm -qa | awk -F- '/^(openvswitch[0-9]+\.[0-9]+-|openvswitch-2)/'
openvswitch2.11-test-2.11.0-35.el7fdp.noarch
openvswitch2.11-2.11.0-35.el7fdp.x86_64

The right package to find has the form: openvswitchA.BC-A.BC.D-

So we change the regex to only match if it has that form.

rhbz#1826367
Change-Id: I91be2f3fe989ec9bd5619bcc1e441a72af9c8566
(cherry picked from commit 032c7db544)
This commit is contained in:
Jesse Pretorius (odyssey4me) 2020-05-18 15:17:42 +01:00
parent b23741f537
commit 80858ce0a0
1 changed files with 1 additions and 1 deletions

View File

@ -163,7 +163,7 @@
register: ovs_pkg_out
shell: |-
set -o pipefail
rpm -qa | awk -F- '/^(openvswitch[0-9]+\.[0-9]+-|openvswitch-2)/{print $1}'
rpm -qa | awk -F- '/^(openvswitch[0-9]+\.[0-9]+-[0-9]+\.[0-9]+\.[-0]+-|openvswitch-2)/{print $1}'
- name: Get version from current OpenvSwitch package
register: ovs_version_out