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

Fix -M/--module-path option for ansible-doc and ansible-console #31744

Merged
merged 1 commit into from
Oct 16, 2017

Conversation

fungusakafungus
Copy link
Contributor

SUMMARY

Fixes broken -M/--module-path options of ansible-doc and ansible-console.

Before the change I was getting the following error:

$ ansible-doc -M . raw -s -vvv
ERROR! Unexpected Exception, this is probably a bug: 'list' object has no attribute 'split'
the full traceback was:

Traceback (most recent call last):
  File "/home/user/ansible/ansible/bin/ansible-doc", line 109, in <module>
    exit_code = cli.run()
  File "/home/user/ansible/ansible/lib/ansible/cli/doc.py", line 107, in run
    for i in self.options.module_path.split(os.pathsep):
AttributeError: 'list' object has no attribute 'split'

#29663 changed the logic of the base cli parser, so options.module_path became a list.

I've copied the logic for iterating through options.module_path from the commit that changed it:

# make sure any module paths (if specified) are added to the module_loader
if options.module_path:
for path in options.module_path:
if path:
module_loader.add_directory(path)

fixes #31743

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

cli/doc, cli/console

ANSIBLE VERSION
ansible 2.5.0 (devel 02cd881697) last updated 2017/10/14 21:11:59 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/ansible/ansible/lib/ansible
  executable location = /home/user/.virtualenvs/ansible/bin/ansible
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request cli/console cli/doc 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 Oct 14, 2017
@alikins alikins added affects_2.4 This issue/PR affects Ansible v2.4 and removed needs_triage Needs a first human triage before being processed. labels Oct 16, 2017
@alikins
Copy link
Contributor

alikins commented Oct 16, 2017

Looks good to me (LGTM)

@alikins alikins merged commit 9bc60cd into ansible:devel Oct 16, 2017
@bcoca bcoca added this to Nominated in 2.4.x Blocker List Oct 16, 2017
@abadger abadger moved this from Nominated to TODO: Next release in 2.4.x Blocker List Oct 16, 2017
@abadger abadger moved this from TODO: Next release to TODO: Nice to have in 2.4.x Blocker List Oct 16, 2017
@abadger abadger moved this from TODO: Nice to have to To be cherrypicked (rc only) in 2.4.x Blocker List Oct 17, 2017
abadger pushed a commit that referenced this pull request Oct 18, 2017
@abadger
Copy link
Contributor

abadger commented Oct 18, 2017

cherry-picked for 2.4.1rc2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cherrypick_candidate cli/console cli/doc support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
2.4.x Blocker List
Done in 2.4.1
Development

Successfully merging this pull request may close these issues.

ansible-doc does not work with -M/--module-path anymore
4 participants