Class: Specinfra::HostInventory::Kernel
- Inherits:
-
Base
- Object
- Base
- Specinfra::HostInventory::Kernel
show all
- Defined in:
- lib/specinfra/host_inventory/kernel.rb
Instance Method Summary
collapse
Methods inherited from Base
#backend, #initialize
Instance Method Details
#get ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/specinfra/host_inventory/kernel.rb', line 4
def get
kernel = {}
kernel['machine'] = backend.os_info[:arch]
cmd = backend.command.get(:get_inventory_kernel)
ret = backend.run_command(cmd)
if ret.exit_status == 0
kernel = kernel.merge(parse_uname(ret.stdout))
end
kernel
end
|
#parse_uname(ret) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/specinfra/host_inventory/kernel.rb', line 16
def parse_uname(ret)
match = ret.match(/^(\w+) (((\d+\.\d+)\.\d+).*)$/)
if match
name, release, version, major = match.captures
Hash['name', name, "release", release, "version", version, "version_major", major]
else
nil
end
end
|