Fix galaxy roles_path cli usage.

If we specify a roles_path from the cli, use a
optparse action callback to make sure the roles_path
is set to a path list.

Fixes #15255
This commit is contained in:
Adrian Likins 2016-04-02 20:22:00 -04:00
parent 03300e99ac
commit 05b46091e4
4 changed files with 25 additions and 6 deletions

View file

@ -120,7 +120,11 @@ class GalaxyCLI(CLI):
# options that apply to more than one action
if not self.action in ("delete","import","init","login","setup"):
self.parser.add_option('-p', '--roles-path', dest='roles_path', default=C.DEFAULT_ROLES_PATH,
# NOTE: while the option type=str, the default is a list, and the
# callback will set the value to a list.
self.parser.add_option('-p', '--roles-path', dest='roles_path',
action="callback", callback=CLI.expand_paths,
type=str, default=C.DEFAULT_ROLES_PATH,
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)')