From 45d21b6474d4512bfd5028c5020e2cf81fe7fac6 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 30 Apr 2019 11:16:26 -0400 Subject: [PATCH] Fix and refix help text for CLI (#55831) fixes #23395 giving clearer information on installed role path re-fixes 'home display issue' for module-path --- changelogs/fragments/help_paths_fixes.yml | 3 +++ lib/ansible/cli/arguments/option_helpers.py | 3 ++- lib/ansible/cli/galaxy.py | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/help_paths_fixes.yml diff --git a/changelogs/fragments/help_paths_fixes.yml b/changelogs/fragments/help_paths_fixes.yml new file mode 100644 index 00000000000..a14d89e7b5c --- /dev/null +++ b/changelogs/fragments/help_paths_fixes.yml @@ -0,0 +1,3 @@ +bugfixes: + - re-fix CLI help for module path, previous fix which was lost in parser switch + - Clarify roles path target behaviour for ansible-galaxy diff --git a/lib/ansible/cli/arguments/option_helpers.py b/lib/ansible/cli/arguments/option_helpers.py index 46b71171853..334a8542324 100644 --- a/lib/ansible/cli/arguments/option_helpers.py +++ b/lib/ansible/cli/arguments/option_helpers.py @@ -282,8 +282,9 @@ def add_meta_options(parser): def add_module_options(parser): """Add options for commands that load modules""" + module_path = C.config.get_configuration_definition('DEFAULT_MODULE_PATH').get('default', '') parser.add_argument('-M', '--module-path', dest='module_path', default=None, - help="prepend colon-separated path(s) to module library (default=%s)" % C.DEFAULT_MODULE_PATH, + help="prepend colon-separated path(s) to module library (default=%s)" % module_path, type=unfrack_path(pathsep=True), action=PrependListAction) diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index cf29618d40a..6d8f9ee90a4 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -63,11 +63,12 @@ class GalaxyCLI(CLI): offline.add_argument('--offline', dest='offline', default=False, action='store_true', help="Don't query the galaxy API when creating roles") + default_roles_path = C.config.get_configuration_definition('DEFAULT_ROLES_PATH').get('default', '') roles_path = opt_help.argparse.ArgumentParser(add_help=False) roles_path.add_argument('-p', '--roles-path', dest='roles_path', type=opt_help.unfrack_path(pathsep=True), default=C.DEFAULT_ROLES_PATH, action=opt_help.PrependListAction, - help='The path to the directory containing your roles. The default is the roles_path ' - 'configured in your ansible.cfg file (/etc/ansible/roles if not configured)') + help='The path to the directory containing your roles. The default is the first writable one' + 'configured via DEFAULT_ROLES_PATH: %s ' % default_roles_path) force = opt_help.argparse.ArgumentParser(add_help=False) force.add_argument('-f', '--force', dest='force', action='store_true', default=False, help='Force overwriting an existing role')