Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #18972 - clean hosts with nil sub uuid #6691

Merged
merged 1 commit into from Mar 23, 2017

Conversation

jlsherrill
Copy link
Member

No description provided.

@mention-bot
Copy link

@jlsherrill, thanks for your PR! By analyzing the history of the files in this pull request, we identified @parthaa and @chris1984 to be potential reviewers.

@jlsherrill
Copy link
Member Author

To test, simply register a host and run:

Host.find(id).subscription_facet.update_attributes(:uuid => nil)

@mccun934
Copy link
Member

BTW, this didn't fix my issue. While it found the systems that needed unregistering/deleting they still could not be deleted. The task that got spawned died with a 404 error:

Katello::Resources::Candlepin::CandlepinResource: 404 Resource Not Found {"displayMessage":"Runtime Error RESTEASY001185: Could not find resource for relative : /consumers//entitlements of full path: https://localhost:8443/candlepin/consumers//entitlements at org.jboss.resteasy.core.registry.PathParamSegment.matchPattern:209","requestUuid":"beaf50e0-6f2c-4295-ba4f-4d3bf2ee4789"} (GET /candlepin/consumers//entitlements) (RestClient::ResourceNotFound)
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
/opt/theforeman/tfm/root/usr/share/gems/gems/rbovirt-0.0.38/lib/restclient_ext/request.rb:50:in `block in transmit'
/opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'

@jlsherrill
Copy link
Member Author

as discussed offline, that issue is no longer present in the current katello

@johnpmitsch
Copy link
Contributor

@jlsherrill

I am seeing this when I run the rake katello:clean_backend_objects

2017-03-22T13:21:16  [katello/pulp_rest] [D] RestClient.get "https://sausage.example.com/pulp/api/v2/consumers/74e1e16c-55d9-415e-b077-76f7310d37e4/", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "accept"=>"application/json", "content_type"=>"application/json"
 | \n# => 200 OK | application/json 208 bytes
 | 
Host 5 sausage-client2.example.com  is partially missing.  Un-registering
2017-03-22T13:21:16  [katello/cp_rest] [D] Resource GET request: /candlepin/consumers/?
2017-03-22T13:21:16  [katello/cp_rest] [D] Headers: {"accept":"application/json","accept-language":"en","content-type":"application/json","cp-user":"foreman_admin"}
2017-03-22T13:21:16  [katello/cp_rest] [D] Body: {}
rake aborted!
RestClient::BadRequest: Katello::Resources::Candlepin::Consumer: 400 Bad Request {"displayMessage":"Must specify at least one search criteria.","requestUuid":"a959beb6-8f13-4c48-ab04-f2aa0141c28d"} (GET /candlepin/consumers/?)

The SubscriptionFacet still exists, but it looks like it was unregistered. (not sure if that is the expected outcome)

I still see the Content Host in the UI, but there is an error when I navigate to it
here

here is the traceback

@jlsherrill
Copy link
Member Author

@johnpmitsch this may be candlepin 2.0 related. Do you have the traceback from teh rake task?

@jlsherrill
Copy link
Member Author

actually i can reproduce

@chris1984
Copy link
Member

I was going to test this morning, but it looks like an updated commit is coming. I will test with the new one.

@jlsherrill
Copy link
Member Author

Note, i fixed the cp 2.0 error in #6695. These two prs should be tested together.

@jlsherrill
Copy link
Member Author

#6695 is merged, this is ready to be retested.

@chris1984
Copy link
Member

[root@centos7-katello-nightly ~]# foreman-rake katello:clean_backend_objects
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
The following changes will not actually be performed. Rerun with COMMIT=true to apply the changes
1 orphaned consumer id(s) found.
[root@centos7-katello-nightly ~]# foreman-rake katello:clean_backend_objects COMMIT=true
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
1 orphaned consumer id(s) found.

Works here after the #6695 merge

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@jlsherrill jlsherrill merged commit 49fbe73 into Katello:master Mar 23, 2017
@jlsherrill jlsherrill deleted the 18972 branch March 23, 2017 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants