diff options
-rw-r--r-- | chef/lib/chef/provider/user/useradd.rb | 6 | ||||
-rw-r--r-- | chef/spec/unit/provider/user/useradd_spec.rb | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chef/lib/chef/provider/user/useradd.rb b/chef/lib/chef/provider/user/useradd.rb index 3903eac203..573da62af1 100644 --- a/chef/lib/chef/provider/user/useradd.rb +++ b/chef/lib/chef/provider/user/useradd.rb @@ -34,8 +34,10 @@ class Chef end def manage_user - command = compile_command("usermod") { |u| u << universal_options } - command << " -m" if managing_home_dir? + command = compile_command("usermod") do |u| + u << " -m" if managing_home_dir? + u << universal_options + end run_command(:command => command) end diff --git a/chef/spec/unit/provider/user/useradd_spec.rb b/chef/spec/unit/provider/user/useradd_spec.rb index 00584d43eb..4af9f740d3 100644 --- a/chef/spec/unit/provider/user/useradd_spec.rb +++ b/chef/spec/unit/provider/user/useradd_spec.rb @@ -199,13 +199,13 @@ describe Chef::Provider::User::Useradd do end it "runs usermod with the computed command options" do - @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -d '/Users/mud' adam -m" }).and_return(true) + @provider.should_receive(:run_command).with({ :command => "usermod -m -g '23' -d '/Users/mud' adam" }).and_return(true) @provider.manage_user end it "does not set the -r option to usermod" do @new_resource.system(true) - @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -d '/Users/mud' adam -m" }).and_return(true) + @provider.should_receive(:run_command).with({ :command => "usermod -m -g '23' -d '/Users/mud' adam" }).and_return(true) @provider.manage_user end |