summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Slagle <james.slagle@gmail.com>2013-12-13 10:40:51 -0500
committerJames Slagle <james.slagle@gmail.com>2013-12-13 10:40:51 -0500
commit66ed882dc3cf24395386869ea3c1d54e8f22c38b (patch)
tree7ca03f269a9aabc86048cb818f55d78a406dd6c9
parent9a922bfa70306d89535574c6580296c9b02ec43e (diff)
downloadvyos-cloud-init-66ed882dc3cf24395386869ea3c1d54e8f22c38b.tar.gz
vyos-cloud-init-66ed882dc3cf24395386869ea3c1d54e8f22c38b.zip
Cast file path to string.
Before passing a path into selinux.matchpathcon, it needs to be casted to a string, since the path could be unicode and selinux.matchpathcon does not support unicode. Closes-Bug: #1260072 LP: #1260072
-rw-r--r--cloudinit/util.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index a8ddb390..a37172dc 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -170,6 +170,8 @@ class SeLinuxGuard(object):
def __exit__(self, excp_type, excp_value, excp_traceback):
if self.selinux and self.selinux.is_selinux_enabled():
path = os.path.realpath(os.path.expanduser(self.path))
+ # path should be a string, not unicode
+ path = str(path)
do_restore = False
try:
# See if even worth restoring??