kennel 1.107.1 → 1.109.0

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: 70f6012b2bb28973367faa9bb4ba9bd97e84ea182b6ba0e3c6b0779b4cc717fc
4
- data.tar.gz: 2dc559844f4116c56de8d456fb467079476b80e33ae5a03415541bfb3e749985
3
+ metadata.gz: ffd1a9a74e7d2ac535e24fdb6f4fef30fad6c6e61e61ae7b73b17821510c0a2e
4
+ data.tar.gz: 761b0cd94a3a4ec951302e9aa7b7a9d806330cfe7ba6adc0b83571b332f4eea9
5
5
  SHA512:
6
- metadata.gz: 8573febe6011241b87f657e5aa205fce7684b18b3db757045d7011132fbe21c5f3538e99c51413bc2209f6a250cc359fac96fdad47c5ecaef1685b1d27f9d847
7
- data.tar.gz: a9a43bcacacf819253cbd0d73611e264053b5ed665340ee0390b6e6c4e0b5a3660a469c26fe07bcfaaec2e860b7f5be00adee2e8b0591b65b5d52a2527b6b496
6
+ metadata.gz: db853fd8eb79eeeb29556fb132bdd03e2042e955848b4d3b466c140a06b61e61522b2656437da4488c50428da9b8e37cd3cd172a33d12b956ba98a85a71392da
7
+ data.tar.gz: a240420d91cfe30d250d1e7ef3462a34f7845825dd3bcbfe9eabd511ac231b882e285668c6553c0835afa710777016b7379fe143b771cf145524383191101b31
@@ -10,11 +10,7 @@ module Kennel
10
10
  SETTING_OVERRIDABLE_METHODS = [:name, :kennel_id].freeze
11
11
 
12
12
  def kennel_id
13
- name = self.class.name
14
- if name.start_with?("Kennel::") # core objects would always generate the same id
15
- raise_with_location ArgumentError, "Set :kennel_id"
16
- end
17
- @kennel_id ||= Utils.snake_case name
13
+ @kennel_id ||= Utils.snake_case kennel_id_base
18
14
  end
19
15
 
20
16
  def name
@@ -24,6 +20,17 @@ module Kennel
24
20
  def to_json # rubocop:disable Lint/ToJSON
25
21
  raise NotImplementedError, "Use as_json"
26
22
  end
23
+
24
+ private
25
+
26
+ # hook to allow overwriting id generation to remove custom module scopes
27
+ def kennel_id_base
28
+ name = self.class.name
29
+ if name.start_with?("Kennel::") # core objects would always generate the same id
30
+ raise_with_location ArgumentError, "Set :kennel_id"
31
+ end
32
+ name
33
+ end
27
34
  end
28
35
  end
29
36
  end
@@ -111,6 +111,14 @@ module Kennel
111
111
  # Datadog requires only either new_group_delay or new_host_delay, never both
112
112
  options.delete(options[:new_group_delay] ? :new_host_delay : :new_group_delay)
113
113
 
114
+ # Add in statuses where we would re notify on. Possible values: alert, no data, warn
115
+ if options[:renotify_interval] != 0
116
+ statuses = ["alert"]
117
+ statuses << "no data" if options[:notify_no_data]
118
+ statuses << "warn" if options.dig(:thresholds, :warning)
119
+ options[:renotify_statuses] = statuses
120
+ end
121
+
114
122
  validate_json(data) if validate
115
123
 
116
124
  @as_json = data
data/lib/kennel/tasks.rb CHANGED
@@ -165,7 +165,9 @@ namespace :kennel do
165
165
  end
166
166
  api = Kennel.send(:api)
167
167
  list = nil
168
+ first = true
168
169
 
170
+ Kennel.out.puts "["
169
171
  resources.each do |resource|
170
172
  Kennel::Progress.progress("Downloading #{resource}") do
171
173
  list = api.list(resource)
@@ -173,16 +175,22 @@ namespace :kennel do
173
175
  end
174
176
  list.each do |r|
175
177
  r[:api_resource] = resource
176
- Kennel.out.puts JSON.pretty_generate(r)
178
+ if first
179
+ first = false
180
+ else
181
+ Kennel.out.puts ","
182
+ end
183
+ Kennel.out.print JSON.pretty_generate(r)
177
184
  end
178
185
  end
186
+ Kennel.out.puts "\n]"
179
187
  end
180
188
 
181
189
  desc "Find items from dump by pattern DUMP= PATTERN= [URLS=true]"
182
190
  task dump_grep: :environment do
183
191
  file = ENV.fetch("DUMP")
184
192
  pattern = Regexp.new ENV.fetch("PATTERN")
185
- items = File.read(file).gsub("}\n{", "}--SPLIT--{").split("--SPLIT--")
193
+ items = File.read(file)[2..-2].gsub("},\n{", "}--SPLIT--{").split("--SPLIT--")
186
194
  models = Kennel::Models::Record.api_resource_map
187
195
  found = items.grep(pattern)
188
196
  exit 1 if found.empty?
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.107.1"
3
+ VERSION = "1.109.0"
4
4
  end
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.107.1
4
+ version: 1.109.0
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-04-02 00:00:00.000000000 Z
11
+ date: 2022-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday