mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
bugfix: do manual split of id result because we cannot use whitespace
This commit is contained in:
parent
5dfee32bde
commit
0bd7f557d5
1 changed files with 9 additions and 2 deletions
|
@ -193,10 +193,17 @@ class UnixUser < UserInfo
|
|||
cmd = inspec.command("id #{username}")
|
||||
return nil if cmd.exit_status != 0
|
||||
|
||||
raw = cmd.stdout.chomp
|
||||
data = []
|
||||
until (index = raw.index(/\)\s{1}/)) == nil do
|
||||
data.push(raw[0,index+1]) # inclue closing )
|
||||
raw = raw[index+2,raw.length-index-2]
|
||||
end
|
||||
data.push(raw) if !raw.nil?
|
||||
|
||||
# parse words
|
||||
params = SimpleConfig.new(
|
||||
cmd.stdout.chomp,
|
||||
line_separator: ' ',
|
||||
data.join("\n"),
|
||||
assignment_re: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
|
||||
group_re: nil,
|
||||
multiple_values: false,
|
||||
|
|
Loading…
Reference in a new issue