kennel 1.105.0 → 1.107.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15372f06919044f4751bb25a9aea5b965a16253145841c6b964ee8d109e14d26
4
- data.tar.gz: 7f658ed4facabdf0100650a1298e83de855a35000b3ed4da8b12f23d7e108894
3
+ metadata.gz: 70f6012b2bb28973367faa9bb4ba9bd97e84ea182b6ba0e3c6b0779b4cc717fc
4
+ data.tar.gz: 2dc559844f4116c56de8d456fb467079476b80e33ae5a03415541bfb3e749985
5
5
  SHA512:
6
- metadata.gz: 6bf58efda2f995a5903c52f3e0ed58f756638c28009d3e172b34b456f3fc64c494f0bdbb789d147f368ab30ad004453c7a969c6eb644e610557a3874c0c56da7
7
- data.tar.gz: d1e3d4eca303de897dee30c357f0e0a03ac0ff7fee9a1de8904c1749c43eb093aa309b0063e7146782d19928664ea0d6e497da7ed8dc92ca0d87da437db97ed2
6
+ metadata.gz: 8573febe6011241b87f657e5aa205fce7684b18b3db757045d7011132fbe21c5f3538e99c51413bc2209f6a250cc359fac96fdad47c5ecaef1685b1d27f9d847
7
+ data.tar.gz: a9a43bcacacf819253cbd0d73611e264053b5ed665340ee0390b6e6c4e0b5a3660a469c26fe07bcfaaec2e860b7f5be00adee2e8b0591b65b5d52a2527b6b496
@@ -61,6 +61,10 @@ module Kennel
61
61
  global_time_target: "0",
62
62
  title_align: "left",
63
63
  title_size: "16"
64
+ },
65
+ "query_table" => {
66
+ title_align: "left",
67
+ title_size: "16"
64
68
  }
65
69
  }.freeze
66
70
  SUPPORTED_DEFINITION_OPTIONS = [:events, :markers, :precision].freeze
@@ -205,6 +209,12 @@ module Kennel
205
209
  end
206
210
  end
207
211
 
212
+ def validate_update!(_actuals, diffs)
213
+ if bad_diff = diffs.find { |diff| diff[1] == "layout_type" }
214
+ invalid! "Datadog does not allow update of #{bad_diff[1]} (#{bad_diff[2].inspect} -> #{bad_diff[3].inspect})"
215
+ end
216
+ end
217
+
208
218
  private
209
219
 
210
220
  # creates queries from metadata to avoid having to keep q and expression in sync
@@ -126,6 +126,12 @@ module Kennel
126
126
  end
127
127
  end
128
128
 
129
+ def validate_update!(_actuals, diffs)
130
+ if bad_diff = diffs.find { |diff| diff[1] == "type" }
131
+ invalid! "Datadog does not allow update of #{bad_diff[1]} (#{bad_diff[2].inspect} -> #{bad_diff[3].inspect})"
132
+ end
133
+ end
134
+
129
135
  def self.api_resource
130
136
  "monitor"
131
137
  end
@@ -217,6 +223,10 @@ module Kennel
217
223
  validate_message_variables(data)
218
224
  end
219
225
 
226
+ if type == "service check" && !data[:query].to_s.include?(".by(")
227
+ invalid! "query must include a .by() at least .by(\"*\")"
228
+ end
229
+
220
230
  unless ALLOWED_PRIORITY_CLASSES.include?(priority.class)
221
231
  invalid! "priority needs to be an Integer"
222
232
  end
@@ -243,6 +253,8 @@ module Kennel
243
253
  match[1].to_s.split(/\s*,\s*/).map { |k| k.split(":", 2)[-2] } + # {a:b} -> a TODO: does not work for service check
244
254
  match[2].to_s.gsub(/["']/, "").split(/\s*,\s*/) # by {a} -> a
245
255
 
256
+ return if allowed.include?("*")
257
+
246
258
  allowed.compact!
247
259
  allowed.uniq!
248
260
  allowed.map! { |w| "#{w.tr('"', "")}.name" }
@@ -98,6 +98,9 @@ module Kennel
98
98
  self.class.remove_tracking_id(as_json)
99
99
  end
100
100
 
101
+ def validate_update!(*)
102
+ end
103
+
101
104
  private
102
105
 
103
106
  def resolve(value, type, id_map, force:)
data/lib/kennel/syncer.rb CHANGED
@@ -9,6 +9,7 @@ module Kennel
9
9
  @project_filter = project
10
10
  @expected = expected
11
11
  calculate_diff
12
+ validate_plan
12
13
  prevent_irreversible_partial_updates
13
14
  end
14
15
 
@@ -210,6 +211,14 @@ module Kennel
210
211
  end
211
212
  end
212
213
 
214
+ # We've already validated the desired objects ('generated') in isolation.
215
+ # Now that we have made the plan, we can perform some more validation.
216
+ def validate_plan
217
+ @update.each do |_, expected, actuals, diffs|
218
+ expected.validate_update!(actuals, diffs)
219
+ end
220
+ end
221
+
213
222
  # - do not add tracking-id when working with existing ids on a branch,
214
223
  # so resource do not get deleted when running an update on master (for example merge->CI)
215
224
  # - make sure the diff is clean, by kicking out the now noop-update
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.105.0"
3
+ VERSION = "1.107.1"
4
4
  end
data/template/Readme.md CHANGED
@@ -65,7 +65,7 @@ end
65
65
  - open [Datadog API Settings](https://app.datadoghq.com/account/settings#api)
66
66
  - create a `API Key` or get an existing one from an admin, then add it to `.env` as `DATADOG_API_KEY`
67
67
  - open [Datadog API Settings](https://app.datadoghq.com/access/application-keys) and create a new key, then add it to `.env` as `DATADOG_APP_KEY=`
68
- - change the `DATADOG_SUBDOMAIN=app` in `.env` to your companies subdomain if you have one
68
+ - if you have a custom subdomain, change the `DATADOG_SUBDOMAIN=app` in `.env`
69
69
  - verify it works by running `rake plan`, it might show some diff, but should not crash
70
70
 
71
71
  ### Adding a team
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.105.0
4
+ version: 1.107.1
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-03-08 00:00:00.000000000 Z
11
+ date: 2022-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday