fixes to virtual facts

fixes #36038

(cherry picked from commit 97b6e99479)
This commit is contained in:
Brian Coca 2018-02-12 10:21:10 -05:00
parent 0c4f6c3f68
commit dfa3ecaf84
2 changed files with 4 additions and 3 deletions

View file

@ -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>

View file

@ -144,9 +144,9 @@ class LinuxVirtual(Virtual):
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'
@ -200,7 +200,7 @@ class LinuxVirtual(Virtual):
if open(f).read().rstrip() == 'vdsm':
virtual_facts['virtualization_type'] = 'RHEV'
break
except:
except Exception:
pass
else:
virtual_facts['virtualization_type'] = 'kvm'