ansible/ansible — pull request #6537 by patrickheeney (2014-03-17 23:40:30+00:00)
Title: Galaxy improvements

This is the PR for #6490. **This is not ready and strictly interested in feedback and implementation suggestions**.

This is my first time programming in python so please enlightenment me on better ways to do things. This may not work right away, I have been rebasing with different versions so it could be in a different state. I have made a note about why I have done some things below:

1. All the GIT functions were necessary since the only other place that has them is the GIT module and they require the module to be passed in as arguments, which does not work in this instance.
2. I had to modify `basic.py` because I needed access to the `get_bin_path` functions. I moved them to what seems like global state and use the class function to call the global ones.
3. This should be backwards compatible because I convert the old format which is `name,value` into the new format before processing it. Need to test it.

Usage:
```
ansible-galaxy -r test.yml
```

test.yml (need to add a real world test file here, this is a sample to show implementation):
```
# galaxy

- source: galaxy
name: test/module
version: 1234

- name: test/module

- { source: galaxy, name: test/module }

# git

- source: git
name: git_role
repo: 'git@github.com:jctanner/ansible-pull-test.git'
dest: ansible/roles
remote: origin
depth: 1
version: 1234
executable: /path/to/git

- { source: git, repo: 'git@github.com:jctanner/ansible-pull-test.git' }

# file

- source: file
name: file_role
path: file_role.tar.gz

- name: test/module.tar.gz

- source: file
name: file_role
path: https://github.com/ansible/ansible/archive/v1.5.3.tar.gz

```

Todo:
- [ ] Testing / Fixing bugs. This was a rough go at it, I did not test a lot of variations, just merely got it git cloning.
- [ ] Better errors. I was not sure how to handle the error messages when not within a module. I have seen some scripts `print >>sys.stderr`, others `print "..." sys.exit(1)`, and finally `exit_without_ignore(options)`. Once I know how to handle this I will clean this up.
- [ ] Git improvements. If the `name` option in git is blank it should pull it from the repo name.
- [ ] File improvements. Add support for `zip` and some other file extensions if it does not have this already. Add md5_checksum verification.
- [ ] Remote file. Right now `file:` I believe only works locally. Would be nice to fetch this from a remote and install it locally. For example if you wanted to link to a tar.gz hosted by github.
- [ ] Unit tests? I did not see anywhere that galaxy is tested. I thought it could use some tests to make sure its parsing the files correctly. Maybe this is not needed right now.

I am open to any and all suggestions. Thanks for reading!