Log a more descriptive error when setfiles fails (#1499771)

Some lorax users run it from inside mock, which isn't able to detect
whether the host is in Permissive mode. This can lead to confusing
error messages, so this points them in the right direction.
This commit is contained in:
Brian C. Lane 2017-11-10 08:38:08 -08:00
parent 3c0cb25770
commit 73628a6e07

View File

@ -119,7 +119,13 @@ def mkrootfsimg(rootdir, outfile, label, size=2, sysroot=""):
"-e", "/install", "-e", "/ostree", "-e", "/install", "-e", "/ostree",
"/etc/selinux/targeted/contexts/files/file_contexts", "/"] "/etc/selinux/targeted/contexts/files/file_contexts", "/"]
root = join(mnt, sysroot.lstrip("/")) root = join(mnt, sysroot.lstrip("/"))
runcmd(cmd, root=root) try:
runcmd(cmd, root=root)
except CalledProcessError as e:
logger.error("setfiles exited with a non-zero return code (%d) which may "
"be caused by running without SELinux in Permissive mode.", e.returncode)
raise
######## Utility functions ############################################### ######## Utility functions ###############################################