kennel 1.6.0 → 1.7.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: 63bd43d9372d2d92f5123b896583d212f8c30902878a182765610ab0012016fc
4
- data.tar.gz: 438a19088b46d37e5738702868373abba331cdf44459841bd07443724cb10416
3
+ metadata.gz: 3b10b16c02058b7b1ad4f44992cf5f996be952d9d38a6d17ecbae4d728c78948
4
+ data.tar.gz: 2ec630b10f6efc6e1ae04fa8844198105f6446cbd542c8dfdd5302c7a18de354
5
5
  SHA512:
6
- metadata.gz: 766bdb5f1370bf27a0f560521df0da7c9589b904820676e81f5e4f12f9671baa4719fd0c44aac92df100db0bca59165d11acbcc6a3687c824307a62fbbf198f4
7
- data.tar.gz: '07806de1603fadb136e81b5226f006e6efcdc429876b859717b48761dc64d03ed1b1a82447650efa081c114bb2940881d04b97453b69a664831d07faec8745f4'
6
+ metadata.gz: 1127d43e65c93542fea552a8bb682b86da4dccda055d1a3f6123d2a3d5996d5b34617c4940bf797b448f4396392e1813a937de01ad5967a60991ab62cefcc704
7
+ data.tar.gz: 1c5e5f78cdae0f91d6a2d7f7241bf2a8dc90c7b499bba091c9d8d27225314779550c625cb299ff0109fbfd8894ccdf527e904a3a335d0d8d4b9958f4993d2d31
@@ -50,9 +50,11 @@ module Kennel
50
50
  actual[:template_variables] ||= []
51
51
  actual[:graphs].each do |g|
52
52
  g[:definition].delete(:status)
53
- g[:definition][:requests].each { |r| r.delete(:aggregator) }
54
53
  end
55
- super
54
+
55
+ # NOTE: we might not trigger an update since the api never returns aggregator ... maybe datadog fixes their api
56
+ # as temporary workaround change something else about the dash to force an update
57
+ Utils.presence(super&.reject { |op, key| op == "+" && key.end_with?(".aggregator") })
56
58
  end
57
59
 
58
60
  def url(id)
@@ -62,12 +64,20 @@ module Kennel
62
64
  private
63
65
 
64
66
  def validate_json(data)
67
+ # check for bad variables
65
68
  variables = data.fetch(:template_variables).map { |v| "$#{v.fetch(:name)}" }
66
69
  queries = data[:graphs].flat_map { |g| g[:definition][:requests].map { |r| r.fetch(:q) } }
67
70
  bad = queries.grep_v(/(#{variables.map { |v| Regexp.escape(v) }.join("|")})\b/)
68
71
  if bad.any?
69
72
  raise "#{tracking_id} queries #{bad.join(", ")} must use the template variables #{variables.join(", ")}"
70
73
  end
74
+
75
+ # check for fields that are unsettable
76
+ data[:graphs].each do |g|
77
+ if g.dig(:definition, :status)
78
+ raise "#{tracking_id} remove definition status, it is unsettable and will always produce a diff"
79
+ end
80
+ end
71
81
  end
72
82
 
73
83
  def render_template_variables
@@ -52,7 +52,13 @@ module Kennel
52
52
  actual.delete(:height)
53
53
  actual.delete(:width)
54
54
  actual[:template_variables] ||= []
55
- (actual[:widgets] || []).each { |w| w.delete :board_id }
55
+ (actual[:widgets] || []).each do |w|
56
+ # api randomly returns time.live_span or timeframe
57
+ w[:timeframe] = w.delete(:time)[:live_span] if w[:time]
58
+
59
+ # board_id is a copied value, can ignore
60
+ w.delete :board_id
61
+ end
56
62
  super
57
63
  end
58
64
 
data/lib/kennel/utils.rb CHANGED
@@ -20,7 +20,7 @@ module Kennel
20
20
  end
21
21
 
22
22
  def presence(value)
23
- value.empty? ? nil : value
23
+ value.nil? || value.empty? ? nil : value
24
24
  end
25
25
 
26
26
  def ask(question)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.6.0"
3
+ VERSION = "1.7.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.6.0
4
+ version: 1.7.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: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday