puppetlabs / influxdb

2 stars 22 forks source link

Problem when using token_file and some Influx API methods #111

Open mdetrano opened 3 months ago

mdetrano commented 3 months ago

Describe the Bug

Ran into an issue using the influxdb_bucket resource to create a bucket on a remote system (not managed by Puppet at all). For the token I used the "token_file" parameter. The bucket seems to have been created correctly but when running Puppet agent I got a confusing error message about "CR/LF" not being allowed in the http header.

Expected Behavior

Bucket should be created with no error message.

Steps to Reproduce

Steps to reproduce the behavior: define an influxdb_bucket resource, using 'host' and 'token_file" parameters, to create the bucket on a remote host from the puppet agent

Environment

Additional Context

I could resolve the problem by changing this line (66) in: lib/puppet_x/puppetlabs/influxdb/influxdb.rb

from: token = File.read(@token_file)

to: token = File.read(@token_file).chomp

(File.read seems to add a newline that is not in the original file)