Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use X-Consul-Token header instead of token query parameter #655

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

jardleex
Copy link
Contributor

Pull Request (PR) description

Hi,

this change replaces the usage of the token query paramter with the HTTP header X-Consul-Token when interacting with ACLs, key/values and prepared queries.
The header was introduced in Consul 0.6.0.
The change is necessary as the token query parameter is marked deprecated in Consul 1.15.x. Using it triggers deprecation warnings in the Consul logs each time this module runs on a server.

Jan 26 10:44:11 consul03 consul[11454]: agent.http: This request used the token query parameter which is deprecated and will be removed in Consul 1.17: logUrl=/v1/query?token=<hidden>

Luckily it was not removed yet so there is still time to fix it.
I've tested the changes with our internal Puppet module in Vagrant.

This pull request was created by my best knowladge. I'm working as system administrator and have no ruby expertise but got some help from colleagues in our company. Thus said I'm open for any suggestion to improve this.

Thanks in advance!

This Pull Request (PR) fixes the following issues

n/a.

@zilchms
Copy link
Contributor

zilchms commented Feb 16, 2024

try running

bundle install
bundle exec rake strings:generate:reference

that should fix the test and get the CI running :)

@bastelfreak
Copy link
Member

@jardleex thanks for the PR. We run some acceptance tests in https://github.com/voxpupuli/puppet-consul/blob/master/spec/acceptance/class_spec.rb. Do we need to adjust them for other versions? Does your patch work on older consul versions as well?

@jardleex
Copy link
Contributor Author

jardleex commented Mar 7, 2024

We only tested it on Consul 1.17.0.
According to the official changelog the header support was added in Consul 0.6.0 in 2015 with this PR.
Currently the Puppet module version > 4.0.0 requires at least Consul 1.1.0 from May 2018 which supports the X-Consul-Token header already.

@bastelfreak bastelfreak added the enhancement New feature or request label Mar 8, 2024
@bastelfreak bastelfreak merged commit 6ea9574 into voxpupuli:master Mar 8, 2024
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants