nagios-promoo 1.7.0 → 1.7.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
  SHA1:
3
- metadata.gz: 776caf450626d472aa75ddd72a1cb24ed231b858
4
- data.tar.gz: c1833207e57564af55bd7363f7ab0e19872a269a
3
+ metadata.gz: cc2cd6e6e2a3d9a76c0172908761abaea1ee0048
4
+ data.tar.gz: 68593940462b359328c6987d9ea9bc30bfe48889
5
5
  SHA512:
6
- metadata.gz: 62f74f848f0de94c5f2b3c78477a0b5fc153c59ed0f8688daee0dc5ea66c307f7e9fc9eb3e4cb3492502d5f1dba011a5ecc58e588b4fbf9db10b9c81769dedd7
7
- data.tar.gz: 340a9af73318b73f8c61ee64ca1d0a1fdd4bff45ba58d80eac594273aa635059bb52665a377ed9290c2132d6be0307c1a045d1041215d419ca8191df332170df
6
+ metadata.gz: 07f8e8873d47018aa85c6ba1b128e0f087eba95a1d744237f0981fca96a013cd054bdcffa52d9df268c4a38dc2f65b457bef070ec5ee2943485a282f24ecc75d
7
+ data.tar.gz: 1a7498d407f73530ca96d68630c0c48727f5c160f2c74fcc8f1230b4411bae1aca3f805cd66a0199b661f936c73295f835e7a8745246da2e331b234c0a04a2e9
data/History.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 1.7.1 / 2017-11-25
3
+ ==================
4
+
5
+ * Fixed endpoint matching (no normalization)
6
+
2
7
  1.7.0 / 2017-11-24
3
8
  ==================
4
9
 
@@ -37,13 +37,13 @@ module Nagios
37
37
  end
38
38
 
39
39
  def run(_args = [])
40
- count = Timeout.timeout(options[:timeout]) { appliances_by_endpoint(options[:vo]).count }
40
+ count = Timeout.timeout(options[:timeout]) { appliances_by_endpoint.count }
41
41
  if count < 1
42
- puts "APPLIANCES CRITICAL - No appliances found for VO #{options[:vo]} in AppDB"
42
+ puts "APPLIANCES CRITICAL - No appliances found for VO #{vo} in AppDB"
43
43
  exit 2
44
44
  end
45
45
 
46
- puts "APPLIANCES OK - Found #{count} appliances for VO #{options[:vo]} in AppDB"
46
+ puts "APPLIANCES OK - Found #{count} appliances for VO #{vo} in AppDB"
47
47
  rescue => ex
48
48
  puts "APPLIANCES UNKNOWN - #{ex.message}"
49
49
  puts ex.backtrace if options[:debug]
@@ -33,15 +33,17 @@ module Nagios
33
33
  }
34
34
  |.freeze
35
35
 
36
- attr_reader :options, :endpoint
36
+ attr_reader :options, :endpoint, :vo
37
37
 
38
38
  def initialize(options)
39
39
  @options = options
40
- @endpoint = options[:endpoint].gsub(%r{/+$}, '')
40
+ @endpoint = options.fetch(:endpoint)
41
+ @vo = options.fetch(:vo, nil)
41
42
  end
42
43
 
43
44
  def sizes_by_endpoint
44
45
  return @_sizes if @_sizes
46
+ raise '`endpoint` is a mandatory argument' if endpoint.blank?
45
47
 
46
48
  query = GQL_SIZES_BY_ENDPOINT.gsub('$$ENDPOINT$$', endpoint)
47
49
  @_sizes = make(query)['data']['siteServiceTemplates']['items']
@@ -50,8 +52,9 @@ module Nagios
50
52
  @_sizes
51
53
  end
52
54
 
53
- def appliances_by_endpoint(vo)
55
+ def appliances_by_endpoint
54
56
  return @_appliances if @_appliances
57
+ raise '`endpoint` and `vo` are mandatory arguments' if endpoint.blank? || vo.blank?
55
58
 
56
59
  query = GQL_APPLIANCES_BY_ENDPOINT.gsub('$$ENDPOINT$$', endpoint).gsub('$$VO$$', vo)
57
60
  @_appliances = make(query)['data']['siteServiceImages']['items']
@@ -76,20 +76,20 @@ module Nagios
76
76
  if wrong.any?
77
77
  if (@_last_update + options[:critical_after].hours) < Time.now
78
78
  puts "SYNC CRITICAL - Appliance(s) #{wrong.inspect} missing " \
79
- "or outdated in #{options[:vo].inspect} " \
79
+ "or outdated in #{vo.inspect} " \
80
80
  "more than #{options[:critical_after]} hours after list publication [#{@_last_update}]"
81
81
  exit 2
82
82
  end
83
83
 
84
84
  if (@_last_update + options[:warning_after].hours) < Time.now
85
85
  puts "SYNC WARNING - Appliance(s) #{wrong.inspect} missing " \
86
- "or outdated in #{options[:vo].inspect} " \
86
+ "or outdated in #{vo.inspect} " \
87
87
  "more than #{options[:warning_after]} hours after list publication [#{@_last_update}]"
88
88
  exit 1
89
89
  end
90
90
  end
91
91
 
92
- puts "SYNC OK - All appliances registered in #{options[:vo].inspect} " \
92
+ puts "SYNC OK - All appliances registered in #{vo.inspect} " \
93
93
  "are available [#{@_results[:expected].count}]"
94
94
  rescue => ex
95
95
  puts "SYNC UNKNOWN - #{ex.message}"
@@ -104,7 +104,7 @@ module Nagios
104
104
  mpuri_versionless = versionless_mpuri(hv_image['ad:mpuri'])
105
105
  @_results[:expected] << mpuri_versionless
106
106
 
107
- matching = appliances_by_endpoint(options[:vo]).detect do |appl|
107
+ matching = appliances_by_endpoint.detect do |appl|
108
108
  versionless_mpuri(appl['applicationEnvironmentRepository']) == mpuri_versionless
109
109
  end
110
110
 
@@ -152,7 +152,7 @@ module Nagios
152
152
  end
153
153
 
154
154
  def list_url
155
- IMAGE_LIST_TEMPLATE.gsub('$$TOKEN$$', options[:token]).gsub('$$VO$$', options[:vo])
155
+ IMAGE_LIST_TEMPLATE.gsub('$$TOKEN$$', options[:token]).gsub('$$VO$$', vo)
156
156
  end
157
157
 
158
158
  def normalize_mpuri(mpuri)
@@ -1,7 +1,7 @@
1
1
  module Nagios
2
2
  module Promoo
3
3
  module Appdb
4
- VERSION = '1.3.0'.freeze
4
+ VERSION = '1.3.1'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Nagios
2
2
  module Promoo
3
- VERSION = '1.7.0'.freeze
3
+ VERSION = '1.7.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagios-promoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport