Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active March 28, 2017 20:07
Show Gist options
  • Save jlsherrill/345afda33970bf7b01e2d4682903ecbe to your computer and use it in GitHub Desktop.
Save jlsherrill/345afda33970bf7b01e2d4682903ecbe to your computer and use it in GitHub Desktop.
6.2 remove host

error "Katello::Resources::Candlepin::Consumer: 410 Gone
{"displayMessage":"Unit 370f8333-fd19-4c0b-9408-dff6d80ce28d has been deleted"}

foreman-rake console

Katello::System.find_by(:uuid => '370f8333-fd19-4c0b-9408-dff6d80ce28d').try(:destroy!)
host = Katello::Host::SubscriptionFacet.find_by(:uuid => '370f8333-fd19-4c0b-9408-dff6d80ce28d').try(:host)
host.subscription_facet.try(:destroy! ) if host
host.content_facet.try(:destroy!) if host

For cases where the uuid is nil, such as:

Runtime Error RESTEASY001185: Could not find resource for relative : /consumers//compliance of full path:
https://localhost:8443/candlepin/consumers//compliance at org.jboss.resteasy.core.registry.PathParamSegment.matchPattern:209

host = Host.find_by(:name => "foobar.example.com")
host.subscription_facet.try(:destroy! ) if host
host.content_facet.try(:destroy!) if host
host.content_host.try(:destroy) if host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment