ansible / mazer

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

Use collection name to create symlink in editable mode #290

Open nqb opened 4 years ago

nqb commented 4 years ago

Feature Request

Use Case

I use --editable option on an existing Ansible collection with following tree:

ansible-packetfence/
├── ansible
│   ├── meta
│   ├── releases
│   └── roles
│       ├── packetfence_common
│       ├── packetfence_dev
│       └── packetfence_install
├── inventory

like this:

mazer install --namespace inverse_inc --editable ~/git/ansible-packetfence/ansible/

This result with following symlink: ~/.ansible/collections/ansible_collections/inverse_inc/ansible/

but my collection has name packetfence mentioned in ansible-packetfence/ansible/galaxy.yml.

Consequently, all my playbooks that use inverse_inc.packetfence collection will not work.

Proposed Solution

When using --editable in place of using name of directory as symlink name, mazer should extract name value from galaxy.yml of collection to create a correct symlink name.

Alternatives

Having an extra argument to --editable option in order to create a symlink with a free name (like GNU ln command):

mazer install --namespace my_namespace --editable ~/src/collections/my_new_collection link_name
# in my case:
mazer install --namespace inverse_inc --editable ~/git/ansible-packetfence/ansible/ packetfence