fixes brew json parsing

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
This commit is contained in:
Christoph Hartmann 2017-01-03 11:53:08 +01:00 committed by Dominik Richter
parent 74ed60ce5f
commit 08e182843b

View file

@ -143,11 +143,13 @@ module Inspec::Resources
# parse data
pkg = JSON.parse(cmd.stdout)[0]
{
name: pkg.name.to_s,
name: pkg['name'],
installed: true,
version: pkg.installed.version.to_s,
version: pkg['installed'][0]['version'],
type: 'brew',
}
rescue JSON::ParserError => _e
return nil
end
end