From 8758ae201defe5abe166e136a2ddc4e55d66d940 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Sat, 28 Feb 2015 14:13:58 +0100 Subject: [PATCH] Fix detect of docker as virtualization_type. Not only match`/docker/`, but also `docker-` followed by a hex-id. Example (shortened): ``` $ cat /proc/1/cgroup 8:blkio:/system.slice/docker-de73f4d207861cf8757b69213ee67bb234b897a18bea7385964b6ed2d515da94.scope 7:net_cls:/ ``` --- lib/ansible/module_utils/facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 17e7c62f83a..350f002dcc0 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2336,7 +2336,7 @@ class LinuxVirtual(Virtual): if os.path.exists('/proc/1/cgroup'): for line in get_file_lines('/proc/1/cgroup'): - if re.search('/docker/', line): + if re.search(r'/docker(/|-[0-9a-f]+\.scope)', line): self.facts['virtualization_type'] = 'docker' self.facts['virtualization_role'] = 'guest' return