onering-report 0.6.10 → 0.6.11

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODk4NDhjZjI3Y2QyZDMzMDcxOTg4MTE4ZjcxMWM5MGNiYzhlNjc3OA==
4
+ YWYxMzU3MDY5YTVmNTVmNzU3MWI5M2NmYzMxNzBiOGRhMzA4YzMyMg==
5
5
  data.tar.gz: !binary |-
6
- M2I4YmIxMmRhZDBjYTBmZTYxNWZmY2VhYzkzNDZhNDkzN2M4NTEwZQ==
6
+ MGI2ODAyZGY5ZWQyNDg0NWFiMTUzMGQxNjUxMDMyNjlmZWE3ZTQyZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTc3NWYwZDhjZTEyYmM1ODE1NzljMTMxNjFmYTQ5YjUxM2RjYzA1OTFlNmQ2
10
- ZGI2N2ExOTBjY2Y2Mzg5MGE4OTlkMWEzMGJlOGFmMjk0NjNkYTA0MGY0MDM3
11
- OGEyZTE3MWVjZTI2ODA3OWVlYWU4ZGU2OTBhNjg2Zjg5NjRhYzU=
9
+ MDU0Y2YwNGJmNTE2MDRiOGE5ZDI1YjgxMDAxZGZhNGVhODYxZGY1MWQ3NDkz
10
+ MzU1Yzc3Nzc1YTA2MzJhMTYyYmJjODkyNWE0YjBjOThlOTEyMmM0NjYxN2Ji
11
+ ODM3YzgxMThhOGQ0MGRlNjMwYzAwZWYwOTExMTM0OTQ5OTMxNzA=
12
12
  data.tar.gz: !binary |-
13
- YWM1MDNiNmI0Yzk4NjRlM2Q4NzA1MjI4OGY5MDk5ZjZmNDUxZTZiYjJmZDg4
14
- NGVjY2ZiZmY0NTRmYWFjNmYwMTQ3MzJjYTllMTdhYWRiMjE3NWUwMzMyMGIx
15
- NDZmNDEzNDI1ODNjNTM3MTI2MDYyYzRiYmE0OGNmNTcwNDA5OWU=
13
+ YjdiNTgzZmQyZDA3NzMwZmFiMzNkZWI0NTQzMWEyMTY1MTk1Mzk0N2YxNDcw
14
+ ZTZhYTVkYjQxMzYxNTYxNzRhYmU1NjU4ZDgxMGFkNDIwODg1MjJlNGQ5ZDY1
15
+ OWU5YWUwNzBkOTBiNmE2YWI0NjU5YzkzYzg1ZDNlZDVlZWM1Zjc=
@@ -1,5 +1,30 @@
1
1
  require 'timeout'
2
2
 
3
+ def count_ipmi_instances(cmd)
4
+ Dir['/proc/[0-9]*/cmdline'].select {|p| File.read(p).include?(cmd)}.count
5
+ end
6
+
7
+ ALLOWED_IPMI = 5
8
+
9
+ def ipmi_ok?
10
+ begin
11
+ ipmi = IPMI_PATH if defined? IPMI_PATH
12
+ ipmi ||= 'ipmiutil'
13
+ if count_ipmi_instances('ipmitool') > ALLOWED_IPMI
14
+ $stderr.puts "More then #{ALLOWED_IPMI} #{ipmi} instances found"
15
+ return false
16
+ end
17
+ Timeout::timeout(30) {
18
+ Facter::Util::Resolution.exec("#{ipmi} health 2> /dev/null | tail -n1 | grep failed").nil?
19
+ }
20
+ return true
21
+ rescue Timeout::Error
22
+ $stderr.puts "timed out while running #{ipmi}"
23
+ false
24
+ end
25
+ end
26
+
27
+
3
28
  Facter.add('site') do
4
29
  setcode do
5
30
  if File.size?('/etc/onering/static/site')
@@ -50,29 +75,6 @@ Facter.add('slot') do
50
75
  end
51
76
  end
52
77
 
53
- def count_ipmi_instances(cmd)
54
- Dir['/proc/[0-9]*/cmdline'].select {|p| File.read(p).include?(cmd)}.count
55
- end
56
-
57
- ALLOWED_IPMI = 5
58
-
59
- def ipmi_ok?
60
- begin
61
- ipmi = IPMI_PATH if defined? IPMI_PATH
62
- ipmi ||= 'ipmiutil'
63
- if count_ipmi_instances('ipmitool') > ALLOWED_IPMI
64
- $stderr.puts "More then #{ALLOWED_IPMI} #{ipmi} instances found"
65
- return false
66
- end
67
- Timeout::timeout(30) {
68
- Facter::Util::Resolution.exec("#{ipmi} health 2> /dev/null | tail -n1 | grep failed").nil?
69
- }
70
- rescue Timeout::Error
71
- $stderr.puts "timed out while running #{ipmi}"
72
- false
73
- end
74
- end
75
-
76
78
  if ipmi_ok?
77
79
  ipmi_lan = Facter::Util::Resolution.exec("ipmitool lan print 1 2> /dev/null")
78
80
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = 'onering-report'
4
- gem.version = '0.6.10'
4
+ gem.version = '0.6.11'
5
5
  gem.authors = ['rnarkis']
6
6
  gem.email = ['rnarkis@outbrain.com']
7
7
  gem.description = %q{Onering facter facts}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onering-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.10
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - rnarkis