1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

reverted to previous pull checkout dir behaviour

This fixes bugs with not finding plays when not specifying checkout dir
Also makes it backwards compatible
This commit is contained in:
Brian Coca 2015-12-03 19:42:05 -08:00
parent 8d5f36a6c2
commit e1c62fb5af

View file

@ -74,7 +74,7 @@ class PullCLI(CLI):
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='~/.ansible/pull',
self.parser.add_option('-d', '--directory', dest='dest', default=None,
help='directory to checkout repository to')
self.parser.add_option('-U', '--url', dest='url', default=None,
help='URL of the playbook repository')
@ -90,6 +90,11 @@ class PullCLI(CLI):
self.options, self.args = self.parser.parse_args()
if not self.options.dest:
hostname = socket.getfqdn()
# use a hostname dependent directory, in case of $HOME on nfs
self.options.dest = os.path.join('~/.ansible/pull', hostname)
if self.options.sleep:
try:
secs = random.randint(0,int(self.options.sleep))