Repository: ansible/ansible

Issue:
ansible-pull 2.0.0 requires an argument
with ansible 2.0.0-beta2 I get:

```
# ansible-pull --url myurl --key-file key
Usage: ansible-pull <host-pattern> [options]
....
ERROR! Missing target hosts
```

Man page still indicates that it should default to local.yml.  Seems something is messed up here.



Discussion:
The problem is that no proper files are being created. Saying, when you do:

```
pip install --upgrade http://releases.ansible.com/ansible/ansible-2.0.0-0.4.beta2.tar.gz
```

and after that review the binaries - you'll see (3902 is the size of the script):

```
zentavr@zentavr-gsn-mac:~/__repos/ansible$ ls -la ./.venv/bin/ansib*
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible-doc
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible-galaxy
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible-playbook
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible-pull
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:24 ./.venv/bin/ansible-vault
```

If you do:

```
pip install --upgrade https://github.com/ansible/ansible/archive/devel.zip
```

and review the binaries - you'll see this:

```
zentavr@zentavr-gsn-mac:~/__repos/ansible$ ls -la ./.venv/bin/ansib*
-rwxr-xr-x  1 zentavr  staff  3902 29 жов 00:02 ./.venv/bin/ansible
-rwxr-xr-x  1 zentavr  staff     7 29 жов 00:02 ./.venv/bin/ansible-doc
-rwxr-xr-x  1 zentavr  staff     7 29 жов 00:02 ./.venv/bin/ansible-galaxy
-rwxr-xr-x  1 zentavr  staff     7 29 жов 00:02 ./.venv/bin/ansible-playbook
-rwxr-xr-x  1 zentavr  staff     7 29 жов 00:02 ./.venv/bin/ansible-pull
-rwxr-xr-x  1 zentavr  staff     7 29 жов 00:02 ./.venv/bin/ansible-vault
```

...saying _ansible-playbook_ has only the word /ansible/ (7 bytes) and that's it!

I have Python 2.7.10 on OS X El Capitan 10.11.1 and:
pip=7.1.2
setuptools=18.4

pip install --upgrade git+https://github.com/ansible/ansible.git@develop helped for me.

Well, I'm installing from https://copr-fe.cloud.fedoraproject.org/coprs/toshio/ansible-upstream/ - no problem with the binary.  But the pull.py cli code definitely bails if there is no argument.

The file sizes matching or seemingly small is not the issue.  `ansible` is the only command now, and the others are symlinks in the repo.  The process of creating a python package basically duplicates them and doesn't symlink.  The zip file from github, is just a zip of the repo (which is also missing modules btw), and keeps the other files as symlinks.

The problem is probably in the `PullCLI` class.  Likely due to the following lines, which probably need removed: https://github.com/ansible/ansible/blob/7c10c16251d09fcdd99c5ee9364fb0796e3b3a25/lib/ansible/cli/pull.py#L94-L95

@sivel - I saw that they are the symlinks in the repo (and in archives too). But when pip finishes - we have them as files (but not symlinks). 


Resolving patch:
diff --git a/lib/ansible/cli/pull.py b/lib/ansible/cli/pull.py
--- a/lib/ansible/cli/pull.py
+++ b/lib/ansible/cli/pull.py
@@ -50,7 +50,7 @@ def parse(self):
         ''' create an options parser for bin/ansible '''
 
         self.parser = CLI.base_parser(
-            usage='%prog <host-pattern> [options]',
+            usage='%prog -U <repository> [options]',
             connect_opts=True,
             vault_opts=True,
             runtask_opts=True,
@@ -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.')
@@ -91,9 +91,6 @@ def parse(self):
         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 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 +111,7 @@ def run(self):
         # 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) ])


Test patch: