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 #12952 - Disassociate proxy from content host before removing it #5802

Merged
merged 1 commit into from Feb 23, 2016

Conversation

dLobatog
Copy link
Member

On the content hosts migration, when a content host is going to be
removed, it first needs to be disassociated from the proxy it belongs
to. Otherwise it fails with the foreign_key problem mentioned in
redmine.

@@ -212,6 +212,9 @@ def get_systems_with_facts(systems)

systems_to_remove.each do |system|
logger.info("Content Host #{system.uuid} doesn't have candlepin information, unregistering.")
system_proxy = SmartProxy.find_by_content_host_id(system.id)
system_proxy.content_host = nil
system_proxy.save
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to check for nil here, as not every system will have an associated smart proxy.

On the content hosts migration, when a content host is going to be
removed, it first needs to be disassociated from the proxy it belongs
to. Otherwise it fails with the foreign_key problem mentioned in
redmine.
@dLobatog
Copy link
Member Author

@jlsherrill Updated, now it checks there's a proxy that uses the system in question during the migration

@jlsherrill
Copy link
Member

ACK thanks @dLobatog !

jlsherrill added a commit that referenced this pull request Feb 23, 2016
Fixes #12952 - Disassociate proxy from content host before removing it
@jlsherrill jlsherrill merged commit 9ee3552 into Katello:master Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants