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

Drop Pulp 2 Smart Proxy status code #10721

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Sep 6, 2023

What are the changes introduced in this pull request?

It drops the Pulp 2 Smart Proxy status extensions.

Considerations taken when implementing this change?

These were likely not triggered anymore because the Pulp 2 features were never present.

What are the testing steps for this pull request?

Go to the Smart Proxies overview and for every Smart Proxy it should still render well. I forgot if there's a Pulp 3 tab today, but if there is, it should still be present after.

@ianballou
Copy link
Member

Guessing we missed this since it didn't show up in triage via redmine, mind adding one so we can get it on our job board?

@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch from bd0f12f to 8559d28 Compare April 26, 2024 09:01
@ekohl ekohl marked this pull request as ready for review April 26, 2024 09:01
Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

engine.rb still has ::SmartProxiesController.include Katello::Concerns::SmartProxiesControllerExtensions in it, removing that should fix the tests.

@ekohl
Copy link
Member Author

ekohl commented Jun 26, 2024

Rebased and removed require statements.

@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch from d58b925 to 2d2f2f5 Compare June 26, 2024 12:59
module Overrides
def show
@task_search_url = main_app.foreman_tasks_tasks_path(:search => "resource_id = #{@smart_proxy.id} AND resource_type = #{@smart_proxy.class}")
render 'foreman/smart_proxies/show', :layout => 'katello/layouts/foreman_with_bastion'
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not 100% sure if this also needs to be reflected in any templates.

@ianballou ianballou self-requested a review June 27, 2024 17:58
Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Looks like it's breaking the smart proxy details pages:

2024-07-16T20:18:30 [F|app|3fb86828]   
 3fb86828 | ActionView::Template::Error (undefined method `map' for nil:NilClass):
 3fb86828 |     1: <%= render :partial => 'disk_usage', :collection => disks(@storage), :as => :disk %>
 3fb86828 |   
 3fb86828 | /home/vagrant/katello/app/helpers/katello/concerns/smart_proxy_helper_extensions.rb:5:in `disks'
 3fb86828 | /home/vagrant/katello/app/views/smart_proxies/pulp_storage.html.erb:1
 3fb86828 | app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 3fb86828 | app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 3fb86828 | app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 3fb86828 | /home/vagrant/katello/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 3fb86828 | /home/vagrant/katello/lib/katello/middleware/event_daemon.rb:10:in `call'
 3fb86828 | lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 3fb86828 | lib/foreman/middleware/telemetry.rb:10:in `call'
 3fb86828 | lib/foreman/middleware/logging_context_session.rb:22:in `call'
 3fb86828 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
 3fb86828 | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call'
2024-07-16T20:18:32 [I|app|3c441f02] Processing by Katello::Api::V2::CapsuleContentController#sync_status as JSON

@ianballou
Copy link
Member

I think the Pulp and Pulp Node bits can also be removed from: https://github.com/katello/katello/blob/master/lib/katello/plugin.rb#L313

before_action :find_resource_and_status, :only => [:pulp_storage, :pulp_status]

def pulp_storage
@storage = @smart_proxy.pulp_disk_usage
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how much of this file is still used, but this bit definitely is still used to show the Pulp 3 storage amount. @storage being nil in the error I pasted earlier makes sense since this file was deleted.

@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch from 2d2f2f5 to 749d654 Compare July 18, 2024 12:49
The PULP_FEATURE and PULP_NODE_FEATURE features were for Pulp 2. This is
never present in a current Katello installation and can be dropped.

It also replaces the deprecated default_capsule code, which is replaced
by pulp_primary.

In the template the code to handle primaries is disabled because it's
only shown for mirrors. A mirror is by definition not a primary, so it
can never trigger.
@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch from 749d654 to ab383c3 Compare July 18, 2024 12:49
@@ -1,10 +1,9 @@
module Support
module CapsuleSupport
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this should be done in factories as traits, but I considered it out of scope here.


unscoped.with_features(features).joins(:capsule_lifecycle_environments).
where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id })
pulpcore_proxies_with_environment(environment).try(:uniq)
end

def self.pulpcore_proxies_with_environment(environment)
Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about optimizing this to:

unscoped.select { |p| p.pulp_mirror? }.joins(:capsule_lifecycle_environments).
  where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id }).distinct

Copy link
Member

Choose a reason for hiding this comment

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

This would be fine, I like avoiding excess queries where possible.

def self.default_capsule!
pulp_primary!
end

def self.with_environment(environment, include_default = false)
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
def self.with_environment(environment, include_default = false)
def self.with_environment(environment)

Copy link
Member

Choose a reason for hiding this comment

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

This should be fine, I don't see any uses of include_default = false with with_environment().

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Something is still broken on the smart proxies page, looks like storage is still ending up nil.

 48a2c081 | ActionView::Template::Error (undefined method `map' for nil:NilClass):
 48a2c081 |     1: <%= render :partial => 'disk_usage', :collection => disks(@storage), :as => :disk %>
 48a2c081 |   
 48a2c081 | /home/vagrant/katello/app/helpers/katello/concerns/smart_proxy_helper_extensions.rb:5:in `disks'
 48a2c081 | /home/vagrant/katello/app/views/smart_proxies/pulp_storage.html.erb:1
 48a2c081 | app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 48a2c081 | app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 48a2c081 | app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 48a2c081 | /home/vagrant/katello/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 48a2c081 | /home/vagrant/katello/lib/katello/middleware/event_daemon.rb:10:in `call'
 48a2c081 | lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 48a2c081 | lib/foreman/middleware/telemetry.rb:10:in `call'
 48a2c081 | lib/foreman/middleware/logging_context_session.rb:22:in `call'
 48a2c081 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
 48a2c081 | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants