Issue #11042 has been updated by Josh Cooper. Status changed from Unreviewed to Accepted
Hi Neil, thanks for researching this issue. So from <http://docs.puppetlabs.com/guides/custom_types.html>, "if a resource’s ensure property is out of sync, then no other properties will be checked or modified." This is why the `gid=` method is not getting called. Several providers, including the ldap user provider, handle this as: <pre> def create @property_hash[:ensure] = :present self.class.resource_type.validproperties.each do |property| if val = resource.should(property) @property_hash[property] = val end end end </pre> However, if the property requires special handling, e.g. numeric/string translation, executing separate commands, etc, then it really should be calling the provider's setter method for that property, such as: <pre> gid = @resource[:gid] </pre> Examples of this are in `lib/puppet/provider/group/windows_adsi.rb`, `provider/user/user_role_add.rb` I think this approach is better than overriding the flush method, because explicitly calling the setter methods ensures the state of the resource is internally consistent. If you have the time to make such a change, it'd be greatly appreciated. I also just noticed `lib/puppet/provider/nameservice/directoryservice.rb` handles this by overriding the `ensure=` method and calling `sync` on all of the validproperties for that resource. I suspect that this is an older way of handling the same issue. ---------------------------------------- Bug #11042: Inconsistent translation of group names to numbers when creating users in ldap https://projects.puppetlabs.com/issues/11042 Author: Neil Hemingway Status: Accepted Priority: Normal Assignee: Neil Hemingway Category: LDAP Target version: 2.7.x Affected Puppet version: 2.7.1 Keywords: LDAP provider user group Branch: Puppet::Provider::User::Ldap translates group names to numbers when modifying an existing user (using gid=), but not when creating a new one. I believe this to be because gid= is not called when creating a new user due to the prefetch approach. I have a couple of options for patches both of which seem to achieve the correct result, but (being new to the internals of puppet), I'm not sure whether I've "fixed" the problem in the best place, or whether there is somewhere more appropriate. I've cloned the repo and will be pushing my patches to github under two different branches for you to compare/comment/rip to shreds/suggest improvements etc. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
