Skip to content

Commit

Permalink
removed requirement of destination and set documented default
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca committed Oct 29, 2015
1 parent 40d22be commit 9f148fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/man/man1/ansible-pull.1.asciidoc.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ansible-pull - pull playbooks from VCS server and run them using this machine as

SYNOPSIS
--------
ansible-pull -d DEST -U URL [options] [ <filename.yml> ]
ansible-pull -U URL [options] [ <filename.yml> ]


DESCRIPTION
Expand Down
8 changes: 3 additions & 5 deletions lib/ansible/cli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def parse(self):
''' create an options parser for bin/ansible '''

self.parser = CLI.base_parser(
usage='%prog -d <destdir> -U <repository> [options]',
usage='%prog -U <repository> [options]',
connect_opts=True,
vault_opts=True,
runtask_opts=True,
Expand All @@ -67,7 +67,7 @@ def parse(self):
help='sleep for random interval (between 0 and n number of seconds) before starting. This is a useful way to disperse git requests')
self.parser.add_option('-f', '--force', dest='force', default=False, action='store_true',
help='run the playbook even if the repository could not be updated')
self.parser.add_option('-d', '--directory', dest='dest', default=None, help='directory to checkout repository to')
self.parser.add_option('-d', '--directory', dest='dest', default='~/.ansible/pull', help='directory to checkout repository to')
self.parser.add_option('-U', '--url', dest='url', default=None, help='URL of the playbook repository')
self.parser.add_option('-C', '--checkout', dest='checkout',
help='branch/tag/commit to checkout. ' 'Defaults to behavior of repository module.')
Expand All @@ -91,9 +91,6 @@ def parse(self):
if not self.options.url:
raise AnsibleOptionsError("URL for repository not specified, use -h for help")

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)))

Expand Down Expand Up @@ -129,6 +126,7 @@ def run(self):
#TODO: enable more repo modules hg/svn?
if self.options.module_name == 'git':
repo_opts = "name=%s dest=%s" % (self.options.url, self.options.dest)
print(repo_opts)
if self.options.checkout:
repo_opts += ' version=%s' % self.options.checkout

Expand Down

0 comments on commit 9f148fc

Please sign in to comment.