Skip to content

Commit 7ee5429

Browse files
authored
Merge pull request #8504 from GabrielNagy/PUP-10857-2
(PUP-10857) Correctly retrieve the groups of an user
2 parents 9746d17 + 0631c54 commit 7ee5429

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

acceptance/tests/resource/user/should_manage_groups.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
confine :except, :platform => /eos-/ # See ARISTA-37
99
confine :except, :platform => /cisco_/ # See PUP-5828
1010

11-
tag 'audit:medium',
11+
tag 'audit:high',
1212
'audit:acceptance' # Could be done as integration tests, but would
1313
# require changing the system running the test
1414
# in ways that might require special permissions

lib/puppet/provider/user/useradd.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def comment
7171

7272
def groups
7373
return localgroups if @resource.forcelocal?
74-
get(:groups)
74+
super
7575
end
7676

7777
def finduser(key, value)

spec/unit/provider/user/useradd_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392

393393
it "should fall back to nameservice groups when forcelocal is false" do
394394
resource[:forcelocal] = false
395-
allow(provider).to receive(:get).with(:groups).and_return('remote groups')
395+
allow(Puppet::Util::POSIX).to receive(:groups_of).with('myuser').and_return(['remote groups'])
396396
expect(provider).not_to receive(:localgroups)
397397
expect(provider.groups).to eq('remote groups')
398398
end

0 commit comments

Comments
 (0)