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