diff options
author | Garrett Holmstrom <gholms@eucalyptus.com> | 2013-09-25 13:34:59 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-09-25 13:34:59 -0400 |
commit | 3bebad68b627595652eabc9e7222b69197180622 (patch) | |
tree | b253f385365d30fc3868024b7a31a4bb2cd6bb98 /cloudinit/util.py | |
parent | 35469c11703b1df66b3b14ad06b583d672f39ff5 (diff) | |
parent | 0b9e965096d0cfb20284c587262945c8599ea4a3 (diff) | |
download | vyos-cloud-init-3bebad68b627595652eabc9e7222b69197180622.tar.gz vyos-cloud-init-3bebad68b627595652eabc9e7222b69197180622.zip |
Fix usage of libselinux-python when selinux is disabled.
When libselinux-python is installed, but selinux is disabled on the
instance, calls to restorecon blow up. This fixes it by checking what
is_selinux_enabled() returns first.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index d50d3e18..deac8c8d 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -161,13 +161,13 @@ class SeLinuxGuard(object): self.recursive = recursive def __enter__(self): - if self.selinux: + if self.selinux and self.selinux.is_selinux_enabled(): return True else: return False def __exit__(self, excp_type, excp_value, excp_traceback): - if self.selinux: + if self.selinux and self.selinux.is_selinux_enabled(): path = os.path.realpath(os.path.expanduser(self.path)) do_restore = False try: |