mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
Resolve case sensitivity issues with group name in group resource for windows platform
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
3f7d40318b
commit
964fdacbee
2 changed files with 12 additions and 1 deletions
|
@ -150,7 +150,11 @@ module Inspec::Resources
|
|||
def group_info
|
||||
# we need a local copy for the block
|
||||
group = @group.dup
|
||||
@groups_cache ||= inspec.groups.where { name == group }
|
||||
if inspec.os.windows?
|
||||
@groups_cache ||= inspec.groups.where { name.casecmp?(group) }
|
||||
else
|
||||
@groups_cache ||= inspec.groups.where { name == group }
|
||||
end
|
||||
end
|
||||
|
||||
def empty_value_for_members
|
||||
|
|
|
@ -66,6 +66,13 @@ describe "Inspec::Resources::Group" do
|
|||
_(resource.members).must_equal ["Administrators", "Domain Admins"]
|
||||
end
|
||||
|
||||
it "verify administrator group with case insensitivity handling on windows" do
|
||||
resource = MockLoader.new(:windows).load_resource("group", "administrators")
|
||||
_(resource.exists?).must_equal true
|
||||
_(resource.gid).must_equal "S-1-5-32-544"
|
||||
_(resource.members).must_equal ["Administrators", "Domain Admins"]
|
||||
end
|
||||
|
||||
it "verify power users group on windows" do
|
||||
resource = MockLoader.new(:windows).load_resource("group", "Power Users")
|
||||
_(resource.exists?).must_equal true
|
||||
|
|
Loading…
Reference in a new issue