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().
This commit is contained in:
Peter Oliver 2018-10-11 18:41:07 +01:00 committed by Brian Coca
parent 46ed120778
commit 40fb992a6f
2 changed files with 10 additions and 2 deletions

View file

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

View file

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