Skip to content
Snippets Groups Projects
Verified Commit 33877fa5 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Fixed handlign the default retention policy

parent 0107a7c2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -17,13 +17,15 @@ desc 'Sets up the retention policies'
task :policies do
db = ENV.fetch('INFLUX_DATABASE')
 
existing = CLIENT.list_retention_policies(db).map { |h| h['name'] }
policies = CLIENT.list_retention_policies(db)
policy_names = policies.map { |h| h['name'] }
default = policies.find { |h| h['name'] == 'default' }
 
unless existing.include?('default')
CLIENT.create_retention_policy('default', db, '1h', 1, true)
unless default['duration'] == '1h'
CLIENT.alter_retention_policy('default', db, '1h', 1, true)
end
 
unless existing.include?('downsampled')
unless policy_names.include?('downsampled')
CLIENT.create_retention_policy('downsampled', db, '7d', 1)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment