summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-28 15:04:33 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-28 18:37:31 -0700
commitef708183e6df8e325c98b4aa247e47200684fc38 (patch)
tree8eeea5d3ddbe1d78f67b0964eb79aac075836db9
parent3d824fa3c70bf72555946d4697410f216b5ef11e (diff)
downloadchef-ef708183e6df8e325c98b4aa247e47200684fc38.tar.gz
Fix freebsd group provider regression introduced by b06510323102fcb35fb7b02891591b3a540ddf27 when there is no members while creating the group.
-rw-r--r--lib/chef/provider/group/pw.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb
index c39c20da67..048ba60bf6 100644
--- a/lib/chef/provider/group/pw.rb
+++ b/lib/chef/provider/group/pw.rb
@@ -40,19 +40,19 @@ class Chef
command = "pw groupadd"
command << set_options
- # pw group[add|mod] -M is used to set the full membership list on a
- # new or existing group. Because pw groupadd does not support the -m
- # and -d options used by manage_group, we treat group creation as a
- # special case and use -M.
- Chef::Log.debug("#{@new_resource} setting group members: #{@new_resource.members.join(',')}")
- member_options = [" -M #{@new_resource.members.join(',')}"]
+ unless @new_resource.members.empty?
+ # pw group[add|mod] -M is used to set the full membership list on a
+ # new or existing group. Because pw groupadd does not support the -m
+ # and -d options used by manage_group, we treat group creation as a
+ # special case and use -M.
+ Chef::Log.debug("#{@new_resource} setting group members: #{@new_resource.members.join(',')}")
+ member_options = [" -M #{@new_resource.members.join(',')}"]
- if member_options.empty?
- run_command(:command => command)
- else
member_options.each do |option|
run_command(:command => command + option)
end
+ else
+ run_command(:command => command)
end
end