Skip to content

Instantly share code, notes, and snippets.

@daviddavis
Created April 22, 2015 21:28
Show Gist options
  • Select an option

  • Save daviddavis/60fef46be6fdda070e5c to your computer and use it in GitHub Desktop.

Select an option

Save daviddavis/60fef46be6fdda070e5c to your computer and use it in GitHub Desktop.
diff --git a/clean_backend_objects.rake b/clean_backend_objects.rake~update
index f8bb2bf..4531ea6 100644
--- a/clean_backend_objects.rake
+++ b/clean_backend_objects.rake~update
@@ -46,8 +46,18 @@ namespace :katello do
katello_consumer_ids = ::Katello::System.pluck(:uuid)
deletable_ids = cp_consumer_ids - katello_consumer_ids
deletable_ids.each do |consumer_id|
- Katello::Resources::Candlepin::Consumer.destroy(consumer_id)
- Katello.pulp_server.extensions.consumer.delete(consumer_id)
+ begin
+ Katello::Resources::Candlepin::Consumer.destroy(consumer_id)
+ rescue RestClient::Exception => e
+ p "exception when destroying candlepin consumer #{consumer_id}:#{e.inspect}"
+ end
+ begin
+ Katello.pulp_server.extensions.consumer.delete(consumer_id)
+ rescue RestClient::ResourceNotFound => e
+ #do nothing
+ rescue RestClient::Exception => e
+ p "exception when destroying pulp consumer #{consumer_id}:#{e.inspect}"
+ end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment