diff --git a/providers/clone.rb b/providers/clone.rb index 1df39fc..f4a6c99 100644 --- a/providers/clone.rb +++ b/providers/clone.rb @@ -38,8 +38,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured clone '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured clone '#{name}'." + else + Chef::Log.error "Failed to configure clone #{name}." + end rescue Chef::Log.error "Failed to configure clone #{name}." end diff --git a/providers/colocation.rb b/providers/colocation.rb index 91e3a57..b67d835 100644 --- a/providers/colocation.rb +++ b/providers/colocation.rb @@ -44,8 +44,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured colocation '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured colocation '#{name}'." + else + Chef::Log.error "Failed to configure colocation #{name}." + end rescue Chef::Log.error "Failed to configure colocation #{name}." end diff --git a/providers/location.rb b/providers/location.rb index 319fa8d..afbfbc3 100644 --- a/providers/location.rb +++ b/providers/location.rb @@ -33,8 +33,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured location '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured location '#{name}'." + else + Chef::Log.error "Failed to configure location #{name}." + end rescue Chef::Log.error "Failed to configure location #{name}." end diff --git a/providers/ms.rb b/providers/ms.rb index cfb2803..95b6434 100644 --- a/providers/ms.rb +++ b/providers/ms.rb @@ -38,8 +38,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured ms '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured ms '#{name}'." + else + Chef::Log.error "Failed to configure ms #{name}." + end rescue Chef::Log.error "Failed to configure ms #{name}." end diff --git a/providers/node.rb b/providers/node.rb index de06717..c652bef 100644 --- a/providers/node.rb +++ b/providers/node.rb @@ -30,8 +30,12 @@ action :add do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured node '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured node '#{name}'." + else + Chef::Log.error "Failed to configure node #{name}." + end rescue Chef::Log.error "Failed to configure node #{name}." end diff --git a/providers/order.rb b/providers/order.rb index 5a1ca6f..405685d 100644 --- a/providers/order.rb +++ b/providers/order.rb @@ -35,8 +35,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured order '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured order '#{name}'." + else + Chef::Log.error "Failed to configure order #{name}." + end rescue Chef::Log.error "Failed to configure order #{name}." end diff --git a/providers/primitive.rb b/providers/primitive.rb index a4d61de..211e122 100644 --- a/providers/primitive.rb +++ b/providers/primitive.rb @@ -60,8 +60,12 @@ action :create do cmd_.run_command begin cmd_.error! - new_resource.updated_by_last_action(true) - Chef::Log.info "Successfully configured primitive '#{name}'." + if resource_exists?(name) + new_resource.updated_by_last_action(true) + Chef::Log.info "Successfully configured primitive '#{name}'." + else + Chef::Log.error "Failed to configure primitive #{name}." + end rescue Chef::Log.error "Failed to configure primitive #{name}." end