Skip to content

(#9459) Fix problems with Windows 'user' and 'group' providers.#116

Closed
ChaseMotorman wants to merge 1 commit intopuppetlabs:2.7.xfrom
ChaseMotorman:ticket/2.7.x/9459-user-group-failures
Closed

(#9459) Fix problems with Windows 'user' and 'group' providers.#116
ChaseMotorman wants to merge 1 commit intopuppetlabs:2.7.xfrom
ChaseMotorman:ticket/2.7.x/9459-user-group-failures

Conversation

@ChaseMotorman
Copy link
Copy Markdown
Contributor

This commit corrects several problems with the Windows 'user' and
'group' providers, and Puppet::Util::ADSI helper class.

The 'user' provider failed to add the username to the set of groups
specified in the 'groups' property when creating a new user, due to
the provider trying to enumerate a user's group membership before the
underlying ADSI user object was saved. Any group referenced in the
property must exist prior to creating the resource.

The 'group' provider failed to save a newly-created resource,
due to a missing 'flush' method, which in turn calls the
'Puppet::Util::ADSI.commit' (save) method.

Windows does not allow user and groups to share the same name,
and when attempted the ADSI connection would throw a misleading
exception referring to an 'invalid moniker'. The 'user' provider will
now raise an error if it attempts to create a resource when a like-named
group already exists, and vice-versa.

This commit corrects several problems with the Windows 'user' and
'group' providers, Puppet::Util::ADSI helper class.

The 'user' provider failed to add the username to the set of groups
specified in the 'groups' property when creating a new user, due to
the provider trying to enumerate a user's group membership before the
underlying ADSI user object was saved. Any group referenced in the
property must exist prior to creating the resource.

The 'group' provider failed to save a newly-created resource,
due to a missing 'flush' method, which in turn calls the
'Puppet::Util::ADSI.commit' (save) method.

Windows does not allow user and groups to share the same name,
and when attempted the ADSI connection would throw a misleading
exception referring to an 'invalid moniker'. The 'user' provider will
now raise an error if it attempts to create a resource when a like-named
group already exists, and vice-versa.

Spec tests were updated to reflect code changes.
@joshcooper
Copy link
Copy Markdown
Contributor

I've created a new pull request that adds back the rescue nil block. #141 That code is necessary because the user's groups method can be invoked in order to determine if the user currently belongs to any groups, and depending on the membership property, whether the user should be removed from those groups. We also figured out the failure was due to some old code in the site ruby directory.

@joshcooper joshcooper closed this Sep 28, 2011
hlindberg pushed a commit to hlindberg/puppet that referenced this pull request Oct 16, 2014
404 Cleanups and New 404 Page
melissa pushed a commit to melissa/puppet that referenced this pull request Mar 30, 2018
(PCP-49) Removing PIDFile lock functionality temporarily
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.

2 participants