summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-10-25 17:06:18 -0400
committerScott Moser <smoser@brickies.net>2016-10-25 17:06:18 -0400
commitf294110e5c8b121f8d8dcb48b0845a419ba13544 (patch)
tree9f5adaa598f5e943310075aa3255169db14fad9f /cloudinit/util.py
parent1a2086302c3a62277b272bd004e34eb5d264c2fe (diff)
parent29348af1c889931e8973f8fc8cb090c063316f7a (diff)
downloadvyos-cloud-init-f294110e5c8b121f8d8dcb48b0845a419ba13544.tar.gz
vyos-cloud-init-f294110e5c8b121f8d8dcb48b0845a419ba13544.zip
merge from master at 0.7.8-27-g29348af
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index eb3e5899..4b3fd0cb 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -199,7 +199,7 @@ def fully_decoded_payload(part):
encoding = charset.input_codec
else:
encoding = 'utf-8'
- return cte_payload.decode(encoding, errors='surrogateescape')
+ return cte_payload.decode(encoding, 'surrogateescape')
return cte_payload
@@ -282,9 +282,6 @@ class ProcessExecutionError(IOError):
'reason': self.reason,
}
IOError.__init__(self, message)
- # For backward compatibility with Python 2.
- if not hasattr(self, 'message'):
- self.message = message
class SeLinuxGuard(object):
@@ -1821,7 +1818,7 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
def ldecode(data, m='utf-8'):
if not isinstance(data, bytes):
return data
- return data.decode(m, errors=decode)
+ return data.decode(m, decode)
out = ldecode(out)
err = ldecode(err)
@@ -2377,3 +2374,15 @@ def get_installed_packages(target=None):
pkgs_inst.add(re.sub(":.*", "", pkg))
return pkgs_inst
+
+
+def system_is_snappy():
+ # channel.ini is configparser loadable.
+ # snappy will move to using /etc/system-image/config.d/*.ini
+ # this is certainly not a perfect test, but good enough for now.
+ content = load_file("/etc/system-image/channel.ini", quiet=True)
+ if 'ubuntu-core' in content.lower():
+ return True
+ if os.path.isdir("/etc/system-image/config.d/"):
+ return True
+ return False