Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Roman Dodin
Yes, this is clear, but then it will point to the "installed" collection. Unless developing directly in the ~/.ansible/collections or using symlinks like Brian mentioned above, this won't use the files from my dev directory. I was looking for a way to make my local files in a dir that doesn't

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Matt Martz
As mentioned, you need to set `PYTHONPATH` in your IDE to the directory containing `ansible_collections`. Like: `PYTHONPATH=~/.ansible/collections`. I don't use a fancy IDE, so I don't have any direct guidance on where you would need to set this. Maybe the IDE doesn't respect this environment

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Roman Dodin
As for the 2nd question the only workaround I found is to use relative imports, which I want to get rid of. Let me give you an example. In my collection dir I have the plugins subdir that has: plugins ├── httpapi │ └── sr.py ├── module_utils │ └── sr.py └── modules └── get.py In my

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Brian Coca
ls -l ~/.ansible/collections/ansible_collections/ total 20 lrwxrwxrwx 1 bcoca bcoca 54 Oct 7 2021 bcoca -> /home/bcoca/work/collections/ansible_collections/bcoca On Wed, Feb 22, 2023 at 3:45 PM Brian Coca wrote: > > symlinks do work, but you still need an ansible_collections/ dir > before

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Brian Coca
symlinks do work, but you still need an ansible_collections/ dir before your collection -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Roman Dodin
Yes, clear, thanks Matt. it just felt wrong to me - imposing a predefined dir structure to import a collection from an arbitrary path. I tried symlinked dir, but didn't work either :D. Nevertheless, appreciate your comments, I will likely resort to using `galaxy-install` as a step before running

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Matt Martz
Not positive I understand, but if you want to use some arbitrary directory, it must be in a path that matches `collections/ansible_collections//` But my instructions still stand, regardless of using a vcs, they show how to put a collection in place without use of ansible-galaxy. You just need to

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Roman Dodin
Thanks Matt, Q1 was not about vcs, maybe I poorly explained the problem. I was wondering how to make a collection source to be picked up by the playbooks *without* installing collection with galaxy-install. I found only one way of doing it: tuning collections_path, but the problem is that this

Re: [ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Matt Martz
1) You just use normal `git` or whatever your version control system is: cd ~/.ansible/collections/ansible_collections rm -rf amazon/aws mkdir -p amazon cd amazon git clone https://github.com/ansible-collections/amazon.aws.git aws 2) I don't know about IDEs, but the PYTHONPATH for those is

[ansible-devel] How to have ansible collection installed in the "edit mode"?

2023-02-22 Thread Roman Dodin
Hi all, I am developing a collection following the dir layout as prescribed by the skeleton. I have the following 2 questions re dev workflows 1) How do you install the collection that you're developing in the "edit mode", like with pip you do `pip install -e`, and then you can do changes to

Re: [ansible-devel] Add condition when command/shell modules should return OK (not changed)

2023-02-22 Thread Pavel Březina
On 2/22/23 14:55, Mark Chappell wrote: Hi Pavel, I can only speak as a community maintainer.  However, from experience, trying to pack extra logic like that into modules results in the code becoming less reliable.  The "check" parameter you've suggested is effectively duplicating the

Re: [ansible-devel] Add condition when command/shell modules should return OK (not changed)

2023-02-22 Thread Mark Chappell
Hi Pavel, I can only speak as a community maintainer. However, from experience, trying to pack extra logic like that into modules results in the code becoming less reliable. The "check" parameter you've suggested is effectively duplicating the functionality of "when", while not being as

[ansible-devel] Add condition when command/shell modules should return OK (not changed)

2023-02-22 Thread Pavel Brezina
Hi, this is about https://github.com/ansible/ansible/issues/80025 which was closed without giving a reason. Having this feature implemented would help shell/command become really idempotent a giving correct result. It should be also quite simple to implement, given how the command module is