Skip to content

(PUP-3653) Create/set empty Windows groups#3786

Closed
ferventcoder wants to merge 1 commit intopuppetlabs:3.xfrom
ferventcoder:ticket/3.x/PUP-3653-empty-windows-groups
Closed

(PUP-3653) Create/set empty Windows groups#3786
ferventcoder wants to merge 1 commit intopuppetlabs:3.xfrom
ferventcoder:ticket/3.x/PUP-3653-empty-windows-groups

Conversation

@ferventcoder
Copy link
Contributor

Allow setting a Windows group to no users. Previously it was not possible to set
Windows groups with no members due to the way the checking of should versus
current was done. Without this change Puppet will not be able to set Windows
groups to empty lists.

  • group/windows_adsi.members_insync? - Remove the short circuit check on current.empty? versus
    should_empty - this results in incorrect behavior when non-authoritative
  • group/windows_adsi.members_insync? - Return true when non-athoritative and should is empty.
    This prevents a check on keys of an empty hash, which will result in an error.
  • adsi.set_members - return early only if desired_members is nil
  • adsi.set_members - skip adding members when desired_members is empty
  • adsi.set_members - if desired_members is empty, remove all current members

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bumped this up to keep this entire section from running unless inclusive.

@puppetcla
Copy link

CLA signed by all contributors.

@ferventcoder ferventcoder force-pushed the ticket/3.x/PUP-3653-empty-windows-groups branch 2 times, most recently from a0f4935 to da57181 Compare April 3, 2015 17:26
Allow setting a Windows group to no users. Previously it was not possible to set
Windows groups with no members due to the way the checking of should versus
current was done. Without this change Puppet will not be able to set Windows
groups to empty lists.

- `group/windows_adsi.members_insync?` - Remove the short circuit check on `current.empty?` versus
  `should_empty` - this results in incorrect behavior when non-authoritative
- `group/windows_adsi.members_insync?` - Return true when non-athoritative and should is empty.
  This prevents a check on keys of an empty hash, which will result in an error.
- `adsi.set_members` - return early only if `desired_members` is nil
- `adsi.set_members` - skip adding members when `desired_members` is empty
- `adsi.set_members` - if `desired_members` is empty, remove all current members
@ferventcoder ferventcoder force-pushed the ticket/3.x/PUP-3653-empty-windows-groups branch from da57181 to ccb7d25 Compare April 3, 2015 17:27
@ferventcoder ferventcoder changed the title [DO NOT MERGE](WIP)(PUP-3653) Create/set empty Windows groups (PUP-3653) Create/set empty Windows groups Apr 3, 2015
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yanked b/c the check would need to be run only when inclusive and we already have logic that works for this below. If we put this back for any reason, it also has a bug in should_empty set because assignment to logical boolean.

So it would need to come back as
should_empty = should.nil? || should.empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes what was brought in with 455834e

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guy who worked on 455834e is a total 🐒

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha

@Iristyle
Copy link
Contributor

Iristyle commented Apr 7, 2015

Merged to 3.x in 6b8d187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants