negate conditional to simplify indentation

This commit is contained in:
Adam Spiers
2014-01-09 12:12:59 +00:00
parent a19cca3b68
commit 1b5e9ca6a8

View File

@@ -26,7 +26,8 @@ action :create do
name = new_resource.name name = new_resource.name
agent = new_resource.agent agent = new_resource.agent
unless resource_exists?(name) return if resource_exists?(name)
cmd = "crm configure primitive #{name} #{agent}" cmd = "crm configure primitive #{name} #{agent}"
if new_resource.params and !(new_resource.params.empty?) if new_resource.params and !(new_resource.params.empty?)
@@ -53,8 +54,8 @@ action :create do
end end
end end
# 'Execute' resource doesn't throw exception even when command fails.. # 'Execute' resource doesn't throw exception even when command fails..
# So, Mixlib::ShellOut was used instead. # So, Mixlib::ShellOut was used instead.
cmd_ = Mixlib::ShellOut.new(cmd) cmd_ = Mixlib::ShellOut.new(cmd)
cmd_.environment['HOME'] = ENV.fetch('HOME', '/root') cmd_.environment['HOME'] = ENV.fetch('HOME', '/root')
cmd_.run_command cmd_.run_command
@@ -69,7 +70,6 @@ action :create do
rescue rescue
Chef::Log.error "Failed to configure primitive #{name}." Chef::Log.error "Failed to configure primitive #{name}."
end end
end
end end
action :delete do action :delete do