Description of problem: Beaker snippet is no longer valid for RHEL7 as the /selinux dir is no longer. /usr/lib/python2.6/site-packages/bkr/server/snippets/post_anamon Version-Release number of selected component (if applicable): Beaker 0.14.4 How reproducible: always when provision RHEL 7 Steps to Reproduce: 1.provision RHEL7 via beaker 2. 3. Actual results: As /selinux is no longer in RHEL7 we end up w/ the wrong selinux context for /etc/rc.d/init.d/anamon /usr/local/sbin/anamon Expected results: restorecon correctly applied to /etc/rc.d/init.d/anamon /usr/local/sbin/anamon Additional info: Maybe as simple as adding ( -o -d /sys/fs/selinux ) test -d /selinux -o -d /sys/fs/selinux && restorecon /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
(In reply to MikeBoswell from comment #0) > Maybe as simple as adding ( -o -d /sys/fs/selinux ) > test -d /selinux -o -d /sys/fs/selinux && restorecon /etc/rc.d/init.d/anamon > /usr/local/sbin/anamon A better option might be selinuxenabled(8) although we will just need to check that that command exists on RHEL4. selinuxenabled &>/dev/null && restorecon /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
selinuxenabled exists on RHEL4 so I think we can safely assume that if the command doesn't exist, SELinux is not enabled. So just testing selinuxenabled &>/dev/null should do it.
The fix is quite easy: http://gerrit.beaker-project.org/2713 although it's not clear to me why we even need to run restorecon at all. I thought that the context should be set correctly when the file is originally written. But I can see that it's not. Sometimes SELinux confuses me...
My understanding is that install and mv don't set the destination context appropriately by default, so they need to be followed by restorecon. It's something like that, anyway - the SELinux support in coretools is occasionally sketchy (especially on older versions), so it can be easier to just use restorecon rather than trying to figure out exactly where the context originally failed to be set properly.
This change is included in the Beaker 0.15.3 maintenance release: http://beaker-project.org/docs/whats-new/release-0.15.html#beaker-0-15-3