extract #standard_create_action for reuse

This commit is contained in:
Adam Spiers
2014-03-04 16:22:50 +00:00
parent dc6fdbb106
commit 64bd9c8fb4
2 changed files with 11 additions and 7 deletions

View File

@@ -7,6 +7,16 @@ require ::File.expand_path('../../../pacemaker/cib_object',
class Chef
module Mixin::Pacemaker
module StandardCIBObject
def standard_create_action
name = new_resource.name
if @current_resource_definition.nil?
create_resource(name)
else
maybe_modify_resource(name)
end
end
# Instantiate @current_resource and read details about the existing
# primitive (if any) via "crm configure show" into it, so that we
# can compare it against the resource requested by the recipe, and

View File

@@ -23,13 +23,7 @@ require ::File.expand_path('../libraries/chef/mixin/pacemaker',
include Chef::Mixin::Pacemaker::RunnableResource
action :create do
name = new_resource.name
if @current_resource_definition.nil?
create_resource(name)
else
maybe_modify_resource(name)
end
standard_create_action
end
action :delete do