Skip to content

Commit

Permalink
fixes to virtual facts
Browse files Browse the repository at this point in the history
fixes #36038

(cherry picked from commit 97b6e99)
  • Loading branch information
bcoca committed Feb 15, 2018
1 parent 0c4f6c3 commit dfa3eca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -58,6 +58,7 @@ Ansible Changes By Release
https://github.com/ansible/ansible/pull/34130
* Fix docker_service so a build is not triggered every time
https://github.com/ansible/ansible/issues/36145
* Be more tolerant about spaces when gathering virtual facts (https://github.com/ansible/ansible/pull/36042)


<a id="2.4.3"></a>
Expand Down
6 changes: 3 additions & 3 deletions lib/ansible/module_utils/facts/virtual/linux.py
Expand Up @@ -144,9 +144,9 @@ def get_virtual_facts(self):

if os.path.exists('/proc/self/status'):
for line in get_file_lines('/proc/self/status'):
if re.match('^VxID: \d+', line):
if re.match(r'^VxID:\s+\d+', line):
virtual_facts['virtualization_type'] = 'linux_vserver'
if re.match('^VxID: 0', line):
if re.match(r'^VxID:\s+0', line):
virtual_facts['virtualization_role'] = 'host'
else:
virtual_facts['virtualization_role'] = 'guest'
Expand Down Expand Up @@ -200,7 +200,7 @@ def get_virtual_facts(self):
if open(f).read().rstrip() == 'vdsm':
virtual_facts['virtualization_type'] = 'RHEV'
break
except:
except Exception:
pass
else:
virtual_facts['virtualization_type'] = 'kvm'
Expand Down

0 comments on commit dfa3eca

Please sign in to comment.