diff --git a/changelogs/fragments/solaris-prtdiag-path.yaml b/changelogs/fragments/solaris-prtdiag-path.yaml new file mode 100644 index 0000000000..ae3cf426dc --- /dev/null +++ b/changelogs/fragments/solaris-prtdiag-path.yaml @@ -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`. diff --git a/lib/ansible/module_utils/facts/hardware/sunos.py b/lib/ansible/module_utils/facts/hardware/sunos.py index 3433d23b72..48993ef6ec 100644 --- a/lib/ansible/module_utils/facts/hardware/sunos.py +++ b/lib/ansible/module_utils/facts/hardware/sunos.py @@ -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 """