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().
(cherry picked from commit 40fb992a6f
)
This commit is contained in:
parent
c982295f6c
commit
dcc37b6eb9
2 changed files with 10 additions and 2 deletions
3
changelogs/fragments/solaris-prtdiag-path.yaml
Normal file
3
changelogs/fragments/solaris-prtdiag-path.yaml
Normal 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`.
|
|
@ -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…
Reference in a new issue