extract #delete_runnable_resource
This commit is contained in:
@@ -1 +1,2 @@
|
||||
require File.expand_path('pacemaker/standard_cib_object.rb', File.dirname(__FILE__))
|
||||
require File.expand_path('pacemaker/runnable_resource.rb', File.dirname(__FILE__))
|
||||
|
21
libraries/chef/mixin/pacemaker/runnable_resource.rb
Normal file
21
libraries/chef/mixin/pacemaker/runnable_resource.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'chef/application'
|
||||
require ::File.expand_path('standard_cib_object', ::File.dirname(__FILE__))
|
||||
|
||||
# Common code used by Pacemaker LWRP providers for resources supporting
|
||||
# the :run action.
|
||||
|
||||
class Chef
|
||||
module Mixin::Pacemaker
|
||||
module RunnableResource
|
||||
include StandardCIBObject
|
||||
|
||||
def delete_runnable_resource
|
||||
return unless @current_resource
|
||||
if @current_cib_object.running?
|
||||
raise "Cannot delete running #{@current_cib_object}"
|
||||
end
|
||||
standard_delete_resource
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -21,7 +21,7 @@ require ::File.expand_path('../libraries/pacemaker', ::File.dirname(__FILE__))
|
||||
require ::File.expand_path('../libraries/chef/mixin/pacemaker',
|
||||
::File.dirname(__FILE__))
|
||||
|
||||
include Chef::Mixin::Pacemaker::StandardCIBObject
|
||||
include Chef::Mixin::Pacemaker::RunnableResource
|
||||
|
||||
action :create do
|
||||
name = new_resource.name
|
||||
@@ -40,12 +40,7 @@ action :create do
|
||||
end
|
||||
|
||||
action :delete do
|
||||
name = new_resource.name
|
||||
next unless @current_resource
|
||||
if @current_cib_object.running?
|
||||
raise "Cannot delete running #{@current_cib_object}"
|
||||
end
|
||||
standard_delete_resource
|
||||
delete_runnable_resource
|
||||
end
|
||||
|
||||
action :start do
|
||||
|
Reference in New Issue
Block a user