Skip to content

Commit

Permalink
rhel: user/group openvswitch does not exist
Browse files Browse the repository at this point in the history
Default ownership[1] for config files is failing on an empty system:
  Running scriptlet: openvswitch-2.9.0-3.fc28.x86_64
warning: user openvswitch does not exist - using root
warning: group openvswitch does not exist - using root
...

Required user/group need to be created in %pre as documented in
Fedora guideline[2]

[1] 951d79e

[2] https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation

Submitted-at: #223
Signed-off-by: Alan Pevec <alan.pevec@redhat.com>
Co-authored-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Russell Bryant <russell@ovn.org>
  • Loading branch information
2 people authored and russellb committed May 1, 2018
1 parent fd5d8b0 commit 20ef747
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions rhel/openvswitch-fedora.spec.in
Expand Up @@ -92,8 +92,7 @@ Requires: openssl hostname iproute module-init-tools
#Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
#Requires: kernel >= 3.15.0-0

Requires(post): /usr/bin/getent
Requires(post): /usr/sbin/useradd
Requires(pre): shadow-utils
Requires(post): /usr/bin/sed
%if %{with dpdk}
Requires(post): /usr/sbin/usermod
Expand Down Expand Up @@ -386,17 +385,23 @@ rm -rf $RPM_BUILD_ROOT
fi
%endif

%pre
getent group openvswitch >/dev/null || groupadd -r openvswitch
getent passwd openvswitch >/dev/null || \
useradd -r -g openvswitch -d / -s /sbin/nologin \
-c "Open vSwitch Daemons" openvswitch

%if %{with dpdk}
getent group hugetlbfs >/dev/null || groupadd hugetlbfs
usermod -a -G hugetlbfs openvswitch
%endif
exit 0

%post
if [ $1 -eq 1 ]; then
getent passwd openvswitch >/dev/null || \
useradd -r -d / -s /sbin/nologin -c "Open vSwitch Daemons" openvswitch

sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch

%if %{with dpdk}
getent group hugetlbfs >/dev/null || \
groupadd hugetlbfs
usermod -a -G hugetlbfs openvswitch
sed -i \
's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
/etc/sysconfig/openvswitch
Expand Down

0 comments on commit 20ef747

Please sign in to comment.