diff --git a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb b/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb index 0a6a46ed29e..97f58d47f45 100644 --- a/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +++ b/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb @@ -196,7 +196,7 @@ def consumer_create content_view_environment = find_content_view_environment foreman_host = find_foreman_host(content_view_environment.environment.organization) - sync_task(::Actions::Katello::System::Destroy, foreman_host.content_host) if foreman_host.content_host + sync_task(::Actions::Katello::System::Destroy, foreman_host.content_host) if foreman_host.try(:content_host) @system = System.new(system_params.merge(:environment => content_view_environment.environment, :content_view => content_view_environment.content_view, @@ -225,7 +225,7 @@ def consumer_activate activation_keys = find_activation_keys foreman_host = find_foreman_host(activation_keys.first.organization) - sync_task(::Actions::Katello::System::Destroy, foreman_host.content_host) if foreman_host.content_host + sync_task(::Actions::Katello::System::Destroy, foreman_host.content_host) if foreman_host.try(:content_host) @system = System.new(system_params.merge(:host_id => foreman_host.try(:id))) sync_task(::Actions::Katello::System::Create, @system, activation_keys)