Hi, > 1. query_file.py contains my class which extends ActionBase. I use > some more modern stuff like types, @singledispatch, and @dataclass. I > think it will be hard to support Python 2.7 so I thought I'd stick > with Python 3 only. Does that decision make sense? I thought so since > it's been a while now since Python 2.7 become unsupported.
If you want to support older ansible-core versions, you also should support Python 2.7, but if you stick to ansible-core 2.12+ there's no need for that. You can find a support matrix here: https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix If your collection supports (as declared in meta/runtime.yml) ansible-core 2.12+ or even requires a later version, you can stick to Python 3.8+ on the controller side (action plugins always run on the controller side). > 2. If I go for Python 3 only, is there something I should do for > ansible-test sanity to pass? It complains about some missing > Python versions. Which ansible-core version are you using? > 3. Next to as a sibling to query_file.py I have a directory named > query. It contains the generic logic which is pure Python and does > not require Ansible. I'd like to keep that code split up as it is. Is > there a better, more "standard", place for it? The standard place would be somewhere in plugins/plugin_utils/. Every file in plugins/action/ (and subdirectories) is supposed to be an action plugin. The JSON file in plugins/action/ might also cause problems. Do document your plugin, you also need a module stub in plugins/modules/ with DOCUMENTATION, RETURN, and EXAMPLES. > 4. The query directory contains tests as well. I like my tests > next to the files being tested, but it seems Ansible prefers a tests > directory. Should I move my tests there for them to be executed well > in a pipeline? ansible-test prefers tests for <path_to_file>/<filebase>.py to be in tests/unit/<path_to_file>/test_<filebase>.py. Regarding tests/integration: > │ └── targets > │ └── action_query_file > │ └── tasks > │ └── test_x.yml you should have a main.yml in targets/action_query_file/tasks/. Integration tests are an Ansible role, and `ansible-test integration` uses the default entrypoint. Cheers, Felix -- 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 an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/20230729064107.043dbbe5%40rovaniemi.