diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2016-06-27 16:56:16 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2016-06-27 16:56:16 +0100 |
commit | e0dbf5957623764118d6f05e10611a941a5985cc (patch) | |
tree | 4303ee8783e64fe50fee88f4aeeb00487b436f2b | |
parent | 1fd12690870e85e8ac83b0e99bb272ce4489dc60 (diff) | |
download | sos-e0dbf5957623764118d6f05e10611a941a5985cc.tar.gz |
[policies/redhat] update container detection test
Between Docker, systemd, and the various other components used to
manage docker-style containers on Red Hat's Atomic-based distros
the agreed upon environment variable used to detect a container
has changed:
container_uuid="" is no longer exported.
container="docker"|"..." is now exported instead.
Update the in container checks to use the new variable name.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/policies/redhat.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index 44cc5ff6..3ed4f244 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -83,8 +83,9 @@ class RedHatPolicy(LinuxPolicy): """Check if sos is running in a container and perform container specific initialisation based on ENV_HOST_SYSROOT. """ - if ENV_CONTAINER_UUID in os.environ: - self._in_container = True + if ENV_CONTAINER in os.environ: + if os.environ[ENV_CONTAINER] == 'docker': + self._in_container = True if ENV_HOST_SYSROOT in os.environ: self._host_sysroot = os.environ[ENV_HOST_SYSROOT] use_sysroot = self._in_container and self._host_sysroot != '/' @@ -124,7 +125,7 @@ class RedHatPolicy(LinuxPolicy): return self.host_name() # Container environment variables on Red Hat systems. -ENV_CONTAINER_UUID = 'container_uuid' +ENV_CONTAINER = 'container' ENV_HOST_SYSROOT = 'HOST' |