summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-16 13:30:12 -0500
committerRyan Harper <ryan.harper@canonical.com>2020-01-16 12:30:12 -0600
commit651e24066ba4b9464c7843553f60d17a459cf06e (patch)
treeb4bae771e62bf725b7d568efb9741f2be88a915c /cloudinit/util.py
parent259d9c501472315e539701f00095743390eb89e5 (diff)
downloadvyos-cloud-init-651e24066ba4b9464c7843553f60d17a459cf06e.tar.gz
vyos-cloud-init-651e24066ba4b9464c7843553f60d17a459cf06e.zip
util: rename get_architecture to get_dpkg_architecture (#173)
This makes it clearer that we should only use this in code paths that will definitely have dpkg available to them. - Rename get_architecture -> get_dpkg_architecture - Add docstring to get_dpkg_architecture
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 87480767..d99e82fa 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -79,7 +79,12 @@ CONTAINER_TESTS = (['systemd-detect-virt', '--quiet', '--container'],
@lru_cache()
-def get_architecture(target=None):
+def get_dpkg_architecture(target=None):
+ """Return the sanitized string output by `dpkg --print-architecture`.
+
+ N.B. This function is wrapped in functools.lru_cache, so repeated calls
+ won't shell out every time.
+ """
out, _ = subp(['dpkg', '--print-architecture'], capture=True,
target=target)
return out.strip()