Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Oct 11, 2018

Conversation

mavit
Copy link
Contributor

@mavit mavit commented Aug 14, 2018

SUMMARY

On Solaris 8, the prtdiag wrapper is absent from /usr/sbin, so we must find the real thing ourselves. This prevents fact collection from aborting.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

Hardware facts.

ANSIBLE VERSION
ansible 2.6.2
  config file = /home/username/etc/ansible/ansible.cfg
  configured module search path = [u'/home/username/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

ADDITIONAL INFORMATION

Before:

$ ansible -m setup solaris-8
solaris-8 | FAILED! => {
    "changed": false, 
    "cmd": null, 
    "msg": "Argument 'args' to run_command must be list or string", 
    "rc": 257
}

After:

$ ansible -m setup solaris-8
solaris-8 | SUCCESS => {
...
}

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

    Argument 'args' to run_command must be list or string
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 14, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 14, 2018

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/facts/hardware/sunos.py:176:14: E111 indentation is not a multiple of four
lib/ansible/module_utils/facts/hardware/sunos.py:177:14: E111 indentation is not a multiple of four

click here for bot help

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Aug 14, 2018
@webknjaz webknjaz requested a review from alikins August 14, 2018 13:18
@webknjaz webknjaz removed the needs_triage Needs a first human triage before being processed. label Aug 14, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Aug 15, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 23, 2018
@ansibot ansibot added the support:community This issue/PR relates to code supported by the Ansible community. label Sep 16, 2018
@ansibot ansibot removed the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Oct 10, 2018
# but that's okay, because we know where to find the real thing:
if not prtdiag_path:
rc, platform, err = self.module.run_command('/usr/bin/uname -i')
prtdiag_path = '/usr/platform/' + platform.rstrip() + '/sbin/prtdiag'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of assuming that if not found this path does exist, just pass the search pat as an option to get_bin_path and it will error out if even this fallback is not present

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. Fact gathering is already slow, so I was reluctant to add an additional fork and exec of uname unless it was required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could still make it conditional, just call get_bin_path again instead of assuming that the binary exists

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Oct 11, 2018
@bcoca bcoca merged commit 40fb992 into ansible:devel Oct 11, 2018
mavit added a commit to mavit/ansible that referenced this pull request Oct 12, 2018
* 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 40fb992)
abadger pushed a commit that referenced this pull request Oct 12, 2018
* 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 40fb992)
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
* 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().
@dagwieers dagwieers added the solaris Solaris community label Jan 9, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. solaris Solaris community stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants