Skip to content

Commit

Permalink
(#108) influx_auth: fix creation using resource name
Browse files Browse the repository at this point in the history
  • Loading branch information
lennardk committed Mar 4, 2024
1 parent ee0f7d6 commit 087ae28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/puppet/provider/influxdb_auth/influxdb_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def create(context, name, should)
if p['resource'].key?('name') && !p['resource'].key?('id')
resname = p['resource']['name']
restype = p['resource']['type']
response = influx_get("/api/v2/#{restype}", params: { 'name': resname })
if response.key?(restype)
p['resource']['id'] = response[restype][0]['id']
response = influx_get("/api/v2/#{restype}?name=#{resname}&orgID=#{id_from_name(@org_hash, should[:org])}")
if !response.empty? && response[0].key?(restype)
p['resource']['id'] = response[0][restype][0]['id']
else
context.error("failed to find id for #{restype} #{resname}")
end
Expand Down

0 comments on commit 087ae28

Please sign in to comment.