summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Winter <m.winter@sap.com>2016-03-12 15:41:52 +0100
committerMarkus Winter <m.winter@sap.com>2016-03-12 15:41:52 +0100
commit80bc871de7a6d7bbd9775ba611b39d26157032ed (patch)
tree9227a511b990fd485fe401c0ebbb6b9fa713b336
parent365064280c93d519fdacbf032c0c21057e5549c9 (diff)
downloadchef-80bc871de7a6d7bbd9775ba611b39d26157032ed.tar.gz
fix for https://github.com/chef/chef/issues/4689
rework the set_members method so duplicates are avoided
-rw-r--r--lib/chef/provider/group/suse.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb
index f6f4fa1e11..710d9020c9 100644
--- a/lib/chef/provider/group/suse.rb
+++ b/lib/chef/provider/group/suse.rb
@@ -39,12 +39,14 @@ class Chef
end
def set_members(members)
- unless @current_resource.members.empty?
- shell_out!("groupmod -R #{@current_resource.members.join(',')} #{@new_resource.group_name}")
+ to_delete = @current_resource.members - members
+ to_delete.each do |member|
+ remove_member(member)
end
- unless members.empty?
- shell_out!("groupmod -A #{members.join(',')} #{@new_resource.group_name}")
+ to_add = members - @current_resource.members
+ to_add.each do |member|
+ add_member(member)
end
end