kennel 1.113.0 → 1.113.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b199d98b445f146f6e5ac3a2746d715c4286a75da4ddd9cf2268875e41a4f7f4
4
- data.tar.gz: cc748229520b855819210413905525b962b7ea21ff13053258a011f59abaf001
3
+ metadata.gz: 1820e573733a40ccb56114ecc6c94f8d7732feb10d556f3bf1107c9d21fab7f0
4
+ data.tar.gz: ed5230938e75e643c71b719f6ec4e3e317e9e94d9fb1a2848bbbe881eea56f4e
5
5
  SHA512:
6
- metadata.gz: a26a733f32e1b0c167d950d4da1c8deb69717306e6428636e2b5ab03b450eb6db6f6797eb3a054a66083b91d351a6ca875703255cea2adec62f6022452d1e90c
7
- data.tar.gz: cedb46594f03b8e2ebf89915f4bd8945f0378b51808e36460b5af8c7b44266e1661de771acb6febaffa2ca1226b88a533fccbea870e47e025b30677b7f91f5a4
6
+ metadata.gz: beb8e6d2a60fd3c8ebe26cdd14ca70d89b9a107ee0a831cea52601464b7c13afe058f25eaee76add474e728f404d4c56216eea24e5ce4c5a5b58897da1e43af0
7
+ data.tar.gz: 8000438dd34c1e22334283f2e3892379cc08fadeb6085d74ecd41a3b32fdc0aacb28b9a2019d6bdad7a48bcea94084200f69d8c814054fe928aedf16b06b7ea2
@@ -131,12 +131,15 @@ module Kennel
131
131
  as_json[:query] = as_json[:query].gsub(/%{(.*?)}/) do
132
132
  resolve($1, type, id_map, **args) || $&
133
133
  end
134
+ else # do nothing
134
135
  end
135
136
  end
136
137
 
137
138
  def validate_update!(_actuals, diffs)
138
- if bad_diff = diffs.find { |diff| diff[1] == "type" }
139
- invalid! "Datadog does not allow update of #{bad_diff[1]} (#{bad_diff[2].inspect} -> #{bad_diff[3].inspect})"
139
+ # ensure type does not change, but not if it's metric->query which is supported and used by importer.rb
140
+ _, path, from, to = diffs.detect { |_, path, _, _| path == "type" }
141
+ if path && !(from == "metric alert" && to == "query alert")
142
+ invalid! "Datadog does not allow update of #{path} (#{from.inspect} -> #{to.inspect})"
140
143
  end
141
144
  end
142
145
 
@@ -145,7 +148,7 @@ module Kennel
145
148
  end
146
149
 
147
150
  def self.url(id)
148
- Utils.path_to_url "/monitors##{id}/edit"
151
+ Utils.path_to_url "/monitors/#{id}/edit"
149
152
  end
150
153
 
151
154
  def self.parse_url(url)
@@ -208,6 +211,10 @@ module Kennel
208
211
  def validate_json(data)
209
212
  super
210
213
 
214
+ if data[:name]&.start_with?(" ")
215
+ invalid! "name cannot start with a space"
216
+ end
217
+
211
218
  type = data.fetch(:type)
212
219
 
213
220
  # do not allow deprecated type that will be coverted by datadog and then produce a diff
@@ -238,6 +245,10 @@ module Kennel
238
245
  unless ALLOWED_PRIORITY_CLASSES.include?(priority.class)
239
246
  invalid! "priority needs to be an Integer"
240
247
  end
248
+
249
+ if data.dig(:options, :timeout_h)&.> 24
250
+ invalid! "timeout_h must be <= 24"
251
+ end
241
252
  end
242
253
 
243
254
  # verify is_match/is_exact_match and {{foo.name}} uses available variables
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.113.0"
3
+ VERSION = "1.113.3"
4
4
  end
data/lib/kennel.rb CHANGED
@@ -108,7 +108,7 @@ module Kennel
108
108
  known = []
109
109
  filter = project_filter
110
110
 
111
- parts = Models::Project.recursive_subclasses.flat_map do |project_class|
111
+ parts = Utils.parallel(Models::Project.recursive_subclasses) do |project_class|
112
112
  project = project_class.new
113
113
  kennel_id = project.kennel_id
114
114
  if filter
@@ -116,7 +116,7 @@ module Kennel
116
116
  next [] unless filter.include?(kennel_id)
117
117
  end
118
118
  project.validated_parts
119
- end
119
+ end.flatten(1)
120
120
 
121
121
  if filter && parts.empty?
122
122
  raise "#{filter.join(", ")} does not match any projects, try any of these:\n#{known.uniq.sort.join("\n")}"
@@ -131,7 +131,6 @@ module Kennel
131
131
  end
132
132
 
133
133
  # trigger json caching here so it counts into generating
134
- # somehow threading helps reduce this ~25%
135
134
  Utils.parallel(parts, &:as_json)
136
135
 
137
136
  parts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.113.0
4
+ version: 1.113.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-13 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday