Skip to content

consul* modules use configuration in the environment opposed to configuration arguments given #35833

@colin-nolan

Description

@colin-nolan
ISSUE TYPE
  • Bug Report
COMPONENT NAME

consul_kv

ANSIBLE VERSION
ansible 2.4.2.0
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.2 (default, Sep 13 2017, 14:26:54) [GCC 4.9.2]
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

The python-consul library gives precedence to environment variables over arguments. This can lead to the values binded to the host, port, token, validate_certs and scheme parameters of this module being unexpectedly overriden if CONSUL_HTTP_ADDR, CONSUL_HTTP_TOKEN, CONSUL_HTTP_SSL or CONSUL_HTTP_SSL_VERIFY environment variables are set.

Arguably, the precedence ordering implemented by python-consul is wrong. There is an issue for this (python-consul/python-consul#192) but, given the library does not appear to be actively maintained, it is unlikely to be addressed any time soon.

STEPS TO REPRODUCE

Use consul_kv with any of the distruptive environment variables listed above set.

EXPECTED RESULTS

The module should use the host, port, token, etc. that it was given.

ACTUAL RESULTS

The module uses whatever is set in the environment variables instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects_2.4This issue/PR affects Ansible v2.4bot_closedbugThis issue/PR relates to a bug.clusteringClustering categorycollectionRelated to Ansible Collections workcollection:community.generalmoduleThis issue/PR relates to a module.needs_collection_redirecthttps://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.mdsupport:communityThis issue/PR relates to code supported by the Ansible community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions