← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~pitti/cloud-init/systemd-detect-virt into lp:cloud-init


Martin Pitt has proposed merging lp:~pitti/cloud-init/systemd-detect-virt into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1539016 in init-system-helpers (Ubuntu): "Remove /bin/running-in-container"

For more details, see:

As explained in https://launchpad.net/bugs/1539016, running-in-container is an (over-complicated) wrapper around systemd-detect-virt -c, and an Ubuntu-ism which I'd like to get rid of.

This adds systemd-detect-virt to the list of container tests. I figure we need to keep running-in-container as a fallback test for a while, to run older releases with newer cloud-inits.
Your team cloud init development team is requested to review the proposed merge of lp:~pitti/cloud-init/systemd-detect-virt into lp:cloud-init.
=== modified file 'cloudinit/util.py'
--- cloudinit/util.py	2015-09-01 17:26:03 +0000
+++ cloudinit/util.py	2016-01-28 13:11:56 +0000
@@ -76,7 +76,9 @@
 # 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 @@
             # 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):

Follow ups