fixes options for ansible pull

* remove requirement for host patterns, use the defaults
 * require destination directory (None in cwd is not a good default)
 * fixed usage messages
 * updated default inventory to use , and not deprecated :
pull/12962/head
Brian Coca 9 years ago
parent b73941b95f
commit 40d22be2ef

@ -50,7 +50,7 @@ class PullCLI(CLI):
''' create an options parser for bin/ansible '''
self.parser = CLI.base_parser(
usage='%prog <host-pattern> [options]',
usage='%prog -d <destdir> -U <repository> [options]',
connect_opts=True,
vault_opts=True,
runtask_opts=True,
@ -91,8 +91,8 @@ class PullCLI(CLI):
if not self.options.url:
raise AnsibleOptionsError("URL for repository not specified, use -h for help")
if len(self.args) != 1:
raise AnsibleOptionsError("Missing target hosts")
if not self.options.dest:
raise AnsibleOptionsError("Destination directory for checkout not specified, use -h for help")
if self.options.module_name not in self.SUPPORTED_REPO_MODULES:
raise AnsibleOptionsError("Unsuported repo module %s, choices are %s" % (self.options.module_name, ','.join(self.SUPPORTED_REPO_MODULES)))
@ -114,7 +114,7 @@ class PullCLI(CLI):
# Now construct the ansible command
node = platform.node()
host = socket.getfqdn()
limit_opts = 'localhost:%s:127.0.0.1' % ':'.join(set([host, node, host.split('.')[0], node.split('.')[0]]))
limit_opts = 'localhost,%s,127.0.0.1' % ','.join(set([host, node, host.split('.')[0], node.split('.')[0]]))
base_opts = '-c local "%s"' % limit_opts
if self.options.verbosity > 0:
base_opts += ' -%s' % ''.join([ "v" for x in range(0, self.options.verbosity) ])

Loading…
Cancel
Save