summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-02-08 09:21:16 -0800
committerGitHub <noreply@github.com>2019-02-08 09:21:16 -0800
commit0e76fba594f0d65e5a31a03a7ea0d52d2a4c9b5f (patch)
treef0f2461c3a9c765b81d659a88a4206f0c58f0142 /lib/chef
parent1dd56e94f267e8a156aa617f243516a22113b41e (diff)
parentaaa66a70989777b1b86a50b4ed6e2c98e9b93292 (diff)
downloadchef-0e76fba594f0d65e5a31a03a7ea0d52d2a4c9b5f.tar.gz
Merge pull request #8226 from chef/jjustice6-tweak_solaris_usermod
Alter how we set set group members in solaris / unify group testing
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/provider/group/solaris.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/chef/provider/group/solaris.rb b/lib/chef/provider/group/solaris.rb
index f5df203b78..4d913fba30 100644
--- a/lib/chef/provider/group/solaris.rb
+++ b/lib/chef/provider/group/solaris.rb
@@ -35,28 +35,16 @@ class Chef
super
requirements.assert(:all_actions) do |a|
- a.assertion { ::File.exist?("/usr/sbin/usermod") }
- a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/usermod for #{new_resource}"
+ a.assertion { ::File.exist?("/usr/sbin/usermod") && ::File.exist?("/usr/sbin/groupmod") }
+ a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/usermod or /usr/sbin/groupmod for #{new_resource}"
# No whyrun alternative: this component should be available in the base install of any given system that uses it
end
-
- requirements.assert(:modify, :manage) do |a|
- a.assertion { (new_resource.members.empty? && new_resource.excluded_members.empty?) || new_resource.append }
- a.failure_message Chef::Exceptions::Group, "setting group members directly is not supported by #{self}, must set append true in group"
- # No whyrun alternative - this action is simply not supported.
- end
end
def set_members(members)
+ # Set the group to have exactly the list of members passed to it.
unless members.empty?
- members.each do |member|
- add_member(member)
- end
- end
- unless excluded_members.empty?
- excluded_members.each do |excluded_member|
- remove_member(excluded_member)
- end
+ shell_out!("groupmod", "-U", members.join(","), new_resource.group_name)
end
end