From 647fe520797286b1bf59c1f5ca4844992ea719a8 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Thu, 6 Feb 2014 16:21:34 +0000 Subject: [PATCH] extract #standard_delete_resource --- libraries/chef/mixin/pacemaker/standard_cib_object.rb | 8 ++++++++ providers/colocation.rb | 6 +----- providers/primitive.rb | 6 +----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/chef/mixin/pacemaker/standard_cib_object.rb b/libraries/chef/mixin/pacemaker/standard_cib_object.rb index 6163237..6c4a383 100644 --- a/libraries/chef/mixin/pacemaker/standard_cib_object.rb +++ b/libraries/chef/mixin/pacemaker/standard_cib_object.rb @@ -52,6 +52,14 @@ class Chef ::Chef::Log.error "Failed to configure #{cib_object}" end end + + def standard_delete_resource + execute @current_cib_object.delete_command do + action :nothing + end.run_action(:run) + new_resource.updated_by_last_action(true) + Chef::Log.info "Deleted #{@current_cib_object}'." + end end end end diff --git a/providers/colocation.rb b/providers/colocation.rb index 656b71c..5862b98 100644 --- a/providers/colocation.rb +++ b/providers/colocation.rb @@ -36,11 +36,7 @@ end action :delete do name = new_resource.name next unless @current_resource - execute @current_cib_object.delete_command do - action :nothing - end.run_action(:run) - new_resource.updated_by_last_action(true) - Chef::Log.info "Deleted #{@current_cib_object}'." + standard_delete_resource end def cib_object_class diff --git a/providers/primitive.rb b/providers/primitive.rb index 99ca86f..9d1007d 100644 --- a/providers/primitive.rb +++ b/providers/primitive.rb @@ -45,11 +45,7 @@ action :delete do if @current_cib_object.running? raise "Cannot delete running #{@current_cib_object}" end - execute @current_cib_object.delete_command do - action :nothing - end.run_action(:run) - new_resource.updated_by_last_action(true) - Chef::Log.info "Deleted #{@current_cib_object}" + standard_delete_resource end action :start do