mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Fix for default null values compatible for both windows and non-windows system
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
457e544724
commit
7693363a1a
2 changed files with 6 additions and 2 deletions
|
@ -118,7 +118,7 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def members
|
||||
flatten_entry(group_info, "members") || []
|
||||
flatten_entry(group_info, "members") || empty_value_for_members
|
||||
end
|
||||
|
||||
def members_array
|
||||
|
@ -152,6 +152,10 @@ module Inspec::Resources
|
|||
group = @group.dup
|
||||
@groups_cache ||= inspec.groups.where { name == group }
|
||||
end
|
||||
|
||||
def empty_value_for_members
|
||||
inspec.os.windows? ? [] : ""
|
||||
end
|
||||
end
|
||||
|
||||
class GroupInfo
|
||||
|
|
|
@ -108,6 +108,6 @@ describe "Inspec::Resources::Group" do
|
|||
it "verify non-existent group member on centos" do
|
||||
resource = MockLoader.new(:centos7).load_resource("group", "root")
|
||||
_(resource.exists?).must_equal true
|
||||
_(resource.members).must_equal []
|
||||
_(resource.members).must_equal ""
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue