diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-01-28 14:09:24 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-01-28 14:09:24 +0100 |
commit | ce13a13190356a598cb8d3aacbf87e91bc9eb4f1 (patch) | |
tree | c3f41e1e07fd3531e8120e99c6130bd35344acd3 /cloudinit/util.py | |
parent | f512c0126aac5c8708065c6e8aa5510f83574657 (diff) | |
download | vyos-cloud-init-ce13a13190356a598cb8d3aacbf87e91bc9eb4f1.tar.gz vyos-cloud-init-ce13a13190356a598cb8d3aacbf87e91bc9eb4f1.zip |
Use systemd-detect-virt to detect a container.
running-in-container is an Ubuntu-ism and going away.
LP: #1539016
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 83c2c0d2..45d49e66 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -76,7 +76,9 @@ FALSE_STRINGS = ('off', '0', 'no', 'false') # Helper utils to see if running in a container -CONTAINER_TESTS = ('running-in-container', 'lxc-is-container') +CONTAINER_TESTS = (['systemd-detect-virt', '--quiet', '--container'], + ['running-in-container'], + ['lxc-is-container']) def decode_binary(blob, encoding='utf-8'): @@ -1749,7 +1751,7 @@ def is_container(): try: # try to run a helper program. if it returns true/zero # then we're inside a container. otherwise, no - subp([helper]) + subp(helper) return True except (IOError, OSError): pass |