relay non-zero exit codes when creating openvswitch bridges

Calls to `ovs-vsctl` in `ovs_ensure_configured.sh` did not get checked
for errors.
This can cause false success statuses when
the script is run by automation tools such as ansible.

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/870540

Closes-bug: #1999778
Change-Id: Iad83132b61efadbf09aa9aa2edf96235085764c6
This commit is contained in:
Erik Panter 2022-12-15 13:59:56 +01:00 committed by Michal Nasiadka
parent 7b6206294c
commit a840ac0d7c
2 changed files with 10 additions and 4 deletions

View File

@ -1,16 +1,15 @@
#!/bin/bash
set -o errexit
bridge=$1
port=$2
ip link show $port
if [[ $? -ne 0 ]]; then
if ! ip link show $port; then
# fail when device doesn't exist
exit 1
fi
ovs-vsctl br-exists $bridge
if [[ $? -eq 2 ]]; then
ovs-vsctl br-exists $bridge || if [[ $? -eq 2 ]]; then
changed=changed
ovs-vsctl --no-wait add-br $bridge
fi

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes an issue where the script ``kolla_ensure_openvswitch_configured`` in
the ``openvswitch-db-server`` image would ignore errors encountered while
configuring bridges and ports.
`LP#1999778 <https://launchpad.net/bugs/1999778>`__