extract standard_create_resource

This commit is contained in:
Adam Spiers
2014-02-03 15:36:37 +00:00
parent ba39273800
commit e282fc2d28
2 changed files with 20 additions and 15 deletions

View File

@@ -32,5 +32,24 @@ class Chef
@current_cib_object = cib_object
init_current_resource
end
def standard_create_resource
cib_object = cib_object_class.from_chef_resource(new_resource)
cmd = cib_object.crm_configure_command
::Chef::Log.info "Creating new #{cib_object}"
execute cmd do
action :nothing
end.run_action(:run)
if cib_object.exists?
new_resource.updated_by_last_action(true)
::Chef::Log.info "Successfully configured #{cib_object}"
else
::Chef::Log.error "Failed to configure #{cib_object}"
end
end
end
end

View File

@@ -92,21 +92,7 @@ def init_current_resource
end
def create_resource(name)
cib_object = cib_object_class.from_chef_resource(new_resource)
cmd = cib_object.crm_configure_command
Chef::Log.info "Creating new #{cib_object}"
execute cmd do
action :nothing
end.run_action(:run)
if cib_object.exists?
new_resource.updated_by_last_action(true)
Chef::Log.info "Successfully configured #{cib_object}"
else
Chef::Log.error "Failed to configure #{cib_object}"
end
standard_create_resource
end
def maybe_modify_resource(name)