-
Notifications
You must be signed in to change notification settings - Fork 303
Drop Pulp 2 Smart Proxy status code #10721
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| require 'proxy_api/pulp' | ||
| require 'proxy_api/pulp_node' | ||
| require 'proxy_api/container_gateway' | ||
|
|
||
| module Katello | ||
|
|
@@ -15,8 +13,6 @@ def refresh | |
| end | ||
|
|
||
| PULP3_FEATURE = "Pulpcore".freeze | ||
| PULP_FEATURE = "Pulp".freeze | ||
| PULP_NODE_FEATURE = "Pulp Node".freeze | ||
| CONTAINER_GATEWAY_FEATURE = "Container_Gateway".freeze | ||
|
|
||
| DOWNLOAD_INHERIT = 'inherit'.freeze | ||
|
|
@@ -35,7 +31,7 @@ def refresh | |
| before_validation :set_default_download_policy | ||
| after_update :refresh_smart_proxy_sync_histories | ||
|
|
||
| lazy_accessor :pulp_repositories, :initializer => lambda { |_s| pulp_node.extensions.repository.retrieve_all } | ||
| lazy_accessor :pulp_repositories, :initializer => lambda { |_s| pulp_api.extensions.repository.retrieve_all } | ||
|
|
||
| # A smart proxy's HTTP proxy is used for all related alternate content sources. | ||
| belongs_to :http_proxy, :inverse_of => :smart_proxies, :class_name => '::HttpProxy' | ||
|
|
@@ -65,7 +61,7 @@ def refresh | |
| :in => DOWNLOAD_POLICIES, | ||
| :message => _("must be one of the following: %s") % DOWNLOAD_POLICIES.join(', '), | ||
| } | ||
| scope :with_content, -> { with_features(PULP_FEATURE, PULP_NODE_FEATURE, PULP3_FEATURE) } | ||
| scope :with_content, -> { with_features(PULP3_FEATURE) } | ||
|
|
||
| def self.load_balanced | ||
| proxies = unscoped.with_content # load balancing is only supported for pulp proxies | ||
|
|
@@ -85,10 +81,6 @@ def self.with_repo(repo) | |
| end | ||
|
|
||
| def self.pulp_primary | ||
| unscoped.with_features(PULP_FEATURE).first || non_mirror_pulp3 | ||
| end | ||
|
|
||
| def self.non_mirror_pulp3 | ||
| found = unscoped.with_features(PULP3_FEATURE).order(:id).select { |proxy| !proxy.setting(PULP3_FEATURE, 'mirror') } | ||
| Rails.logger.warn("Found multiple smart proxies with mirror set to false. This is likely not intentional.") if found.count > 1 | ||
| found.first | ||
|
|
@@ -102,20 +94,8 @@ def self.default_capsule | |
| pulp_primary | ||
| end | ||
|
|
||
| def self.default_capsule! | ||
| pulp_primary! | ||
| end | ||
|
|
||
| def self.with_environment(environment, include_default = false) | ||
| (pulp2_proxies_with_environment(environment, include_default) + pulpcore_proxies_with_environment(environment)).try(:uniq) | ||
| end | ||
|
|
||
| def self.pulp2_proxies_with_environment(environment, include_default = false) | ||
| features = [PULP_NODE_FEATURE] | ||
| features << PULP_FEATURE if include_default | ||
|
|
||
| unscoped.with_features(features).joins(:capsule_lifecycle_environments). | ||
| where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id }) | ||
| def self.with_environment(environment) | ||
| pulpcore_proxies_with_environment(environment).try(:uniq) | ||
| end | ||
|
|
||
| def self.pulpcore_proxies_with_environment(environment) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be fine, I like avoiding excess queries where possible. |
||
|
|
@@ -448,11 +428,11 @@ def pulp3_url(path = '/pulp/api/v3') | |
| end | ||
|
|
||
| def pulp_mirror? | ||
| self.has_feature?(PULP_NODE_FEATURE) || self.setting(SmartProxy::PULP3_FEATURE, 'mirror') | ||
| self.setting(SmartProxy::PULP3_FEATURE, 'mirror') | ||
| end | ||
|
|
||
| def pulp_primary? | ||
| self.has_feature?(PULP_FEATURE) || self.setting(SmartProxy::PULP3_FEATURE, 'mirror') == false | ||
| !pulp_mirror? | ||
| end | ||
|
|
||
| def supported_pulp_types | ||
|
|
@@ -467,10 +447,6 @@ def supported_pulp_types | |
| supported_types | ||
| end | ||
|
|
||
| #deprecated methods | ||
| alias_method :pulp_node, :pulp_api | ||
| alias_method :default_capsule?, :pulp_primary? | ||
|
|
||
| def associate_organizations | ||
| self.organizations = Organization.all if self.pulp_primary? | ||
| end | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,5 @@ | ||
| <% if !@smart_proxy.new_record? && @smart_proxy.pulp_mirror? -%> | ||
| <div class="tab-pane" id="kt_environments"> | ||
| <%= multiple_selects f, :lifecycle_environments, Katello::KTEnvironment.completer_scope(:organization_id => ::Organization.current.try(:id)), @smart_proxy.lifecycle_environment_ids, {:label => _('Lifecycle Environments')}, @smart_proxy.default_capsule? ? {:disabled => :disabled } : {} %> | ||
|
|
||
| <% if @smart_proxy.default_capsule? %> | ||
| <%= _("Lifecycle environments cannot be modifed on the default Smart proxy. The content from all Lifecycle Environments will exist on this Smart proxy.") % @smart_proxy.name %> | ||
| <% end %> | ||
| <%= multiple_selects f, :lifecycle_environments, Katello::KTEnvironment.completer_scope(:organization_id => ::Organization.current.try(:id)), @smart_proxy.lifecycle_environment_ids, {:label => _('Lifecycle Environments')} %> | ||
| </div> | ||
| <% end -%> |
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.