kennel 1.37.0 → 1.37.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: 0bf1bff85597080daf90caa450fecb57f9ca8341e8614406af63152f6e4df7c2
4
- data.tar.gz: 357fc17fcd3a0dd9dd609882af10cd7aeb5f01be0e55b59a9fc684a42ac9bddd
3
+ metadata.gz: 5a96e8b2291bb1c3d4c1ab62a60fc77615a6b950edde80a44a33163b98cfc52c
4
+ data.tar.gz: e95efb468b68784b0411f9bb773c6ed733219ba74980e5afe9a724c7902193d8
5
5
  SHA512:
6
- metadata.gz: 5b50a7f5530b6db9f3df7f8bc994df714ea54e6f024edde3f5b375dcb0d4930aa7a5ba3034e8031babf59f3c6bbb3afa77b4872cc4073e99f153585c6446f868
7
- data.tar.gz: 393619de9576f30173fd55c9a43bc61d3f71f1785f098a76812b7c0497e8ffebccb24dc6eae46ddcb0635daf2401e746898c07df188c70085abc3e80ca66ed49
6
+ metadata.gz: 534e2b021f1e88000e08a514339e02540686031aa7b91d6624f195d5f6adc28f88939c39894ce9276187619c728ecc3d1775638c03eb06f9011c8392db8050df
7
+ data.tar.gz: 4ec6f62c45ab64bb111cee7302cd2f6c08ea5fdfcb24204af0ecbde0fe9485bb554fb89b609bfb5f779b028c9189bd4c85638d487f77c071e803a0d7084ab444
@@ -69,31 +69,32 @@ module Kennel
69
69
  escalation_message: Utils.presence(escalation_message.strip),
70
70
  evaluation_delay: evaluation_delay,
71
71
  locked: false, # setting this to true prevents any edit and breaks updates when using replace workflow
72
- renotify_interval: renotify_interval || 0,
73
- thresholds: {}
72
+ renotify_interval: renotify_interval || 0
74
73
  }
75
74
  }
76
75
 
77
76
  options = data[:options]
78
- thresholds = options[:thresholds]
79
- thresholds[:critical] = critical unless type == "composite"
77
+ if data.fetch(:type) != "composite"
78
+ thresholds = (options[:thresholds] = { critical: critical })
80
79
 
81
- data[:id] = id if id
80
+ data[:id] = id if id
82
81
 
83
- # warning, ok, critical_recovery, and warning_recovery are optional
84
- [:warning, :ok, :critical_recovery, :warning_recovery].each do |key|
85
- if value = send(key)
86
- thresholds[key] = value
82
+ # warning, ok, critical_recovery, and warning_recovery are optional
83
+ [:warning, :ok, :critical_recovery, :warning_recovery].each do |key|
84
+ if value = send(key)
85
+ thresholds[key] = value
86
+ end
87
87
  end
88
- end
89
88
 
90
- case data.fetch(:type)
91
- when "service check"
92
- # avoid diff for default values of 1
93
- OPTIONAL_SERVICE_CHECK_THRESHOLDS.each { |t| thresholds[t] ||= 1 }
94
- when "query alert"
95
- # metric and query values are stored as float by datadog
96
- thresholds.each { |k, v| thresholds[k] = Float(v) }
89
+ thresholds[:critical] = critical unless
90
+ case data.fetch(:type)
91
+ when "service check"
92
+ # avoid diff for default values of 1
93
+ OPTIONAL_SERVICE_CHECK_THRESHOLDS.each { |t| thresholds[t] ||= 1 }
94
+ when "query alert"
95
+ # metric and query values are stored as float by datadog
96
+ thresholds.each { |k, v| thresholds[k] = Float(v) }
97
+ end
97
98
  end
98
99
 
99
100
  if windows = threshold_windows
@@ -166,7 +167,7 @@ module Kennel
166
167
  end
167
168
 
168
169
  # verify query includes critical value
169
- if query_value = data.fetch(:query)[/\s*[<>]\s*(\d+(\.\d+)?)\s*$/, 1]
170
+ if query_value = data.fetch(:query)[/\s*[<>]=?\s*(\d+(\.\d+)?)\s*$/, 1]
170
171
  if Float(query_value) != Float(data.dig(:options, :thresholds, :critical))
171
172
  invalid! "critical and value used in query must match"
172
173
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.37.0"
3
+ VERSION = "1.37.1"
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.37.0
4
+ version: 1.37.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: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2019-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday