ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
825 stars 1.53k forks source link

RHEL8 pip3 and python-consul2 support #5251

Open deeco opened 2 years ago

deeco commented 2 years ago

Summary

when trying to run the community kv get error for "python-consul" here https://github.com/ansible-collections/community.general/blob/015566fb06628f5799ec2a0d33da0c4599262a28/plugins/lookup/consul_kv.py#L128

New distro only supports pip3 and would also like to know if pytohn-consul2 is supported ?

Issue Type

Bug Report

Component Name

https://github.com/ansible-collections/community.general/blob/main/plugins/lookup/

Ansible Version

$ ansible --version

AWX tower via operator version 0.21

Community.general Version

$ ansible-galaxy collection list community.general

 - name: community.general
    source: https://galaxy.ansible.com

Configuration

$ ansible-config dump --only-changed

OS / Environment

rhel 8 and k8s

Steps to Reproduce

Expected Results

expect version to be installed but never installs due to updated distro believe

Actual Results

'python-consul is required for consul_kv lookup. see http://python-consul.readthedocs.org/en/latest/#installation')

Code of Conduct

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 years ago

cc @Akasurde @None @RevBits @azenk @dagwieers @delineaKrehl @eric-belhomme @felixfontein @galanoff @jparrill @jpmens @konstruktoid @lungj @samdoran @scottsb @tylerezimmerman click here for bot help

felixfontein commented 2 years ago

You probably have to make sure that python-consul is installed in the execution environment used by AWX/Tower (assuming your version of AWX/Tower uses EEs).

deeco commented 2 years ago

You probably have to make sure that python-consul is installed in the execution environment used by AWX/Tower (assuming your version of AWX/Tower uses EEs).

Thanks for that @felixfontein , I also verified this and the ee environment has python consul installed, also exec into pod to verify this, ran the installer directly again to be sure also

deeco commented 2 years ago

could it be from within the task or scheduler containers it is also required ?

deeco commented 2 years ago

FYI , the below returns the full key, i am only interested in the value within the data block

- name: Retrieve a value from the key/value store
  community.general.consul_kv:
    host: dev-consul.domain.com
    port: 32690
    key: test/testkey
    register: test_key
russoz commented 2 years ago

Hi @deeco from what I gather, import consul will work with both python-consul and python-consul2. On the assumption that the -consul2 library kept API compatibility with the previous one, everything should work fine, and we could simply update the error message and docs to signal that any one of the two will work.

If the API is different, then we should ensure that this plugin will be able to handle that difference accordingly.

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

felixfontein commented 1 year ago

!component =plugins/lookups/consul_kv.py

felixfontein commented 1 year ago

!component +plugins/modules/consul_kv.py

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @sgargan click here for bot help

ansibullbot commented 9 months ago

cc @apollo13 click here for bot help

apollo13 commented 9 months ago

Both packages are years old and I think consul_kv would be better off with a rewrite to not require that library. urllib should be enough to make the http requests :)

felixfontein commented 9 months ago

ansible.module_utils.urls has also a useful interface and can be used, and it comes with ansible-core, so there's no need for any library at all :)

ansibullbot commented 4 months ago

cc @Ilgmi click here for bot help

maciej-lech commented 6 days ago

I think that now, the new consul modules like consul_agent_service and consul_agent_check use built-in ansible.module_utils.consul API client and do not rely on external libraries. Would be good to change the consul_kv to follow the same approach.

Best regards, Maciej

apollo13 commented 6 days ago

Absolutely, PRs welcome 👍

On Wed, Oct 30, 2024, at 14:43, Maciej Lech wrote:

I think that now, the new consul modules like consul_agent_service and consul_agent_check use built-in ansible.module_utils.consul API client and do not rely on external libraries. Would be good to change the consul_kv to follow the same approach.

Best regards, Maciej

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/community.general/issues/5251#issuecomment-2447207007, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAT5C6H6VNOAXROBCPVQB3Z6DPAPAVCNFSM6AAAAAAQGEPQR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBXGIYDOMBQG4. You are receiving this because you were mentioned.Message ID: @.***>