summaryrefslogtreecommitdiff
path: root/lib/chef/provider/group/suse.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/group/suse.rb')
-rw-r--r--lib/chef/provider/group/suse.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb
index 71336f9311..0790d2c2d9 100644
--- a/lib/chef/provider/group/suse.rb
+++ b/lib/chef/provider/group/suse.rb
@@ -33,21 +33,21 @@ class Chef
def define_resource_requirements
super
requirements.assert(:all_actions) do |a|
- a.assertion { ::File.exists?("/usr/sbin/groupmod") }
- a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/groupmod for #{@new_resource.name}"
+ a.assertion { ::File.exist?("/usr/sbin/groupmod") }
+ a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/groupmod for #{new_resource.name}"
# No whyrun alternative: this component should be available in the base install of any given system that uses it
end
requirements.assert(:create, :manage, :modify) do |a|
a.assertion do
begin
- to_add(@new_resource.members).all? { |member| Etc.getpwnam(member) }
+ to_add(new_resource.members).all? { |member| Etc.getpwnam(member) }
rescue
false
end
end
- a.failure_message Chef::Exceptions::Group, "Could not add users #{to_add(@new_resource.members).join(", ")} to #{@new_resource.group_name}: one of these users does not exist"
- a.whyrun "Could not find one of these users: #{to_add(@new_resource.members).join(", ")}. Assuming it will be created by a prior step"
+ a.failure_message Chef::Exceptions::Group, "Could not add users #{to_add(new_resource.members).join(', ')} to #{new_resource.group_name}: one of these users does not exist"
+ a.whyrun "Could not find one of these users: #{to_add(new_resource.members).join(', ')}. Assuming it will be created by a prior step"
end
end
@@ -62,19 +62,19 @@ class Chef
end
def to_add(members)
- members - @current_resource.members
+ members - current_resource.members
end
def add_member(member)
- shell_out!("groupmod -A #{member} #{@new_resource.group_name}")
+ shell_out_compact!("groupmod", "-A", member, new_resource.group_name)
end
def to_remove(members)
- @current_resource.members - members
+ current_resource.members - members
end
def remove_member(member)
- shell_out!("groupmod -R #{member} #{@new_resource.group_name}")
+ shell_out_compact!("groupmod", "-R", member, new_resource.group_name)
end
end