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

influxdb_auth does not work when providing resource name #108

Open
lennardk opened this issue Feb 23, 2024 · 0 comments
Open

influxdb_auth does not work when providing resource name #108

lennardk opened this issue Feb 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@lennardk
Copy link

Describe the Bug

When creating a token using influxdb_auth, providing a permissions[].resource.name in addition to permissions[].resource.type, it fails with the following errors:

Error: Error in get call: undefined method `<<' for {:params=>{:name=>"bucketname"}}:Hash
Did you mean?  <
Error: /opt/puppetlabs/puppet/cache/lib/puppet_x/puppetlabs/influxdb/influxdb.rb:91:in `influx_get' /opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:74:in `block in create' /opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:70:in `map' /opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:70:in `create' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:41:in `block (2 levels) in set' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/base_context.rb:67:in `block (2 levels) in <class:BaseContext>' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:40:in `block in set' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:13:in `each' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:13:in `set' /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api.rb:342:in `flush' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:25:in `evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:267:in `apply' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:288:in `eval_resource' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `call' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block (2 levels) in evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark' /opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block in evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:122:in `traverse' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:178:in `evaluate' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:238:in `block (2 levels) in apply' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark' /opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:237:in `block in apply' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:165:in `with_destination' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:151:in `as_logging_destination' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:236:in `apply' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:286:in `block (2 levels) in apply_catalog' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark' /opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:285:in `block in apply_catalog' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:245:in `block in benchmark' /opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:244:in `benchmark' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:284:in `apply_catalog' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:500:in `run_internal' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:339:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:83:in `block (6 levels) in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:289:in `override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:82:in `block (5 levels) in run' /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout' /opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:105:in `timeout' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:81:in `block (4 levels) in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:21:in `lock' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:71:in `block (3 levels) in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:162:in `with_client' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:67:in `block (2 levels) in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:127:in `run_in_fork' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:66:in `block in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:172:in `controlled_run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:433:in `onetime' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:393:in `block in run_command' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:289:in `override' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:390:in `run_command' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `block in run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:756:in `exit_on_fail' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute' /opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
Error: influxdb_auth[tokenname]: Creating: Error creating auth state: undefined method `key?' for []:Array
Error: influxdb_auth[tokenname]: Creating: ["/opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:75:in `block in create'", "/opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:70:in `map'", "/opt/puppetlabs/puppet/cache/lib/puppet/provider/influxdb_auth/influxdb_auth.rb:70:in `create'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:41:in `block (2 levels) in set'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/base_context.rb:67:in `block (2 levels) in <class:BaseContext>'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:40:in `block in set'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:13:in `each'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api/simple_provider.rb:13:in `set'", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/puppet-resource_api-1.9.0/lib/puppet/resource_api.rb:342:in `flush'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:25:in `evaluate'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:267:in `apply'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:288:in `eval_resource'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `call'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block (2 levels) in evaluate'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block in evaluate'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:122:in `traverse'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:178:in `evaluate'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:238:in `block (2 levels) in apply'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:237:in `block in apply'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:165:in `with_destination'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:151:in `as_logging_destination'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:236:in `apply'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:286:in `block (2 levels) in apply_catalog'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:567:in `block in thinmark'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:566:in `thinmark'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:285:in `block in apply_catalog'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:245:in `block in benchmark'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:244:in `benchmark'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:284:in `apply_catalog'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:500:in `run_internal'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:339:in `run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:83:in `block (6 levels) in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:289:in `override'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:82:in `block (5 levels) in run'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'", "/opt/puppetlabs/puppet/lib/ruby/2.7.0/timeout.rb:105:in `timeout'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:81:in `block (4 levels) in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:21:in `lock'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:71:in `block (3 levels) in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:162:in `with_client'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:67:in `block (2 levels) in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:127:in `run_in_fork'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:66:in `block in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:172:in `controlled_run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:433:in `onetime'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:393:in `block in run_command'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:289:in `override'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:390:in `run_command'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `block in run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:756:in `exit_on_fail'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run'", "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'", "/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'"]

Expected Behavior

The token gets created with the assigned permissions

Steps to Reproduce

Steps to reproduce the behavior:

  1. Use this puppet module to manage influxdb, creating org my_org and bucket bucketname
  2. Create the following resource for some node:
  influxdb_auth {"tokenname":
    org           => 'my_org'
    permissions   => [
      {
        "action"   => "read",
        "resource" => {
          "type"   => "buckets",
          "name" => "bucketname"
        }
      },
    ],
  }
  1. Run the puppet agent on the node

Environment

  • Version 2.4.0
  • Platform Debian 11

Additional Context

This probably became a bug with c195e50. I'm creating a pull request, although I'm not currently able to learn how to include a proper test case.

@lennardk lennardk added the bug Something isn't working label Feb 23, 2024
lennardk added a commit to equinix-ms/influxdb that referenced this issue Feb 23, 2024
lennardk added a commit to equinix-ms/influxdb that referenced this issue Mar 4, 2024
lennardk added a commit to equinix-ms/influxdb that referenced this issue Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant