summaryrefslogtreecommitdiff
path: root/debian/patches/systemd_detect_virt.patch
blob: 32961a203124b356ad10ddfb7e2801fe83a90eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Description: Use systemd-detect-virt to detect a container. running-in-container is an Ubuntu-ism and going away.
Author: Martin Pitt <martin.pitt@ubuntu.com>
Forwarded: https://code.launchpad.net/~pitti/cloud-init/systemd-detect-virt/+merge/284278
Bug-Ubuntu: https://launchpad.net/bugs/1539016

Index: cloud-init-0.7.7~bzr1156/cloudinit/util.py
===================================================================
--- cloud-init-0.7.7~bzr1156.orig/cloudinit/util.py
+++ cloud-init-0.7.7~bzr1156/cloudinit/util.py
@@ -76,7 +76,9 @@ FALSE_STRINGS = ('off', '0', 'no', 'fals
 
 
 # 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