diff --git a/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb b/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb
index 2a1648af7ad..96eaab6fc44 100644
--- a/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb
+++ b/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb
@@ -10,7 +10,7 @@ def show
end
def action_permission
- if params[:action] == 'pulp_status' || params[:action] == 'pulp_storage'
+ if params[:action] == 'pulp_storage'
:view
else
super
@@ -23,9 +23,9 @@ def action_permission
helper 'bastion/layout'
append_view_path('app/views/foreman')
- before_action :find_resource_and_status, :only => [:pulp_storage, :pulp_status]
def pulp_storage
+ find_resource
@storage = @smart_proxy.pulp_disk_usage
respond_to do |format|
format.html { render :layout => false }
@@ -38,30 +38,6 @@ def pulp_storage
format.json { render :json => {:success => false, :message => e} }
end
end
-
- def pulp_status
- pulp_connection = @proxy_status[:pulp] || @proxy_status[:pulpnode]
- @pulp_status = pulp_connection.status
- if @pulp_status['fatal']
- Rails.logger.warn @pulp_status['fatal']
- respond_to do |format|
- format.html { render :plain => _('Error connecting to Pulp service') }
- format.json { render :json => {:success => false, :message => @pulp_status['fatal']} }
- end
- else
- respond_to do |format|
- format.html { render :layout => false }
- format.json { render :json => {:success => true, :message => @pulp_status} }
- end
- end
- end
- end
-
- private
-
- def find_resource_and_status
- find_resource
- find_status
end
end
end
diff --git a/app/lib/actions/katello/repository/fetch_pxe_files.rb b/app/lib/actions/katello/repository/fetch_pxe_files.rb
index 55325fd9903..0abad4ffa71 100644
--- a/app/lib/actions/katello/repository/fetch_pxe_files.rb
+++ b/app/lib/actions/katello/repository/fetch_pxe_files.rb
@@ -14,7 +14,7 @@ def run
capsule = if input[:capsule_id].present?
SmartProxy.unscoped.find(input[:capsule_id])
else
- SmartProxy.default_capsule!
+ SmartProxy.pulp_primary!
end
downloader = ::Katello::PxeFilesDownloader.new(repository, capsule)
diff --git a/app/lib/actions/katello/repository/refresh_repository.rb b/app/lib/actions/katello/repository/refresh_repository.rb
index ec1dd3fa270..ff3c7a8c118 100644
--- a/app/lib/actions/katello/repository/refresh_repository.rb
+++ b/app/lib/actions/katello/repository/refresh_repository.rb
@@ -6,7 +6,7 @@ def plan(repo, options = {})
User.as_anonymous_admin do
repo = ::Katello::Repository.find(repo.id)
plan_action(Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded,
- repo, SmartProxy.default_capsule!, :dependency => options[:dependency])
+ repo, SmartProxy.pulp_primary!, :dependency => options[:dependency])
repo.smart_proxy_alternate_content_sources.each do |smart_proxy_acs|
plan_action(::Actions::Pulp3::AlternateContentSource::RefreshRemote, smart_proxy_acs)
end
diff --git a/app/models/katello/concerns/smart_proxy_extensions.rb b/app/models/katello/concerns/smart_proxy_extensions.rb
index 1f4610cc7b0..5ee4b5ae639 100644
--- a/app/models/katello/concerns/smart_proxy_extensions.rb
+++ b/app/models/katello/concerns/smart_proxy_extensions.rb
@@ -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)
@@ -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
diff --git a/app/models/katello/ping.rb b/app/models/katello/ping.rb
index a4743cc31a0..56cf8f81f09 100644
--- a/app/models/katello/ping.rb
+++ b/app/models/katello/ping.rb
@@ -9,9 +9,6 @@ def services(capsule_id = nil)
proxy = fetch_proxy(capsule_id)
services = [:candlepin, :candlepin_auth, :foreman_tasks, :katello_events, :candlepin_events]
services += [:pulp3, :pulp3_content] if proxy&.pulp3_enabled?
- if proxy.nil? || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE) || proxy.has_feature?(SmartProxy::PULP_FEATURE)
- services += [:pulp, :pulp_auth]
- end
services
end
@@ -75,12 +72,6 @@ def ping_pulp3_content_without_auth(service_result, capsule_id)
end
end
- def ping_pulp_without_auth(service_result, capsule_id)
- exception_watch(service_result) do
- Katello::Ping.pulp_without_auth(pulp_url(capsule_id))
- end
- end
-
def ping_candlepin_without_auth(service_result)
url = SETTINGS[:katello][:candlepin][:url]
exception_watch(service_result) do
@@ -89,16 +80,6 @@ def ping_candlepin_without_auth(service_result)
end
end
- def ping_pulp_with_auth(service_result, pulp_without_auth_status, capsule_id)
- exception_watch(service_result) do
- if pulp_without_auth_status == OK_RETURN_CODE
- Katello::Pulp::Server.config(pulp_url(capsule_id), User.remote_user).resources.user.retrieve_all
- else
- fail _("Skipped pulp_auth check after failed pulp check")
- end
- end
- end
-
def ping_candlepin_with_auth(service_result)
exception_watch(service_result) do
status = Katello::Resources::Candlepin::CandlepinPing.ping
@@ -150,36 +131,6 @@ def packages
packages.split("\n").sort
end
- def pulp_url(capsule_id)
- proxy = fetch_proxy(capsule_id)
- uri = URI.parse(proxy.pulp_url)
- "#{uri.scheme}://#{uri.host.downcase}/pulp/api/v2/"
- end
-
- # this checks Pulp is running and responding without need
- # for authentication. We don't use RestClient.options here
- # because it returns empty string, which is not enough to say
- # pulp is the one that responded
- def pulp_without_auth(url)
- json = backend_status(url, :pulp)
-
- fail _("Pulp does not appear to be running at %s.") % url if json.empty?
-
- if json['database_connection'] && json['database_connection']['connected'] != true
- fail _("Pulp database connection issue at %s.") % url
- end
-
- if json['messaging_connection'] && json['messaging_connection']['connected'] != true
- fail _("Pulp message bus connection issue at %s.") % url
- end
-
- unless all_pulp_workers_present?(json)
- fail _("Not all necessary pulp workers running at %s.") % url
- end
-
- json
- end
-
def pulp3_without_auth(url)
json = backend_status(url, :pulp)
fail _("Pulp does not appear to be running at %s.") % url if json.empty?
@@ -232,10 +183,8 @@ def ping_services_for_capsule(services, capsule_id)
ping_pulp3_without_auth(result[:pulp3], capsule_id) if result.include?(:pulp3)
ping_pulp3_content_without_auth(result[:pulp3_content], capsule_id) if result.include?(:pulp3_content)
- ping_pulp_without_auth(result[:pulp], capsule_id) if result.include?(:pulp)
ping_candlepin_without_auth(result[:candlepin]) if result.include?(:candlepin)
- ping_pulp_with_auth(result[:pulp_auth], result[:pulp][:status], capsule_id) if result.include?(:pulp_auth)
ping_candlepin_with_auth(result[:candlepin_auth]) if result.include?(:candlepin_auth)
ping_foreman_tasks(result[:foreman_tasks]) if result.include?(:foreman_tasks)
ping_katello_events(result[:katello_events]) if result.include?(:katello_events)
diff --git a/app/services/katello/proxy_status/pulp.rb b/app/services/katello/proxy_status/pulp.rb
deleted file mode 100644
index da53eefa7dd..00000000000
--- a/app/services/katello/proxy_status/pulp.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require 'uri'
-
-module Katello
- module ProxyStatus
- class Pulp < ::ProxyStatus::Base
- def storage
- fetch_proxy_data do
- api.pulp_storage
- end
- end
-
- def status
- begin
- body = RestClient.get(pulp_url)
- rescue => e
- return {'fatal' => _('Unable to connect. Got: %s') % e}
- end
- fail _("Pulp does not appear to be running.") if body.empty?
- json = JSON.parse(body)
- json['errors'] = {}
-
- if json['known_workers'].empty?
- json['errors']['known_workers'] = _("No pulp workers running.")
- end
-
- if json['database_connection'] && json['database_connection']['connected'] != true
- json['errors']['database_connection'] = _("Pulp database connection issue.")
- end
-
- if json['messaging_connection'] && json['messaging_connection']['connected'] != true
- json['errors']['messaging_connection'] = _("Pulp message bus connection issue.")
- end
-
- json
- end
-
- def self.humanized_name
- 'Pulp'
- end
-
- private
-
- def pulp_url
- url = URI.parse(proxy.url)
- url.port = 443
- url.path = '/pulp/api/v2/status/'
- url.to_s
- end
- end
- end
-end
-::ProxyStatus.status_registry.add(Katello::ProxyStatus::Pulp)
diff --git a/app/services/katello/proxy_status/pulp_node.rb b/app/services/katello/proxy_status/pulp_node.rb
deleted file mode 100644
index 1adcc6a7d02..00000000000
--- a/app/services/katello/proxy_status/pulp_node.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module Katello
- module ProxyStatus
- class PulpNode < Katello::ProxyStatus::Pulp
- def self.humanized_name
- 'PulpNode'
- end
- end
- end
-end
-::ProxyStatus.status_registry.add(Katello::ProxyStatus::PulpNode)
diff --git a/app/services/katello/smart_proxy_helper.rb b/app/services/katello/smart_proxy_helper.rb
index efc3b500dc4..c376c537cb9 100644
--- a/app/services/katello/smart_proxy_helper.rb
+++ b/app/services/katello/smart_proxy_helper.rb
@@ -11,10 +11,6 @@ def ==(other)
other.class == self.class && other.smart_proxy == smart_proxy
end
- def default_capsule?
- @smart_proxy.pulp_primary?
- end
-
def lifecycle_environment_check(environment = nil, repository = nil)
environment = repository.environment if repository
diff --git a/app/views/katello/api/v2/capsule_content/sync_status.json.rabl b/app/views/katello/api/v2/capsule_content/sync_status.json.rabl
index 534069bced9..32879930c2a 100644
--- a/app/views/katello/api/v2/capsule_content/sync_status.json.rabl
+++ b/app/views/katello/api/v2/capsule_content/sync_status.json.rabl
@@ -50,7 +50,7 @@ child @lifecycle_environments => :lifecycle_environments do
attributes
end
- if @capsule.has_feature?(SmartProxy::PULP_NODE_FEATURE) || @capsule.has_feature?(SmartProxy::PULP3_FEATURE)
+ if @capsule.has_feature?(SmartProxy::PULP3_FEATURE)
node :counts do |env|
{
:content_views => env.content_views.non_default.count,
diff --git a/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb b/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb
index abe20083577..a141d6de19f 100644
--- a/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb
+++ b/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb
@@ -1,9 +1,5 @@
<% if !@smart_proxy.new_record? && @smart_proxy.pulp_mirror? -%>
- <%= 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')} %>
<% end -%>
diff --git a/app/views/smart_proxies/plugins/_pulp.html.erb b/app/views/smart_proxies/plugins/_pulp.html.erb
deleted file mode 100644
index 37f89d98cb7..00000000000
--- a/app/views/smart_proxies/plugins/_pulp.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
<%= _('Pulp') %>
-
-<%= show_feature_version('pulp') %>
-
diff --git a/app/views/smart_proxies/plugins/_pulp_node.html.erb b/app/views/smart_proxies/plugins/_pulp_node.html.erb
deleted file mode 100644
index 7728601486e..00000000000
--- a/app/views/smart_proxies/plugins/_pulp_node.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
<%= _('Pulp node') %>
-
-<%= show_feature_version('pulpnode') %>
-
diff --git a/app/views/smart_proxies/pulp_status.html.erb b/app/views/smart_proxies/pulp_status.html.erb
deleted file mode 100644
index 71293e5650a..00000000000
--- a/app/views/smart_proxies/pulp_status.html.erb
+++ /dev/null
@@ -1,27 +0,0 @@
-
- <%= _('Pulp server version') %>
-
-
- <%= @pulp_status['versions']['platform_version'] %>
-
-
- <%= _('Database connection') %>
-
-
- <%= boolean_to_icon(@pulp_status['database_connection']['connected']) %>
-
-
- <%= _('Messaging connection') %>
-
-
- <%= boolean_to_icon(@pulp_status['messaging_connection']['connected']) %>
-
-
- <%= _('Workers') %>
-
-
- <%= @pulp_status['known_workers'].size %>
-
-
- <%= _('Supported Content Types') %>
-
diff --git a/db/seeds.d/104-proxy.rb b/db/seeds.d/104-proxy.rb
index 505d3de9646..f37278ed5ce 100644
--- a/db/seeds.d/104-proxy.rb
+++ b/db/seeds.d/104-proxy.rb
@@ -11,12 +11,7 @@ def format_errors(model = nil)
User.as(::User.anonymous_api_admin.login) do
# Proxy features
- feature = Feature.where(:name => 'Pulp').first_or_create
- if feature.nil? || feature.errors.any?
- fail "Unable to create proxy feature: #{format_errors feature}"
- end
-
- ["Pulp", "Pulp Node", "Pulpcore", "Container_Gateway"].each do |input|
+ ["Pulpcore", "Container_Gateway"].each do |input|
f = Feature.where(:name => input).first_or_create
fail "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
end
diff --git a/lib/katello/engine.rb b/lib/katello/engine.rb
index e2193457383..e31f7612122 100644
--- a/lib/katello/engine.rb
+++ b/lib/katello/engine.rb
@@ -192,8 +192,6 @@ class Engine < ::Rails::Engine
::OrganizationsController.include Katello::Concerns::OrganizationsControllerExtensions
# Service extensions
- require "#{Katello::Engine.root}/lib/proxy_api/pulp"
- require "#{Katello::Engine.root}/lib/proxy_api/pulp_node"
require "#{Katello::Engine.root}/lib/proxy_api/container_gateway"
# We need to explicitly load this files because Foreman has
@@ -202,8 +200,6 @@ class Engine < ::Rails::Engine
# require_dependency "#{Katello::Engine.root}/app/lib/katello/api/v2/rendering"
# require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/api_controller"
# require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/v2/api_controller"
- # require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp"
- # require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp_node"
#Api controller extensions
::Api::V2::HostsController.include Katello::Concerns::Api::V2::HostsControllerExtensions
diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb
index 23432fd870b..a3d35e520fc 100644
--- a/lib/katello/plugin.rb
+++ b/lib/katello/plugin.rb
@@ -329,7 +329,7 @@
cx.add_pagelet :details_content,
:name => _('Storage'),
:partial => 'smart_proxies/show/storage',
- :onlyif => proc { |proxy| proxy.has_feature?(SmartProxy::PULP_FEATURE) || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE) || proxy.has_feature?(SmartProxy::PULP3_FEATURE) }
+ :onlyif => proc { |proxy| proxy.has_feature?(SmartProxy::PULP3_FEATURE) }
end
register_facet Katello::Host::ContentFacet, :content_facet do
diff --git a/lib/proxy_api/pulp.rb b/lib/proxy_api/pulp.rb
deleted file mode 100644
index 6b33a8eff80..00000000000
--- a/lib/proxy_api/pulp.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module ProxyAPI
- class Pulp < ::ProxyAPI::Resource
- def initialize(args)
- @url = args[:url] + "/pulp/status"
- super args
- end
-
- def pulp_storage
- @url += "/disk_usage"
- @pulp_storage ||= parse(get)
- rescue => e
- raise ::ProxyAPI::ProxyException.new(url, e, N_("Unable to detect pulp storage"))
- end
-
- def capsule_puppet_path
- @url += "/puppet"
- @capsule_puppet_path ||= parse(get)
- rescue => e
- raise ::ProxyAPI::ProxyException.new(url, e, N_("Unable to detect puppet path"))
- end
- end
-end
diff --git a/lib/proxy_api/pulp_node.rb b/lib/proxy_api/pulp_node.rb
deleted file mode 100644
index 29a2b9b3377..00000000000
--- a/lib/proxy_api/pulp_node.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-module ProxyAPI
- class PulpNode < ::ProxyAPI::Resource
- def initialize(args)
- @url = args[:url] + "/pulpnode/status"
- super args
- end
-
- def pulp_storage
- @url += "/disk_usage"
- @pulp_storage ||= parse(get)
- rescue => e
- raise ::ProxyAPI::ProxyException.new(url, e, N_("Unable to detect pulp storage"))
- end
-
- def capsule_puppet_path
- @url += "/puppet"
- @capsule_puppet_path ||= parse(get)
- rescue => e
- raise ::ProxyAPI::ProxyException.new(url, e, N_("Unable to detect puppet path"))
- end
- end
-end
diff --git a/test/actions/katello/capsule_content_test.rb b/test/actions/katello/capsule_content_test.rb
index 5b825ea17aa..4fed97431f7 100644
--- a/test/actions/katello/capsule_content_test.rb
+++ b/test/actions/katello/capsule_content_test.rb
@@ -22,7 +22,6 @@ class TestBase < ActiveSupport::TestCase
before do
set_user
- SmartProxy.any_instance.stubs(:ping_pulp).returns({})
SmartProxy.any_instance.stubs(:ping_pulp3).returns({})
SmartProxy.any_instance.stubs(:pulp3_configuration).returns(nil)
::Katello::Pulp3::Api::ContentGuard.any_instance.stubs(:list).returns(nil)
diff --git a/test/actions/katello/content_view_version/import_library_test.rb b/test/actions/katello/content_view_version/import_library_test.rb
index 22b95a51216..7c4ea45c39d 100644
--- a/test/actions/katello/content_view_version/import_library_test.rb
+++ b/test/actions/katello/content_view_version/import_library_test.rb
@@ -77,14 +77,11 @@ class ImportLibraryTest < ActiveSupport::TestCase
def setup_proxy
proxy = SmartProxy.pulp_primary
SmartProxy.any_instance.stubs(:pulp_primary).returns(proxy)
- SmartProxy.any_instance.stubs(:pulp_primary!).returns(proxy)
- proxy.smart_proxy_features.where(:feature_id => Feature.find_by(:name => SmartProxy::PULP_FEATURE)).delete_all
end
before do
setup_proxy
Katello::Product.any_instance.stubs(cdn_resource: cdn_resource)
- SmartProxy.any_instance.stubs(:ping_pulp).returns({})
SmartProxy.any_instance.stubs(:ping_pulp3).returns({})
SmartProxy.any_instance.stubs(:pulp3_configuration).returns(nil)
::Katello::Pulp3::Repository.any_instance.stubs(:create_remote).returns(nil)
diff --git a/test/actions/katello/content_view_version/import_repository_test.rb b/test/actions/katello/content_view_version/import_repository_test.rb
index 0a28d4959e8..00ab6cc2976 100644
--- a/test/actions/katello/content_view_version/import_repository_test.rb
+++ b/test/actions/katello/content_view_version/import_repository_test.rb
@@ -65,12 +65,10 @@ def setup_proxy
proxy = SmartProxy.pulp_primary
SmartProxy.any_instance.stubs(:pulp_primary).returns(proxy)
SmartProxy.any_instance.stubs(:pulp_primary!).returns(proxy)
- proxy.smart_proxy_features.where(:feature_id => Feature.find_by(:name => SmartProxy::PULP_FEATURE)).delete_all
end
before do
setup_proxy
- SmartProxy.any_instance.stubs(:ping_pulp).returns({})
SmartProxy.any_instance.stubs(:ping_pulp3).returns({})
SmartProxy.any_instance.stubs(:pulp3_configuration).returns(nil)
::Katello::Pulp3::Repository.any_instance.stubs(:create_remote).returns(nil)
diff --git a/test/actions/katello/content_view_version/import_test.rb b/test/actions/katello/content_view_version/import_test.rb
index 797586b698a..707af06c18d 100644
--- a/test/actions/katello/content_view_version/import_test.rb
+++ b/test/actions/katello/content_view_version/import_test.rb
@@ -70,7 +70,6 @@ class TestBase < ActiveSupport::TestCase
def setup_proxy
proxy = SmartProxy.pulp_primary
SmartProxy.any_instance.stubs(:pulp_primary).returns(proxy)
- proxy.smart_proxy_features.where(:feature_id => Feature.find_by(:name => SmartProxy::PULP_FEATURE)).delete_all
end
before do
diff --git a/test/actions/katello/orphan_cleanup/remove_orphans_test.rb b/test/actions/katello/orphan_cleanup/remove_orphans_test.rb
index 7380c74a9bc..e22bfd1f59d 100644
--- a/test/actions/katello/orphan_cleanup/remove_orphans_test.rb
+++ b/test/actions/katello/orphan_cleanup/remove_orphans_test.rb
@@ -22,7 +22,6 @@ class TestBase < ActiveSupport::TestCase
before do
set_user
- SmartProxy.any_instance.stubs(:ping_pulp).returns({})
SmartProxy.any_instance.stubs(:ping_pulp3).returns({})
end
end
@@ -40,8 +39,7 @@ class RemoveOrphansPlanTest < TestBase
end
it 'plans proxy orphans cleanup without content unit orphan cleanup on pulp3 mirror' do
- smart_proxy = FactoryBot.create(:smart_proxy, :pulp_mirror, :with_pulp3)
- smart_proxy.stubs(:pulp_primary?).returns(false)
+ smart_proxy = FactoryBot.create(:smart_proxy, :pulp_mirror)
tree = plan_action_tree(action_class, smart_proxy)
assert_tree_planned_with(tree, Actions::Pulp3::OrphanCleanup::RemoveOrphans)
diff --git a/test/controllers/api/v2/hosts_controller_test.rb b/test/controllers/api/v2/hosts_controller_test.rb
index 8b2091b5aec..1039f2deb63 100644
--- a/test/controllers/api/v2/hosts_controller_test.rb
+++ b/test/controllers/api/v2/hosts_controller_test.rb
@@ -239,7 +239,7 @@ def test_update_subscription_facet
end
def test_with_smartproxy
- smart_proxy = FactoryBot.create(:smart_proxy, :features => [FactoryBot.create(:feature, name: 'Pulp')])
+ smart_proxy = FactoryBot.create(:smart_proxy, :with_pulp3)
host = FactoryBot.create(:host, :with_content, :with_subscription, :with_operatingsystem, :content_view => @content_view,
:lifecycle_environment => @environment, :content_source => smart_proxy)
host_show(host, smart_proxy)
diff --git a/test/controllers/api/v2/smart_proxies_controller_test.rb b/test/controllers/api/v2/smart_proxies_controller_test.rb
index 47e12641c00..1c817fae75f 100644
--- a/test/controllers/api/v2/smart_proxies_controller_test.rb
+++ b/test/controllers/api/v2/smart_proxies_controller_test.rb
@@ -2,7 +2,7 @@
class Api::V2::SmartProxiesControllerTest < ActionController::TestCase
def models
- @smart_proxy = FactoryBot.create(:smart_proxy, :features => [FactoryBot.create(:feature, name: 'Pulp')])
+ @smart_proxy = FactoryBot.create(:smart_proxy, :with_pulp3)
@http_proxy = http_proxies(:myhttpproxy)
end
diff --git a/test/controllers/foreman/smart_proxies_controller_test.rb b/test/controllers/foreman/smart_proxies_controller_test.rb
index 4ebd8d1a660..7a72df8422d 100644
--- a/test/controllers/foreman/smart_proxies_controller_test.rb
+++ b/test/controllers/foreman/smart_proxies_controller_test.rb
@@ -17,22 +17,11 @@ def proxy_storage_response
ProxyAPI::Pulp.any_instance.stubs(:pulp_storage).returns(response)
end
- def proxy_status_response
- response = {"known_workers" => [{"last_heartbeat" => "2016-01-20T08:17:02Z", "name" => "scheduler@katello-centos7-devel.example.com"}],
- "messaging_connection" => {"connected" => true},
- "database_connection" => {"connected" => true},
- "api_version" => "2",
- "versions" => {"platform_version" => "2.6.4"},
- "errors" => {}}
- Katello::ProxyStatus::Pulp.any_instance.stubs(:status).returns(response.to_json)
- end
-
def setup
setup_controller_defaults(false)
setup_foreman_routes
login_user(User.find(users(:admin).id))
models
- proxy_status_response
proxy_storage_response
end
@@ -40,9 +29,4 @@ def test_smart_proxy_pulp_storage
get :pulp_storage, params: { :id => @smart_proxy.id }
assert_response :success
end
-
- def test_smart_proxy_pulp_status
- get :pulp_status, params: { :id => @smart_proxy.id }
- assert_response :success
- end
end
diff --git a/test/factories/feature_factory.rb b/test/factories/feature_factory.rb
deleted file mode 100644
index bdf66e6b0d5..00000000000
--- a/test/factories/feature_factory.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-FactoryBot.modify do
- factory :feature do
- factory :pulp do
- name { 'Pulp' }
- end
- end
-end
diff --git a/test/factories/smart_proxy_factory.rb b/test/factories/smart_proxy_factory.rb
index b1d6895a995..d15cc8ef3e6 100644
--- a/test/factories/smart_proxy_factory.rb
+++ b/test/factories/smart_proxy_factory.rb
@@ -4,15 +4,6 @@
download_policy { 'on_demand' }
end
- trait :default_smart_proxy do
- after(:build) do |proxy, _evaluator|
- proxy.features << Feature.find_or_create_by(:name => 'Pulp')
- proxy.url = "https://#{Socket.gethostname}:9090"
- proxy.puppet_path = '/etc/puppet/environments'
- proxy.locations = proxy.organizations = proxy.lifecycle_environments = []
- end
- end
-
trait :with_pulp3 do
after(:create) do |proxy, _evaluator|
plugins = Katello::RepositoryTypeManager.enabled_repository_types.values.map(&:pulp3_plugin).compact
@@ -31,9 +22,8 @@
trait :pulp_mirror do
after(:build) do |proxy, _evaluator|
proxy.locations = proxy.organizations = proxy.lifecycle_environments = []
- proxy.features << Feature.find_or_create_by(:name => 'Pulp Node')
- v3_feature = Feature.find_or_create_by(:name => 'Pulpcore')
+ v3_feature = Feature.find_or_create_by(:name => ::SmartProxy::PULP3_FEATURE)
proxy.features << v3_feature unless proxy.features.include?(v3_feature)
smart_proxy_feature = proxy.smart_proxy_features.find { |spf| spf.feature_id == v3_feature.id }
smart_proxy_feature.settings ||= {}
diff --git a/test/fixtures/models/katello_features.yml b/test/fixtures/models/katello_features.yml
index 9e606a8ec00..37f3fd49791 100644
--- a/test/fixtures/models/katello_features.yml
+++ b/test/fixtures/models/katello_features.yml
@@ -1,6 +1,3 @@
---
pulpcore:
name: Pulpcore
-
-pulp:
- name: Pulp
diff --git a/test/lib/tasks/seeds_test.rb b/test/lib/tasks/seeds_test.rb
index 5f01a3ce812..f1ae3e85ae3 100644
--- a/test/lib/tasks/seeds_test.rb
+++ b/test/lib/tasks/seeds_test.rb
@@ -24,11 +24,10 @@ def seed_location
end
class PulpProxyTest < ActiveSupport::TestCase
- test "Make sure Pulp Proxy features exist" do
+ test "Make sure Pulpcore feature exists" do
load "#{Katello::Engine.root}/db/seeds.d/104-proxy.rb"
- assert Feature.find_by_name('Pulp').present?
- assert Feature.find_by_name('Pulp Node').present?
+ assert Feature.find_by_name('Pulpcore').present?
end
end
diff --git a/test/models/concerns/host_managed_extensions_test.rb b/test/models/concerns/host_managed_extensions_test.rb
index 40b5133363d..f9f870ac74e 100644
--- a/test/models/concerns/host_managed_extensions_test.rb
+++ b/test/models/concerns/host_managed_extensions_test.rb
@@ -127,8 +127,7 @@ def test_bootc_facts_search
end
def test_smart_proxy_ids_with_katello
- content_source = FactoryBot.create(:smart_proxy,
- :features => [Feature.where(:name => "Pulp Node").first_or_create])
+ content_source = FactoryBot.create(:smart_proxy, :pulp_mirror)
Support::HostSupport.attach_content_facet(@foreman_host, @view, @library)
@foreman_host.content_facet.content_source = content_source
assert_includes @foreman_host.smart_proxy_ids, @foreman_host.content_source_id
diff --git a/test/models/concerns/smart_proxy_extensions_test.rb b/test/models/concerns/smart_proxy_extensions_test.rb
index 021ce3c46b5..d624e5209fe 100644
--- a/test/models/concerns/smart_proxy_extensions_test.rb
+++ b/test/models/concerns/smart_proxy_extensions_test.rb
@@ -378,7 +378,7 @@ def test_destroy_with_content_facet
def test_save_with_organization_location
set_default_location
@proxy.destroy!
- @proxy = FactoryBot.build(:smart_proxy, :default_smart_proxy, :url => 'http://fakepath.com/foo')
+ @proxy = FactoryBot.build(:smart_proxy, :with_pulp3)
@proxy.save!
@proxy_mirror.save!
diff --git a/test/support/capsule_support.rb b/test/support/capsule_support.rb
index 5ba52b42c99..0816b1a6890 100644
--- a/test/support/capsule_support.rb
+++ b/test/support/capsule_support.rb
@@ -1,10 +1,9 @@
module Support
module CapsuleSupport
def pulp_features
- @pulp_node_feature ||= Feature.where(name: SmartProxy::PULP_NODE_FEATURE).first_or_create
@pulp3_feature ||= Feature.where(name: SmartProxy::PULP3_FEATURE).first_or_create
@container_gateway_feature ||= Feature.where(name: SmartProxy::CONTAINER_GATEWAY_FEATURE).first_or_create
- [@pulp_node_feature, @pulp3_feature, @container_gateway_feature]
+ [@pulp3_feature, @container_gateway_feature]
end
def proxy_with_pulp(proxy_resource = nil)