Skip to content

Drop Pulp 2 Smart Proxy status code#10721

Open
ekohl wants to merge 2 commits into
Katello:masterfrom
ekohl:drop-pulp-2-smart-proxy-code
Open

Drop Pulp 2 Smart Proxy status code#10721
ekohl wants to merge 2 commits into
Katello:masterfrom
ekohl:drop-pulp-2-smart-proxy-code

Conversation

@ekohl

@ekohl ekohl commented Sep 6, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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

@ianballou ianballou left a comment

Copy link
Copy Markdown
Member

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

ekohl commented Jun 26, 2024

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
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

@ianballou ianballou left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

Comment thread app/controllers/katello/concerns/smart_proxies_controller_extensions.rb Outdated
@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch 2 times, most recently from 749d654 to ab383c3 Compare July 18, 2024 12:49
Comment thread app/assets/javascripts/katello/containers/container.js Outdated
Comment thread test/support/capsule_support.rb Outdated

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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
Copy Markdown
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.

Copy link
Copy Markdown
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
Copy Markdown
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().

@ianballou ianballou left a comment

Copy link
Copy Markdown
Member

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'

@ekohl ekohl force-pushed the drop-pulp-2-smart-proxy-code branch 2 times, most recently from f1bc1c7 to 6990829 Compare February 18, 2025 18:43

@ianballou ianballou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I haven't figured out why, but this PR is stopping find_resource from working. I have to manually add find_resource to controller methods for them to work in both Foreman and Katello. For example, there are nil errors in smart_proxies_controller#modules_card for @smart_proxy.statuses

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line causes init to fail.

@ekohl

ekohl commented May 6, 2025

Copy link
Copy Markdown
Member Author

@ianballou would you be willing to take this over? I don't have the time to focus on this, but I still think cleaning up unused code is something that should be done.

@ianballou

Copy link
Copy Markdown
Member

@ianballou would you be willing to take this over? I don't have the time to focus on this, but I still think cleaning up unused code is something that should be done.

Sure, I can take it over 👍

ekohl and others added 2 commits August 1, 2025 18:58
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.
@ianballou ianballou force-pushed the drop-pulp-2-smart-proxy-code branch from 6990829 to dab107b Compare August 1, 2025 21:52
pulp_primary || fail(_("Could not find a smart proxy with pulp feature."))
end

def self.default_capsule

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Where is this used?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Funny enough, the foreman_rh_cloud plugin uses it. It should switch to using pulp_primary ideally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants