As far as RPMs are concerned, system-id.conf file is declared as being
owned by openvswitch.
At the first ovs startup, ovs-ctl creates this file if none exists without
ensuring this.
We end up with an inconsistency:
$ rpm -V openvswitch
.....UG.. c /etc/openvswitch/system-id.conf
Fix this when ovs-ctl is the one who creates the file.
Note: this issue ends up being hidden after a RPM upgrade, since the
openvswitch user is enforced on the whole /etc/openvswitch directory as a
%post operation.
Acked-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
# Migrate from old file name.
. "$uuid_file"
SYSTEM_ID=$INSTALLATION_UUID
+ run_as_ovsuser touch "$id_file"
echo "$SYSTEM_ID" > "$id_file"
elif SYSTEM_ID=`uuidgen`; then
+ run_as_ovsuser touch "$id_file"
echo "$SYSTEM_ID" > "$id_file"
else
log_failure_msg "missing uuidgen, could not generate system ID"
done
}
-ovsdb_tool () {
+run_as_ovsuser() {
if [ "$OVS_USER" != "" ]; then
local uid=$(id -u "${OVS_USER%:*}")
local gid=$(id -g "${OVS_USER%:*}")
local groups=$(id -G "${OVS_USER%:*}" | tr ' ' ',')
- setpriv --reuid "$uid" --regid "$gid" --groups "$groups" ovsdb-tool -vconsole:off "$@"
+ setpriv --reuid "$uid" --regid "$gid" --groups "$groups" "$@"
else
- ovsdb-tool -vconsole:off "$@"
+ "$@"
fi
}
+ovsdb_tool () {
+ run_as_ovsuser ovsdb-tool -vconsole:off "$@"
+}
+
create_db () {
DB_FILE="$1"
DB_SCHEMA="$2"