diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2020-01-16 11:29:59 -0600 |
---|---|---|
committer | Daniel Watkins <oddbloke@ubuntu.com> | 2020-01-16 12:29:59 -0500 |
commit | 259d9c501472315e539701f00095743390eb89e5 (patch) | |
tree | eb94a5437498cc7521a7fb876aeaa63026bff37d /cloudinit/distros/debian.py | |
parent | bb4131a2bd36d9e8932fdcb61432260f16159cde (diff) | |
download | vyos-cloud-init-259d9c501472315e539701f00095743390eb89e5.tar.gz vyos-cloud-init-259d9c501472315e539701f00095743390eb89e5.zip |
Ensure util.get_architecture() runs only once (#172)
* Ensure util.get_architecture() runs only once
util.get_architecture() recently was wrapped using python3's lru_cache()
which will cache the result so we only invoke 'dpkg --print-architecture'
once. In practice, cloud-init.log will show multiple invocations of the
command. The source of this was that the debian Distro object implements
the get_primary_arch() with this command, but it was not calling it from
util, but issuing a util.subp() directly. This branch also updates
cc_apt_configure methods to fetch the arch value from the distro class,
and then ensure that the methods apt_configure calls pass the arch value
around.
* utils: remove lsb_release and get_architecture wrappers
The original lsb_release wrapper was used to prevent polluting the
single value we cached, however lru_cache() already handles this
case by using args, kwargs values to cache different calls to the
method.
* rename_apt_list: use all positional parameters
Diffstat (limited to 'cloudinit/distros/debian.py')
-rw-r--r-- | cloudinit/distros/debian.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index cf082c73..79268371 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -205,8 +205,7 @@ class Distro(distros.Distro): ["update"], freq=PER_INSTANCE) def get_primary_arch(self): - (arch, _err) = util.subp(['dpkg', '--print-architecture']) - return str(arch).strip() + return util.get_architecture() def _get_wrapper_prefix(cmd, mode): |