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

Command module docs: args vs argv #49907

Merged
merged 7 commits into from Dec 19, 2018
Merged

Conversation

acozine
Copy link
Contributor

@acozine acozine commented Dec 13, 2018

SUMMARY

Per user feedback, adds information to the command module documentation about the difference between the argv parameter and the args task keyword. Also updates and expands examples.

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME

docs.ansible.com

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. module This issue/PR relates to a module. 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 Dec 13, 2018
@ansibot ansibot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 13, 2018
@ansibot
Copy link
Contributor

ansibot commented Dec 13, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/commands/command.py:28:161: E501 line too long (162 > 160 characters)

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Dec 13, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Dec 14, 2018
@acozine acozine requested a review from bcoca December 14, 2018 23:02
args:
chdir: somedir/
creates: /path/to/database

- name: use argv to send the command as a list. Be sure to leave command empty
- name: Use 'argv' with 'args' to send a command as a list - be sure to leave 'command' empty
Copy link
Member

Choose a reason for hiding this comment

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

actually a better way would be command: argv=['echo', 'testing']

Copy link
Member

Choose a reason for hiding this comment

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

or even

command:
   argv:
      - echo
      - testing

bringing args into the mix is just confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bcoca what do you think of d4bac89 to address this concern and improve the examples?

Copy link
Member

Choose a reason for hiding this comment

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

you cannot pass 2 commands to command, argv is not for that, it is to pass the command and the arguments to the command

Copy link
Member

@bcoca bcoca Dec 18, 2018

Choose a reason for hiding this comment

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

echo 'testing' == argv: ['echo', 'testing']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, glad I asked. What is the advantage of using argv over just passing them directly to command then?

Copy link
Member

Choose a reason for hiding this comment

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

quote management

Copy link
Contributor Author

Choose a reason for hiding this comment

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

take 3 . . . how's 6fe81cd look?

Copy link
Member

Choose a reason for hiding this comment

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

better, there are more cases than just whitespace, but that should be good enough

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 16, 2018
Co-Authored-By: acozine <879121+acozine@users.noreply.github.com>
@samccann samccann merged commit 6fc4bb4 into ansible:devel Dec 19, 2018
@acozine acozine deleted the args_vs_argv branch January 2, 2019 16:34
kbreit pushed a commit to kbreit/ansible that referenced this pull request Jan 11, 2019
* add note about 'args', update examples
* Update lib/ansible/modules/commands/command.py

Co-Authored-By: acozine <879121+acozine@users.noreply.github.com>
@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.8 This issue/PR affects Ansible v2.8 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants