Bug #2360
Using an empty array for roles causes constant nagging
| Status: | Closed | Start date: | 06/24/2009 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | user | |||
| Target version: | 0.25.0 | |||
| Affected Puppet version: | 0.25.0rc1 | Branch: | ||
| Keywords: | ||||
| Votes: | 1 |
Description
If you define a user with an empty role list ([]), puppet will always generate a notice: notice: //Node[lab-thumper1.sfbay.sun.com]/martin/User[martin]/roles: defined ‘roles’ as ‘’ which gets really annoying in the long run :)
History
Updated by James Turnbull almost 3 years ago
- Category set to user
- Status changed from Unreviewed to Accepted
Updated by Luke Kanies almost 3 years ago
- Assignee set to Andrew Shafer
Updated by Andrew Shafer almost 3 years ago
Martin,
Why not just not mention roles if you don’t want any… :/ If you put [], what is the desired behavior? If I treat it like absent, it will obliterate existing roles. Do you think the best behavior is to honor the membership setting?
I’ll have a patch pretty quick once I have desired behavior defined.
Updated by Martin Englund almost 3 years ago
The reason I use “[]” is that I want to make sure the user doesn’t have any roles at all, i.e. remove existing ones.
I think I see your point, i.e. the default is an empty set, which will always obliterate existing roles. But if you only do it when
role_membership => inclusive
is used, it should be ok, as “minimum” is the default. Right? :)
Updated by Luke Kanies almost 3 years ago
This is an easy fix – just munge the ‘should=’ method in the role parameter to treat an empty array as ‘[:absent]’.
Updated by Andrew Shafer almost 3 years ago
It’s slightly more complicated because it is inheriting from a List property and has the concept of ‘membership’.
Martin,
Can you confirm that [] will actually get rid of roles that you don’t want? Looking at the code, I believe it will not unless you set the membership to inclusive. That also seems like the proper behavior, it should only remove roles when membership is inclusive.
What behavior do you get when you specify [:absent]?
I’ll get my Solaris VMs warmed up. I think there is definitely a subtle bug/missed scope. I’ll fix it this weekend once we agree on the proper behavior.
Updated by Martin Englund almost 3 years ago
Yes, using:
roles => [], role_membership => inclusive
removes all roles for that user – which is the behavior I want, I just want to get rid of the message it displays when the role list already is empty:
notice: ... defined 'roles' as ''
Since it will be reported over and over again every 30 minutes.
This fix should also be applied to authorizations & profiles
Updated by Andrew Shafer almost 3 years ago
- Status changed from Accepted to Ready For Checkin
- Assignee changed from Andrew Shafer to James Turnbull
- Affected Puppet version changed from 0.24.8 to 0.25.0rc1
Fairly simple patch change made makes insync? in list.rb true for [] (went down path to add :absent semantics to should, and it lead to changes in the type, useradd and user_role_add providers and objectadd, which seemed like more trouble than benefit.)
Patch submitted to devlist and available on my github (littleidea) on branch ticket/0.25/2360
http://github.com/littleidea/puppet/tree/ticket/0.25/2360
Updated by Luke Kanies almost 3 years ago
- Status changed from Ready For Checkin to Tests Insufficient
- Assignee changed from James Turnbull to Andrew Shafer
- Target version set to 0.25.0
If you can get the minor edits recommended from the list in and we can get one or two testers, then this should make it into 0.25.
Updated by Andrew Shafer almost 3 years ago
- Status changed from Tests Insufficient to Ready For Checkin
- Assignee changed from Andrew Shafer to Luke Kanies
Changed some of the commit message and tests
current at tickets/master/2360
Updated by Martin Englund almost 3 years ago
I’ve just tested the fix and it works as expected:
- when membership is “inclusive” everything is cleared on the first run and sequent runs are silent
- when membership is “minimum” it leaves the current values alone
Updated by Andrew Shafer almost 3 years ago
- Assignee changed from Luke Kanies to James Turnbull
Tested by Martin
+1’d on dev list tickets/master/2360
All systems go
Updated by James Turnbull almost 3 years ago
- Status changed from Ready For Checkin to Closed
Pushed in commit:c129f2a15fdccc12baa3d929531221cbade7ff10 in branch master.