ansible / mazer

Experimental Ansible Galaxy Content Manager
GNU General Public License v3.0
114 stars 18 forks source link

s/--content-paths/--collections-path for install, make use of ansible_collection consistent with ansible #239

Closed alikins closed 5 years ago

alikins commented 5 years ago

Bug Report

At the moment, 'mazer install --content-path /tmp/some_dir some_namespace.some_name' will install the 'foo.bar' collection directly to /tmp/some_dir/some_namespace.

But, the above won't work directly, since there is no 'ansible_collections' path between 'some_dir' and 'some_namespace'.

ansible-playbook will read an ANSIBLE_COLLECTIONS_PATHS env variable, which is expected to be colon separated directory paths that point to the dir before 'ansible_collections'

ie, ANSIBLE_COLLECTIONS_PATHS=/tmp/some_dir will not find the collections installed with
'mazer install --content-path /tmp/some_dir`.

Possible fixes

After changing --content-path to be --collections_path

1) Always append the 'ansible_collections' dir to whatever is provided for --collections_path

2) Use it explicit with expectation that users will need to include the 'ansible_collections'

The main issue with 1) is that it isn't obvious how to install a playbook adjacent collection

Need to end up with

.
myplaybook.yml
ansible_collections/
ansible_collections/some_namespace
<...>

mazer install --collections_path ansible_collections for 1) would result in

.
myplaybook.yml
<...>
ansible_collections/ansible_collections/some_namespace

For case above with 1), a user could need to cd to that dir, then 'mazer install --collections_path .`

ironfroggy commented 5 years ago

@alikins I'd like to advocate for --collections-path over --collections_path! Conventions are important and the standard dash separator in parameters is both far more common, so users will expect it, and essentially standard across all other Ansible CLI tools.