onering-report-plugins 0.0.22 → 0.0.23
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.
@@ -46,11 +46,22 @@ end
|
|
46
46
|
|
47
47
|
Facter.add('hardwareid') do
|
48
48
|
setcode do
|
49
|
+
# 1. contents of /etc/hardware.id takes absolute precedence
|
49
50
|
if File.size?('/etc/hardware.id')
|
50
51
|
File.read('/etc/hardware.id').strip.chomp rescue nil
|
52
|
+
|
53
|
+
# 2. value of kernel boot argument 'hardwareid' is checked
|
54
|
+
elsif Facter.value('kernelarguments').is_a?(Hash) and not Facter.value('kernelarguments')['hardwareid'].nil?
|
55
|
+
Facter.value('kernelarguments')['hardwareid']
|
56
|
+
|
57
|
+
# 3. calculate a new hardwareid from the system signature
|
51
58
|
elsif Facter.value('signature')
|
52
59
|
require 'digest'
|
53
60
|
Digest::SHA256.new.update(Facter.value('signature')).hexdigest[0..5]
|
61
|
+
|
62
|
+
# 4. i got nothing...
|
63
|
+
else
|
64
|
+
nil
|
54
65
|
end
|
55
66
|
end
|
56
67
|
end
|
@@ -3,3 +3,16 @@ Facter.add('boottime') do
|
|
3
3
|
Time.at(Time.now.to_i - Facter.value('uptime_seconds').to_i)
|
4
4
|
end
|
5
5
|
end
|
6
|
+
|
7
|
+
Facter.add('kernelarguments') do
|
8
|
+
setcode do
|
9
|
+
if File.readable?('/proc/cmdline')
|
10
|
+
Hash[File.read('/proc/cmdline').split(' ').collect{|i|
|
11
|
+
key, value = i.split('=', 2)
|
12
|
+
[key, value]
|
13
|
+
}]
|
14
|
+
else
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|