From c356fa5010e31d9caddc58330644790c78adbbe5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gillier Date: Wed, 2 Jan 2019 10:40:22 +0100 Subject: [PATCH] [Continuous query] Fix attribute naming --- resources/continuous_query.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/continuous_query.rb b/resources/continuous_query.rb index 35b3bd5..49f8fd5 100644 --- a/resources/continuous_query.rb +++ b/resources/continuous_query.rb @@ -20,11 +20,11 @@ action :create do if current_cq if new_resource.rewrite - client.delete_continuous_query(name, database) - client.create_continuous_query(name, database, query, resample_every: resample_every, resample_for: resample_for) - updated_by_last_action true + client.delete_continuous_query(new_resource.name, new_resource.database) + client.create_continuous_query(new_resource.name, new_resource.database, new_resource.query, resample_every: new_resource.resample_every, resample_for: new_resource.resample_for) + new_resource.updated_by_last_action true else - Chef::Log.info("The continuous query #{name} on #{database} already exists. Skip this step.") + Chef::Log.info("The continuous query #{new_resource.name} on #{new_resource.database} already exists. Skip this step.") end else client.create_continuous_query(new_resource.name, new_resource.database, new_resource.query, resample_every: new_resource.resample_every, resample_for: new_resource.resample_for) @@ -41,9 +41,7 @@ def current_cq current_cq_arr = client.list_continuous_queries(database).select do |c| c['name'] == name end - if current_cq_arr.length > 1 - Chef::Log.fatal("Unexpected number of matches for continuous query #{name} on database #{database}: #{current_policy_arr}") - end + current_cq_arr.length > 1 && Chef::Log.fatal("Unexpected number of matches for continuous query #{name} on database #{database}: #{current_policy_arr}") current_cq_arr[0] if current_cq_arr.length end end