summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-02-04 17:11:13 -0500
committerScott Moser <smoser@ubuntu.com>2016-02-04 17:11:13 -0500
commit6b294286e0d0a1da6b24b338cae3b900a763e9d2 (patch)
tree817ce4377706d6c55a2641f3023ea8dc64ab8710
parent7d7861cbcd01e2c7a77ecdb207032363f92b0637 (diff)
parentce13a13190356a598cb8d3aacbf87e91bc9eb4f1 (diff)
downloadvyos-cloud-init-6b294286e0d0a1da6b24b338cae3b900a763e9d2.tar.gz
vyos-cloud-init-6b294286e0d0a1da6b24b338cae3b900a763e9d2.zip
systemd: support using systemd-detect-virt to detect container
running-in-container is a wrapper around systemd-detect-virt -c, and was removed from ubuntu. This adjusts to run if only running-in-container is available. LP: #1539016
-rw-r--r--ChangeLog2
-rw-r--r--cloudinit/util.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 56340356..95d9c3eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -73,6 +73,8 @@
exited non-zero (LP: #1449318)
- SmartOS: Add support for Joyent LX-Brand Zones (LP: #1540965)
[Robert C Jennings]
+ - systemd: support using systemd-detect-virt to detect container
+ (LP: #1539016) [Martin Pitt]
0.7.6:
- open 0.7.6
- Enable vendordata on CloudSigma datasource (LP: #1303986)
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