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

note that -e can be used multiple times #71189

Closed
wants to merge 1 commit into from
Closed

Conversation

tpo
Copy link
Contributor

@tpo tpo commented Aug 10, 2020

Note that -e (extra-vars) switch can be given multiple times.

SUMMARY

It's not evident from the cli switch help text, whether the "-e"/"--extra-vars" option can be used multiple times. The proposed patch makes it explicit.

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME

ansible-playbook

ADDITIONAL INFORMATION

Note that -e (extra-vars) switch can be given multiple times.
@ansibot ansibot added affects_2.11 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. needs_triage Needs a first human triage before being processed. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 10, 2020
@bcoca
Copy link
Member

bcoca commented Aug 10, 2020

we should generalize this for all options with action="append

@tpo
Copy link
Contributor Author

tpo commented Aug 10, 2020

@bcoca

we should generalize this for all options with action="append

Do you think appending that phrase to every help text for every option that is action="append" would be the way to go?

If the answer is yes, then I think the most DRY way to implement it would be to wrap runas_group.add_argument and to output that text if action="append". Increases complexity though, code becomes less readable.

@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 Aug 10, 2020
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Aug 11, 2020
@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 Aug 11, 2020
@sivel
Copy link
Member

sivel commented Aug 11, 2020

I think overriding add_argument is the best we can do. We'll need to subclass argparse.ArgumentParser, override add_argument, extend help, when action='append' or when action=PrependListAction and then call super.add_argument. Much of the argparse API is private, so we don't have a lot of choice on what we can poke at.

We also use argparse.ArgumentParser about 11 times in lib/ansible/cli and all use cases will need to be switched.

Our new class should live in lib/ansible/cli/arguments/option_helpers.py

@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 19, 2020
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. pre_azp This PR was last tested before migration to Azure Pipelines. and removed core_review In order to be merged, this PR must follow the core review workflow. 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 9, 2020
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jul 3, 2021
@nitzmahone
Copy link
Member

Closing for inactivity

@nitzmahone nitzmahone closed this May 25, 2022
@ansible ansible locked and limited conversation to collaborators Jun 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 docs This issue/PR relates to or includes documentation. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. pre_azp This PR was last tested before migration to Azure Pipelines. small_patch 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

6 participants