14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/dpkginv/base.rb', line 14
def self.inventory
o = Ohai::System.new
o.require_plugin('linux/lsb')
o.require_plugin('linux/hostname')
o.require_plugin('kernel')
o.require_plugin('dpkg')
json = {
:fqdn => o[:fqdn],
:lsb => {
:id => o[:lsb][:id],
:release => o[:lsb][:release],
:codename => o[:lsb][:codename],
:description => o[:lsb][:description]
},
:kernel => {
:release => o[:kernel][:release],
:machine => o[:kernel][:machine]
},
:dpkg => o[:dpkg],
:created_at => Time.now.iso8601
}
config_file = '/etc/dpkginv.conf'
if File.exists?(config_file)
config = YAML.load_file(config_file)
unless config == false || config['system_id'].nil?
json[:system_id] = config['system_id']
end
end
return json
end
|