Locate prtdiag even when absent from /usr/bin (#44113)

* Locate prtdiag even when absent from /usr/bin

On Solaris 8 hosts, this prevents fact collection from aborting with:

    Argument 'args' to run_command must be list or string

* Lint fix.

* Style: pass /usr/platform/.../sbin as optional path to get_bin_path().
pull/46839/head
Peter Oliver 6 years ago committed by Brian Coca
parent 46ed120778
commit 40fb992a6f

@ -0,0 +1,3 @@
---
bugfixes:
- Hardware fact gathering now completes on Solaris 8. Previously, it aborted with error `Argument 'args' to run_command must be list or string`.

@ -168,8 +168,13 @@ class SunOSHardware(Hardware):
def get_dmi_facts(self):
dmi_facts = {}
uname_path = self.module.get_bin_path("prtdiag")
rc, out, err = self.module.run_command(uname_path)
# On Solaris 8 the prtdiag wrapper is absent from /usr/sbin,
# but that's okay, because we know where to find the real thing:
rc, platform, err = self.module.run_command('/usr/bin/uname -i')
platform_sbin = '/usr/platform/' + platform.rstrip() + '/sbin'
prtdiag_path = self.module.get_bin_path("prtdiag", opt_dirs=[platform_sbin])
rc, out, err = self.module.run_command(prtdiag_path)
"""
rc returns 1
"""

Loading…
Cancel
Save