Only log if there's a problem and make it clear what the problem is.
Previously logging was informational and could be deceptive,
in the first case claiming that the root SELinux context is set to None
(which never happens),
and in the second case asserting success even when failure had occurred.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/formats/fs.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 4de70c8..322a543 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -593,11 +593,13 @@ class FS(DeviceFormat):
if flags.selinux and "ro" not in options.split(",") and
flags.installer_mode:
ret = util.reset_file_context(mountpoint, chroot)
- log.info("set SELinux context for newly mounted filesystem root at %s to
%s", mountpoint, ret)
+ if not ret:
+ log.warning("Failed to reset SElinux context for newly mounted
filesystem root directory to default.")
lost_and_found_context = util.match_path_context("/lost+found")
lost_and_found_path = os.path.join(mountpoint, "lost+found")
ret = util.set_file_context(lost_and_found_path, lost_and_found_context,
chroot)
- log.info("set SELinux context for newly mounted filesystem lost+found
directory at %s to %s", lost_and_found_path, lost_and_found_context)
+ if not ret:
+ log.warning("Failed to set SELinux context for newly mounted
filesystem lost+found directory at %s to %s", lost_and_found_path,
lost_and_found_context)
self._mountpoint = chrootedMountpoint
--
1.9.3