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`.
This commit is contained in:
Peter Oliver 2017-01-27 22:46:45 +00:00 committed by Brian Coca
parent 65ee9d2e46
commit 04b2e1fbc0

View file

@ -3342,21 +3342,22 @@ class SunOSVirtual(Virtual):
else: else:
smbios = self.module.get_bin_path('smbios') smbios = self.module.get_bin_path('smbios')
rc, out, err = self.module.run_command(smbios) if smbios:
if rc == 0: rc, out, err = self.module.run_command(smbios)
for line in out.split('\n'): if rc == 0:
if 'VMware' in line: for line in out.split('\n'):
self.facts['virtualization_type'] = 'vmware' if 'VMware' in line:
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_type'] = 'vmware'
elif 'Parallels' in line: self.facts['virtualization_role'] = 'guest'
self.facts['virtualization_type'] = 'parallels' elif 'Parallels' in line:
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_type'] = 'parallels'
elif 'VirtualBox' in line: self.facts['virtualization_role'] = 'guest'
self.facts['virtualization_type'] = 'virtualbox' elif 'VirtualBox' in line:
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_type'] = 'virtualbox'
elif 'HVM domU' in line: self.facts['virtualization_role'] = 'guest'
self.facts['virtualization_type'] = 'xen' elif 'HVM domU' in line:
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_type'] = 'xen'
self.facts['virtualization_role'] = 'guest'
class Ohai(Facts): class Ohai(Facts):
""" """