extract standard_create_resource
This commit is contained in:
@@ -32,5 +32,24 @@ class Chef
|
|||||||
@current_cib_object = cib_object
|
@current_cib_object = cib_object
|
||||||
init_current_resource
|
init_current_resource
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
@@ -92,21 +92,7 @@ def init_current_resource
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_resource(name)
|
def create_resource(name)
|
||||||
cib_object = cib_object_class.from_chef_resource(new_resource)
|
standard_create_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
|
||||||
|
|
||||||
def maybe_modify_resource(name)
|
def maybe_modify_resource(name)
|
||||||
|
Reference in New Issue
Block a user