Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Unknown
-
Resolution: Fixed
-
Affects Version/s: 0.10.10
-
Fix Version/s: 0.10.10
-
Component/s: Chef Solo
-
Labels:
-
Environment:
- uname -a
Linux text-12 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux - chef-solo -v
Chef: 0.10.10.rc.3
- uname -a
Description
The following recipe:
user node[:redis][:user] do
system true
shell "/bin/false"
end
Produces this error:
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: Chef::Exceptions::Exec: user[redis] (redis::default line 5) had an error: Chef::Exceptions::Exec: useradd -s '/bin/false' -d '' -r redis returned 3, expected 0
---- Begin output of useradd -s '/bin/false' -d '' -r redis ----
STDOUT: STDERR: useradd: invalid home directory ''
---- End output of useradd -s '/bin/false' -d '' -r redis ----
I'm still digging but seems to stem from one of the following commits:
using Pathname#cleanpath on paths before comparing them
https://github.com/opscode/chef/commit/530d8305dddfa2b4d39046fd88bd27ccacc4ec5d#chef/lib/chef/provider/user/useradd.rb
or
CHEF-3076: do not clear path when @current_user does not have #home
https://github.com/opscode/chef/commit/5255a4611baa8cd605a600db28368de85e6aaebd#chef/lib/chef/provider/user/useradd.rb
in 0.10.8 the method looked like this and things were working as expected:
def updating_home?
@current_resource.home != @new_resource.home && @new_resource.home
end
Just some more of the debug level out put:
[Fri, 04 May 2012 13:55:13 +0000] INFO: Processing user[redis] action create (redis::default line 5)
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: user[redis] user does not exist
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: user[redis] setting shell to /bin/false
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: user[redis] setting home to
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: Executing useradd -s '/bin/false' -d '' -r redis
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: ---- Begin output of useradd -s '/bin/false' -d '' -r redis ----
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: STDOUT:
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: STDERR: useradd: invalid home directory ''
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: ---- End output of useradd -s '/bin/false' -d '' -r redis ----
[Fri, 04 May 2012 13:55:13 +0000] DEBUG: Ran useradd -s '/bin/false' -d '' -r redis returned 3
[Fri, 04 May 2012 13:55:13 +0000] ERROR: user[redis] (redis::default line 5) has had an error
[Fri, 04 May 2012 13:55:13 +0000] ERROR: user[redis] (/var/chef/cookbooks/redis/recipes/default.rb:5:in `from_file') had an error:
user[redis] (redis::default line 5) had an error: Chef::Exceptions::Exec: useradd -s '/bin/false' -d '' -r redis returned 3, expected 0
---- Begin output of useradd -s '/bin/false' -d '' -r redis ----
STDOUT: STDERR: useradd: invalid home directory ''
---- End output of useradd -s '/bin/false' -d '' -r redis ----