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

[Continuous query] Fix attribute naming #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions resources/continuous_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down