voxpupuli / puppet-consul

A Puppet Module to Manage Consul
Apache License 2.0
121 stars 315 forks source link

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

Closed jardleex closed 6 months ago

jardleex commented 6 months ago

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 commented 6 months ago

try running

bundle install
bundle exec rake strings:generate:reference

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

bastelfreak commented 6 months ago

@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 commented 6 months ago

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.