lib/chef/provider/group/gpasswd.rb in chef-0.8.16 vs lib/chef/provider/group/gpasswd.rb in chef-0.9.0.a3
- old
+ new
@@ -15,16 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'chef/provider/group/groupadd'
+require 'chef/mixin/shell_out'
class Chef
class Provider
class Group
class Gpasswd < Chef::Provider::Group::Groupadd
-
+
+ include Chef::Mixin::ShellOut
+
def load_current_resource
super
raise Chef::Exceptions::Group, "Could not find binary /usr/bin/gpasswd for #{@new_resource}" unless ::File.exists?("/usr/bin/gpasswd")
end
@@ -32,14 +35,14 @@
def modify_group_members
unless @new_resource.members.empty?
if(@new_resource.append)
@new_resource.members.each do |member|
Chef::Log.debug("#{@new_resource}: appending member #{member} to group #{@new_resource.group_name}")
- run_command(:command => "gpasswd -a #{member} #{@new_resource.group_name}")
+ shell_out!("gpasswd -a #{member} #{@new_resource.group_name}")
end
else
Chef::Log.debug("#{@new_resource}: setting group members to #{@new_resource.members.join(', ')}")
- run_command(:command => "gpasswd -M #{@new_resource.members.join(',')} #{@new_resource.group_name}")
+ shell_out!("gpasswd -M #{@new_resource.members.join(',')} #{@new_resource.group_name}")
end
else
Chef::Log.debug("#{@new_resource}: not changing group members, the group has no members")
end
end