replace 'execute' with 'Mixlib::ShellOut' library.

This commit is contained in:
Robert
2013-04-21 22:51:55 +09:00
parent 2d5708d753
commit 2f4177068b
7 changed files with 69 additions and 52 deletions

View File

@@ -28,12 +28,16 @@ action :create do
unless resource_exists?(name)
cmd = "crm configure location #{name} #{rsc} #{priority}: #{loc}"
e = execute "configure location #{name}" do
command cmd
cmd_ = Mixlib::ShellOut.new(cmd)
cmd_.environment['HOME'] = ENV.fetch('HOME', '/root')
cmd_.run_command
begin
cmd.error!
new_resource.updated_by_last_action(true)
Chef::Log.info "Successfully configured location '#{name}'."
rescue
Chef::Log.error "Failed to configure location #{name}."
end
new_resource.updated_by_last_action(true)
Chef::Log.info "Configured location '#{name}'."
end
end