Please review pull request #773: (#14454) useradd doesn't work if nss groups use more than just "files" for the data source. opened by (joejulian)
Description:
The nsslib function, getgrent returns the combined list including
groups that useradd cannot manage, including duplicates, if any.
The duplicate groups were causing the User resource to try to correct the
groups every time. useradd was incorrectly invalidating groupnames with spaces,
which getgrent returns.
This allows useradd to run successfully. If the specified groups exist in the
file data source, the user will be added. If they're in another data source,
useradd will complete without error, but won't alter those memberships.
Bug: 14454
Signed-off-by: Joe Julian [email protected]
- Opened: Mon May 14 19:48:58 UTC 2012
- Based on: puppetlabs:master (639f995c91289b3be9ca5347865247907c7dcb5c)
- Requested merge: joejulian:master (4c84cc054afb3e0b4cd226e881564114030029a0)
Diff follows:
diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb
index 693a422..9e10c5c 100644
--- a/lib/puppet/provider/nameservice.rb
+++ b/lib/puppet/provider/nameservice.rb
@@ -242,7 +242,7 @@ def groups
# reading of the file.
Etc.endgrent
- groups.join(",")
+ groups.uniq.join(",")
end
# Convert the Etc struct into a hash.
diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb
index e374905..3ab4b4f 100644
--- a/lib/puppet/provider/user/useradd.rb
+++ b/lib/puppet/provider/user/useradd.rb
@@ -17,10 +17,6 @@
value.is_a? Integer
end
- verify :groups, "Groups must be comma-separated" do |value|
- value !~ /\s/
- end
-
has_features :manages_homedir, :allows_duplicates, :manages_expiry, :system_users
has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow?
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" 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-dev?hl=en.
