Please review pull request #585: 2.7.x - fix for password setting on AIX user provider opened by (andytinycat)
Description:
The user provider on AIX fails to set the password for local users
using chpasswd.
This commit includes the code in ticket #11200 suggested by Josh
Cooper. It works in my environment (AIX 5.3 + 6.1).
chpasswd can also return 1 even on success; it's not clear if this is
by design, as the manpage doesn't mention it. The lack of output from
chpasswd indicates success; if there's a problem it dumps output to
stderr/stdout.
- Opened: Sat Mar 17 00:37:45 UTC 2012
- Based on: puppetlabs:2.7.x (75476e1ae2b3440af423d52869a9ff9e6a9637ea)
- Requested merge: andytinycat:2.7.x (06eb9a9bdba5e814a847488e4e8a2c9d6fa16135)
Diff follows:
diff --git a/lib/puppet/provider/user/aix.rb b/lib/puppet/provider/user/aix.rb
index ce0b8a3..6c9679d 100755
--- a/lib/puppet/provider/user/aix.rb
+++ b/lib/puppet/provider/user/aix.rb
@@ -253,12 +253,16 @@ def password=(value)
tmpfile.close()
# Options '-e', '-c', use encrypted password and clear flags
- # Must receibe "user:enc_password" as input
+ # Must receive "user:enc_password" as input
# command, arguments = {:failonfail => true, :combine => true}
- cmd = [self.class.command(:chpasswd),"-R", self.class.ia_module,
- '-e', '-c', user]
+ # Fix for bugs #11200 and #10915
+ cmd = [self.class.command(:chpasswd), get_ia_module_args, '-e', '-c', user].flatten
begin
- execute(cmd, {:failonfail => true, :combine => true, :stdinfile => tmpfile.path })
+ output = execute(cmd, {:failonfail => false, :combine => true, :stdinfile => tmpfile.path })
+ # chpasswd can return 1, even on success (at least on AIX 6.1); empty output indicates success
+ if output != ""
+ raise Puppet::ExecutionFailure, "chpasswd said #{output}"
+ end
rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Could not set #{param} on #{@resource.class.name}[#{@resource.name}]: #{detail}"
ensure
-- 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.
