Class: Specinfra::HostInventory::User
- Inherits:
-
Base
- Object
- Base
- Specinfra::HostInventory::User
show all
- Defined in:
- lib/specinfra/host_inventory/user.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
|
# File 'lib/specinfra/host_inventory/user.rb', line 4
def get
cmd = backend.command.get(:get_inventory_user)
ret = backend.run_command(cmd)
if ret.exit_status == 0
parse(ret.stdout)
else
nil
end
end
|
#parse(cmd_ret) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/specinfra/host_inventory/user.rb', line 14
def parse(cmd_ret)
users = {}
lines = cmd_ret.split(/\n/)
lines.each do |line|
user = line.split(':')
users[user[0]] = {
'name' => user[0],
'uid' => user[2],
'gid' => user[3],
'gecos' => user[4],
'directory' => user[5],
'shell' => user[6]
}
end
users
end
|