diff options
author | Peter Oliver <github.com@mavit.org.uk> | 2017-01-27 22:46:45 +0000 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2017-01-27 17:46:45 -0500 |
commit | 04b2e1fbc07dbb96a03739a847a9f8f03e8789ef (patch) | |
tree | 75b39d77aa6742b9854b6b215ee868ee11149f6c | |
parent | 65ee9d2e4629cbb31178b54831612846ca7b3b69 (diff) | |
download | ansible-04b2e1fbc07dbb96a03739a847a9f8f03e8789ef.tar.gz |
Fix `setup` on Solaris 8 and 9 (#20780)
Neither the `virtinfo` nor `smbios` commands exist on these systems, which was causing `setup` to fail with the error `Argument 'args' to run_command must be list or string`.
-rw-r--r-- | lib/ansible/module_utils/facts.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 3e7078f595..df60e99800 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -3342,21 +3342,22 @@ class SunOSVirtual(Virtual): else: smbios = self.module.get_bin_path('smbios') - rc, out, err = self.module.run_command(smbios) - if rc == 0: - for line in out.split('\n'): - if 'VMware' in line: - self.facts['virtualization_type'] = 'vmware' - self.facts['virtualization_role'] = 'guest' - elif 'Parallels' in line: - self.facts['virtualization_type'] = 'parallels' - self.facts['virtualization_role'] = 'guest' - elif 'VirtualBox' in line: - self.facts['virtualization_type'] = 'virtualbox' - self.facts['virtualization_role'] = 'guest' - elif 'HVM domU' in line: - self.facts['virtualization_type'] = 'xen' - self.facts['virtualization_role'] = 'guest' + if smbios: + rc, out, err = self.module.run_command(smbios) + if rc == 0: + for line in out.split('\n'): + if 'VMware' in line: + self.facts['virtualization_type'] = 'vmware' + self.facts['virtualization_role'] = 'guest' + elif 'Parallels' in line: + self.facts['virtualization_type'] = 'parallels' + self.facts['virtualization_role'] = 'guest' + elif 'VirtualBox' in line: + self.facts['virtualization_type'] = 'virtualbox' + self.facts['virtualization_role'] = 'guest' + elif 'HVM domU' in line: + self.facts['virtualization_type'] = 'xen' + self.facts['virtualization_role'] = 'guest' class Ohai(Facts): """ |