diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/mixin/shell_out.rb | 9 | ||||
-rw-r--r-- | lib/chef/provider/group/groupadd.rb | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb index cc2bf085e9..d341e3d1ec 100644 --- a/lib/chef/mixin/shell_out.rb +++ b/lib/chef/mixin/shell_out.rb @@ -85,6 +85,7 @@ class Chef # @param args [String] variable number of string arguments # @return [String] nicely concatenated string or empty string def a_to_s(*args) + # FIXME: this should be cleaned up and deprecated clean_array(*args).join(" ") end @@ -108,6 +109,14 @@ class Chef args.flatten.reject { |i| i.nil? || i == "" }.map(&:to_s) end + def shell_out_compact(*args) + shell_out(*clean_array(*args)) + end + + def shell_out_compact!(*args) + shell_out!(*clean_array(*args)) + end + private def shell_out_command(*command_args) diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb index 162875f9f1..d7a41fb4a7 100644 --- a/lib/chef/provider/group/groupadd.rb +++ b/lib/chef/provider/group/groupadd.rb @@ -47,7 +47,7 @@ class Chef command = "groupadd" command << set_options command << groupadd_options - run_command(:command => command) + shell_out_compact!("groupadd", set_options, groupadd_options) modify_group_members end @@ -55,13 +55,13 @@ class Chef def manage_group command = "groupmod" command << set_options - run_command(:command => command) + shell_out_compact!("groupmod", set_options) modify_group_members end # Remove the group def remove_group - run_command(:command => "groupdel #{@new_resource.group_name}") + shell_out!("groupdel", new_resource.group_name) end def modify_group_members |