katello 3.14.1 → 3.15.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +3 -3
- data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +2 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +1 -0
- data/app/lib/actions/katello/host/reassign.rb +1 -2
- data/app/lib/actions/katello/host/update_content_view.rb +1 -1
- data/app/lib/actions/katello/host/update_release_version.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
- data/app/lib/actions/katello/product/update_http_proxy.rb +1 -1
- data/app/lib/actions/katello/repository/clone_contents.rb +1 -1
- data/app/lib/actions/katello/repository/clone_to_environment.rb +2 -1
- data/app/lib/actions/katello/repository/create.rb +1 -1
- data/app/lib/actions/katello/repository/metadata_generate.rb +2 -8
- data/app/lib/actions/katello/repository/refresh_repository.rb +5 -1
- data/app/lib/actions/katello/repository/sync.rb +6 -1
- data/app/lib/actions/middleware/execute_if_contents_changed.rb +1 -1
- data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +1 -1
- data/app/lib/actions/pulp/repository/clear.rb +1 -1
- data/app/lib/actions/pulp/repository/remove_units.rb +1 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +1 -2
- data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +1 -1
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +2 -2
- data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -1
- data/app/lib/actions/pulp3/content_migration.rb +17 -0
- data/app/lib/actions/pulp3/import_migration.rb +14 -0
- data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +4 -1
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +3 -3
- data/app/lib/actions/pulp3/orchestration/repository/create.rb +3 -1
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +0 -2
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/refresh_if_needed.rb +18 -0
- data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/remove_units.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/upload_content.rb +1 -1
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_distributions.rb +16 -0
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_remotes.rb +16 -0
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_repository_versions.rb +1 -6
- data/app/lib/actions/pulp3/orphan_cleanup/remove_orphans.rb +15 -0
- data/app/lib/actions/pulp3/orphan_cleanup/remove_unneeded_repos.rb +2 -2
- data/app/lib/actions/pulp3/repository/create.rb +1 -1
- data/app/lib/actions/pulp3/repository/create_publication.rb +1 -1
- data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -0
- data/app/lib/actions/pulp3/repository/refresh_distribution.rb +4 -2
- data/app/lib/actions/pulp3/repository/save_version.rb +12 -8
- data/app/lib/actions/pulp3/repository/upload_file.rb +2 -2
- data/app/lib/katello/api/v2/rendering.rb +1 -0
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +5 -1
- data/app/lib/katello/http_resource.rb +4 -1
- data/app/lib/katello/resources/registry.rb +9 -2
- data/app/models/katello/concerns/content_facet_host_extensions.rb +1 -0
- data/app/models/katello/concerns/organization_extensions.rb +4 -4
- data/app/models/katello/concerns/smart_proxy_extensions.rb +33 -7
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +34 -12
- data/app/models/katello/content_view_docker_filter.rb +1 -1
- data/app/models/katello/content_view_version.rb +20 -47
- data/app/models/katello/glue/candlepin/owner.rb +4 -0
- data/app/models/katello/glue/candlepin/product.rb +12 -6
- data/app/models/katello/glue/pulp/repos.rb +6 -3
- data/app/models/katello/host/subscription_facet.rb +4 -5
- data/app/models/katello/ping.rb +3 -4
- data/app/models/katello/pool.rb +1 -1
- data/app/models/katello/pulp3/distribution_reference.rb +1 -1
- data/app/models/katello/repository.rb +14 -0
- data/app/models/katello/root_repository.rb +0 -2
- data/app/models/katello/subscription_status.rb +7 -0
- data/app/models/setting/content.rb +10 -3
- data/app/services/katello/candlepin/consumer.rb +1 -0
- data/app/services/katello/pulp/repository.rb +1 -1
- data/app/services/katello/pulp/repository/deb.rb +2 -0
- data/app/services/katello/pulp/repository/docker.rb +2 -0
- data/app/services/katello/pulp/repository/file.rb +2 -0
- data/app/services/katello/pulp/repository/yum.rb +9 -5
- data/app/services/katello/pulp3/ansible_collection.rb +1 -1
- data/app/services/katello/pulp3/api/ansible_collection.rb +46 -0
- data/app/services/katello/pulp3/api/core.rb +159 -0
- data/app/services/katello/pulp3/api/docker.rb +62 -0
- data/app/services/katello/pulp3/api/file.rb +54 -0
- data/app/services/katello/pulp3/api/yum.rb +54 -0
- data/app/services/katello/pulp3/distribution.rb +17 -0
- data/app/services/katello/pulp3/docker_blob.rb +1 -1
- data/app/services/katello/pulp3/docker_manifest.rb +1 -1
- data/app/services/katello/pulp3/docker_manifest_list.rb +1 -1
- data/app/services/katello/pulp3/docker_tag.rb +1 -1
- data/app/services/katello/pulp3/erratum.rb +109 -0
- data/app/services/katello/pulp3/file_unit.rb +1 -1
- data/app/services/katello/pulp3/migration.rb +71 -0
- data/app/services/katello/pulp3/migration_plan.rb +27 -0
- data/app/services/katello/pulp3/module_stream.rb +47 -0
- data/app/services/katello/pulp3/package_group.rb +66 -0
- data/app/services/katello/pulp3/pulp_content_unit.rb +9 -1
- data/app/services/katello/pulp3/repository.rb +118 -348
- data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -29
- data/app/services/katello/pulp3/repository/docker.rb +23 -43
- data/app/services/katello/pulp3/repository/file.rb +1 -37
- data/app/services/katello/pulp3/repository/yum.rb +36 -37
- data/app/services/katello/pulp3/repository_mirror.rb +171 -0
- data/app/services/katello/pulp3/rpm.rb +143 -0
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +92 -0
- data/app/services/katello/pulp3/smart_proxy_repository.rb +38 -9
- data/app/services/katello/pulp3/srpm.rb +74 -0
- data/app/services/katello/pulp3/yum_metadata_file.rb +20 -0
- data/app/services/katello/registration_manager.rb +12 -11
- data/app/services/katello/repository_type.rb +11 -3
- data/app/services/katello/repository_type_manager.rb +11 -0
- data/app/views/dashboard/_subscription_widget.html.erb +6 -1
- data/app/views/katello/api/v2/content_view_versions/base.json.rabl +4 -11
- data/app/views/katello/api/v2/docker_manifest_lists/show.json.rabl +2 -1
- data/app/views/katello/api/v2/docker_manifests/show.json.rabl +2 -1
- data/app/views/katello/api/v2/package_groups/show.json.rabl +1 -1
- data/app/views/katello/api/v2/packages/show.json.rabl +2 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +2 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +2 -1
- data/app/views/katello/api/v2/smart_proxies/pulp_info.json.rabl +2 -0
- data/app/views/katello/api/v2/subscription_facet/show.json.rabl +1 -1
- data/app/views/smart_proxies/plugins/_pulp3.html.erb +19 -0
- data/app/views/smart_proxies/pulp_status.html.erb +10 -0
- data/db/migrate/20190930192813_add_pulp3_hrefs_to_content_types.rb +10 -0
- data/db/migrate/20191204020703_migrate_distribution_reference_to_use_repo_id.rb +22 -0
- data/db/migrate/20191204214919_add_content_view_version_counts.rb +7 -0
- data/db/migrate/20191213161248_add_dmi_uuid_to_katello_subscription_facets.rb +6 -0
- data/db/migrate/20200109162354_drop_host_update_lock_setting.rb +5 -0
- data/db/seeds.d/104-proxy.rb +1 -1
- data/db/seeds.d/111-upgrade_tasks.rb +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +3 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +8 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-available-content-views.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-content-views-list.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-http-proxy-modal.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +4 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
- data/lib/katello/engine.rb +25 -25
- data/lib/katello/plugin.rb +1 -1
- data/lib/katello/repository_types/ansible_collection.rb +1 -0
- data/lib/katello/repository_types/docker.rb +2 -1
- data/lib/katello/repository_types/file.rb +1 -1
- data/lib/katello/repository_types/yum.rb +29 -7
- data/lib/katello/tasks/pulp3_content_switchover.rake +21 -0
- data/lib/katello/tasks/pulp3_migration.rake +21 -0
- data/lib/katello/tasks/reset.rake +43 -16
- data/lib/katello/tasks/update_content_default_http_proxy.rake +3 -3
- data/lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake +23 -0
- data/lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/package.json +9 -10
- data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +0 -63
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/redux/reducers/RedHatRepositories/repositorySetRepositories.js +17 -2
- data/webpack/scenes/RedHatRepositories/components/RepositorySet.js +1 -0
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +2 -3
- data/webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js +44 -28
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RepositorySetRepositories.test.js.snap +77 -45
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +2 -6
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionTypeFormatter.test.js.snap +0 -1
- data/webpack/test_setup.js +3 -1
- metadata +62 -24
- data/app/lib/actions/katello/host/update.rb +0 -84
- data/app/lib/actions/pulp3/repository/create_version.rb +0 -19
- data/app/views/katello/api/v2/smart_proxies/download_policy.json.rabl +0 -1
@@ -7,7 +7,7 @@ module Actions
|
|
7
7
|
def plan(repository, smart_proxy, options)
|
8
8
|
sequence do
|
9
9
|
action_output = plan_action(Actions::Pulp3::Repository::Sync, repository, smart_proxy, options).output
|
10
|
-
version_output = plan_action(Pulp3::Repository::SaveVersion, repository, action_output[:pulp_tasks]).output
|
10
|
+
version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
|
11
11
|
plan_action(Pulp3::Orchestration::Repository::GenerateMetadata, repository, smart_proxy, :contents_changed => version_output[:contents_changed])
|
12
12
|
plan_self(:subaction_output => version_output)
|
13
13
|
end
|
@@ -15,7 +15,7 @@ module Actions
|
|
15
15
|
content_unit_href = content_list.results.first.pulp_href
|
16
16
|
end
|
17
17
|
action_output = plan_action(Pulp3::Repository::ImportUpload, content_unit_href, repository, smart_proxy).output
|
18
|
-
plan_action(Pulp3::Repository::SaveVersion, repository, action_output[:pulp_tasks]).output
|
18
|
+
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module OrphanCleanup
|
4
|
+
class DeleteOrphanDistributions < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(smart_proxy)
|
6
|
+
plan_self(:smart_proxy_id => smart_proxy.id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def invoke_external_task
|
10
|
+
smart_proxy_service = ::Katello::Pulp3::SmartProxyRepository.instance_for_type(smart_proxy)
|
11
|
+
smart_proxy_service.delete_orphan_distributions
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module OrphanCleanup
|
4
|
+
class DeleteOrphanRemotes < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(smart_proxy)
|
6
|
+
plan_self(:smart_proxy_id => smart_proxy.id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def invoke_external_task
|
10
|
+
smart_proxy_service = ::Katello::Pulp3::SmartProxyRepository.instance_for_type(smart_proxy)
|
11
|
+
smart_proxy_service.delete_orphan_remotes
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -7,12 +7,7 @@ module Actions
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
|
-
|
11
|
-
if smart_proxy.pulp_mirror?
|
12
|
-
output[:pulp_tasks] = ::Katello::Pulp3::Repository.delete_orphan_repository_versions_for_mirror(smart_proxy)
|
13
|
-
else
|
14
|
-
output[:pulp_tasks] = ::Katello::Pulp3::Repository.delete_orphan_repository_versions(smart_proxy)
|
15
|
-
end
|
10
|
+
output[:pulp_tasks] = ::Katello::Pulp3::SmartProxyRepository.instance_for_type(smart_proxy).delete_orphan_repository_versions
|
16
11
|
end
|
17
12
|
end
|
18
13
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module OrphanCleanup
|
4
|
+
class RemoveOrphans < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(smart_proxy)
|
6
|
+
plan_self(:smart_proxy_id => smart_proxy.id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def invoke_external_task
|
10
|
+
output[:pulp_tasks] = ::Katello::Pulp3::Api::Core.new(smart_proxy).delete_orphans
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -7,8 +7,8 @@ module Actions
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def invoke_external_task
|
10
|
-
smart_proxy_service = ::Katello::Pulp3::SmartProxyRepository.
|
11
|
-
smart_proxy_service.
|
10
|
+
smart_proxy_service = ::Katello::Pulp3::SmartProxyRepository.instance_for_type(smart_proxy)
|
11
|
+
smart_proxy_service.delete_orphan_repositories
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -12,7 +12,7 @@ module Actions
|
|
12
12
|
|
13
13
|
def invoke_external_task
|
14
14
|
repository = ::Katello::Repository.find(input[:repository_id])
|
15
|
-
output[:response] = repository.backend_service(smart_proxy).create_publication
|
15
|
+
output[:response] = repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -15,6 +15,7 @@ module Actions
|
|
15
15
|
ret << _("Total tasks: ") + ": #{finished_units}/#{total_units}"
|
16
16
|
ret << "--------------------------------"
|
17
17
|
progress_reports = sync_task.try(:[], 'progress_reports') || []
|
18
|
+
progress_reports = progress_reports.sort_by { |pr| pr.try(:[], 'message') }
|
18
19
|
progress_reports.each do |pr|
|
19
20
|
done = pr.try(:[], 'done')
|
20
21
|
total = pr.try(:[], 'total') || pr.try(:[], 'done')
|
@@ -7,7 +7,9 @@ module Actions
|
|
7
7
|
|
8
8
|
def plan(repository, smart_proxy, options = {})
|
9
9
|
sequence do
|
10
|
-
|
10
|
+
options = {:repository_id => repository.id, :smart_proxy_id => smart_proxy.id}
|
11
|
+
options[:contents_changed] if options.key?(:contents_changed)
|
12
|
+
action = plan_self(options)
|
11
13
|
plan_action(SaveDistributionReferences, repository, smart_proxy,
|
12
14
|
action.output, :contents_changed => options[:contents_changed])
|
13
15
|
end
|
@@ -15,7 +17,7 @@ module Actions
|
|
15
17
|
|
16
18
|
def invoke_external_task
|
17
19
|
repo = ::Katello::Repository.find(input[:repository_id])
|
18
|
-
output[:response] = repo.backend_service(smart_proxy).refresh_distributions
|
20
|
+
output[:response] = repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -2,20 +2,24 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
4
|
class SaveVersion < Pulp3::Abstract
|
5
|
-
def plan(repository,
|
6
|
-
plan_self(:repository_id => repository.id, :tasks => tasks)
|
5
|
+
def plan(repository, options)
|
6
|
+
plan_self(:repository_id => repository.id, :tasks => options[:tasks], :repository_details => options[:repository_details])
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
|
-
version_href = input[:tasks].last[:created_resources].first
|
11
10
|
repo = ::Katello::Repository.find(input[:repository_id])
|
12
|
-
repo_version = repo.backend_service(::SmartProxy.pulp_master).lookup_version version_href
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
if input[:tasks]
|
13
|
+
version_href = input[:tasks].last[:created_resources].first
|
14
|
+
elsif input[:repository_details]
|
15
|
+
version_href = input[:repository_details][:latest_version_href]
|
16
|
+
end
|
17
|
+
|
18
|
+
if version_href
|
18
19
|
repo.update_attributes(:version_href => version_href)
|
20
|
+
output[:contents_changed] = true
|
21
|
+
else
|
22
|
+
output[:contents_changed] = false
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -9,8 +9,8 @@ module Actions
|
|
9
9
|
def invoke_external_task
|
10
10
|
repo = ::Katello::Repository.find(input[:repository_id])
|
11
11
|
repo_backend_service = repo.backend_service(smart_proxy)
|
12
|
-
upload_class = repo_backend_service.upload_class
|
13
|
-
uploads_api = repo_backend_service.uploads_api
|
12
|
+
upload_class = repo_backend_service.core_api.upload_class
|
13
|
+
uploads_api = repo_backend_service.core_api.uploads_api
|
14
14
|
offset = 0
|
15
15
|
response = nil
|
16
16
|
File.open(input[:file], "rb") do |file|
|
@@ -7,7 +7,7 @@ module Katello
|
|
7
7
|
def allowed_helpers
|
8
8
|
super + [:errata, :host_subscriptions, :host_applicable_errata_ids, :host_applicable_errata_filtered,
|
9
9
|
:host_latest_applicable_rpm_version, :load_pools, :load_errata_applications, :host_content_facet,
|
10
|
-
:host_sla, :host_products, :sub_name, :sub_sku, :registered_through]
|
10
|
+
:host_sla, :host_products, :sub_name, :sub_sku, :registered_through, :last_checkin]
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -65,6 +65,10 @@ module Katello
|
|
65
65
|
load_resource(klass: Pool.readable, search: search, permission: nil, includes: includes)
|
66
66
|
end
|
67
67
|
|
68
|
+
def last_checkin(host)
|
69
|
+
host&.subscription_facet&.last_checkin
|
70
|
+
end
|
71
|
+
|
68
72
|
# rubocop:disable Metrics/MethodLength
|
69
73
|
def load_errata_applications(filter_errata_type: nil, include_last_reboot: 'yes', since: nil, up_to: nil, status: nil)
|
70
74
|
result = []
|
@@ -15,7 +15,8 @@ module Katello
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
class_attribute :consumer_secret, :consumer_key, :ca_cert_file, :prefix, :site, :default_headers
|
18
|
+
class_attribute :consumer_secret, :consumer_key, :ca_cert_file, :prefix, :site, :default_headers,
|
19
|
+
:ssl_client_cert, :ssl_client_key
|
19
20
|
|
20
21
|
attr_reader :json
|
21
22
|
|
@@ -190,6 +191,8 @@ module Katello
|
|
190
191
|
:timeout => SETTINGS[:katello][:rest_client_timeout]
|
191
192
|
}
|
192
193
|
options[:ssl_ca_file] = self.ca_cert_file unless self.ca_cert_file.nil?
|
194
|
+
options[:ssl_client_cert] = self.ssl_client_cert unless self.ssl_client_cert.nil?
|
195
|
+
options[:ssl_client_key] = self.ssl_client_key unless self.ssl_client_key.nil?
|
193
196
|
|
194
197
|
RestClient::Resource.new(url, options)
|
195
198
|
end
|
@@ -12,7 +12,9 @@ module Katello
|
|
12
12
|
|
13
13
|
def self.get(path, headers = {:accept => :json})
|
14
14
|
logger.debug "Sending GET request to Registry: #{path}"
|
15
|
-
|
15
|
+
resource = RegistryResource.load_class
|
16
|
+
joined_path = resource.prefix.chomp("/") + path
|
17
|
+
client = resource.rest_client(Net::HTTP::Get, :get, joined_path)
|
16
18
|
client.get(headers)
|
17
19
|
end
|
18
20
|
end
|
@@ -26,7 +28,10 @@ module Katello
|
|
26
28
|
|
27
29
|
# Pulp 3 has its own registry
|
28
30
|
if pulp_master && pulp_master.pulp3_repository_type_support?(::Katello::Repository::DOCKER_TYPE)
|
29
|
-
|
31
|
+
uri = URI(pulp_master.setting(SmartProxy::PULP3_FEATURE, 'content_app_url'))
|
32
|
+
uri.path = "/pulpcore_registry/"
|
33
|
+
registry_url = uri.to_s
|
34
|
+
|
30
35
|
# Assume the registry uses the same CA as the Smart Proxy
|
31
36
|
ca_cert_file = Setting[:ssl_ca_file]
|
32
37
|
elsif container_config
|
@@ -39,6 +44,8 @@ module Katello
|
|
39
44
|
uri = URI.parse(registry_url)
|
40
45
|
self.prefix = uri.path
|
41
46
|
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
47
|
+
self.ssl_client_cert = ::Cert::Certs.ssl_client_cert
|
48
|
+
self.ssl_client_key = ::Cert::Certs.ssl_client_key
|
42
49
|
self.ca_cert_file = ca_cert_file
|
43
50
|
self
|
44
51
|
end
|
@@ -38,6 +38,7 @@ module Katello
|
|
38
38
|
scoped_search :relation => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
|
39
39
|
scoped_search :relation => :applicable_errata, :on => :errata_id, :rename => :applicable_errata, :complete_value => true, :ext_method => :find_by_applicable_errata, :only_explicit => true
|
40
40
|
scoped_search :relation => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata, :only_explicit => true
|
41
|
+
scoped_search :relation => :applicable_errata, :on => :issued, :rename => :applicable_errata_issued, :complete_value => true, :only_explicit => true
|
41
42
|
scoped_search :relation => :applicable_rpms, :on => :nvra, :rename => :applicable_rpms, :complete_value => true, :ext_method => :find_by_applicable_rpms, :only_explicit => true
|
42
43
|
scoped_search :relation => :applicable_rpms, :on => :nvra, :rename => :upgradable_rpms, :complete_value => true, :ext_method => :find_by_installable_rpms, :only_explicit => true
|
43
44
|
scoped_search :relation => :content_source, :on => :name, :complete_value => true, :rename => :content_source
|
@@ -221,11 +221,11 @@ module Katello
|
|
221
221
|
# doesn't provide much benefit for the frustration it creates.
|
222
222
|
self.save(validate: false)
|
223
223
|
end
|
224
|
-
|
225
|
-
class Jail < ::Safemode::Jail
|
226
|
-
allow :name, :label
|
227
|
-
end
|
228
224
|
end
|
229
225
|
end
|
230
226
|
end
|
231
227
|
end
|
228
|
+
|
229
|
+
class ::Organization::Jail < ::Safemode::Jail
|
230
|
+
allow :label
|
231
|
+
end
|
@@ -15,7 +15,7 @@ module Katello
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
PULP3_FEATURE = "
|
18
|
+
PULP3_FEATURE = "Pulpcore".freeze
|
19
19
|
PULP_FEATURE = "Pulp".freeze
|
20
20
|
PULP_NODE_FEATURE = "Pulp Node".freeze
|
21
21
|
|
@@ -120,8 +120,8 @@ module Katello
|
|
120
120
|
uri = pulp3_uri!
|
121
121
|
config.host = uri.host
|
122
122
|
config.scheme = uri.scheme
|
123
|
-
config.
|
124
|
-
config.
|
123
|
+
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
|
124
|
+
config.ssl_client_key = ::Cert::Certs.ssl_client_key
|
125
125
|
config.debugging = true
|
126
126
|
config.logger = ::Foreman::Logging.logger('katello/pulp_rest')
|
127
127
|
end
|
@@ -152,10 +152,15 @@ module Katello
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
def pulp3_repository_type_support?(repository_type)
|
155
|
+
def pulp3_repository_type_support?(repository_type, check_pulp2_preferred = true)
|
156
156
|
repository_type_obj = repository_type.is_a?(String) ? Katello::RepositoryTypeManager.repository_types[repository_type] : repository_type
|
157
157
|
fail "Cannot find repository type #{repository_type}, is it enabled?" unless repository_type_obj
|
158
|
-
|
158
|
+
|
159
|
+
pulp3_supported = repository_type_obj.pulp3_plugin.present? &&
|
160
|
+
pulp3_enabled? &&
|
161
|
+
self.capabilities(PULP3_FEATURE).try(:include?, repository_type_obj.pulp3_plugin)
|
162
|
+
|
163
|
+
check_pulp2_preferred ? pulp3_supported && !pulp2_preferred_for_type?(repository_type_obj.id) : pulp3_supported
|
159
164
|
end
|
160
165
|
|
161
166
|
def pulp3_content_support?(content_type)
|
@@ -177,7 +182,7 @@ module Katello
|
|
177
182
|
pulp3_uri!.host
|
178
183
|
end
|
179
184
|
|
180
|
-
def pulp3_url(path =
|
185
|
+
def pulp3_url(path = '/pulp/api/v3/')
|
181
186
|
pulp_url = self.setting(PULP3_FEATURE, 'pulp_url')
|
182
187
|
path.blank? ? pulp_url : "#{pulp_url.sub(%r|/$|, '')}/#{path.sub(%r|^/|, '')}"
|
183
188
|
end
|
@@ -190,6 +195,27 @@ module Katello
|
|
190
195
|
self.has_feature? PULP_FEATURE
|
191
196
|
end
|
192
197
|
|
198
|
+
def supported_pulp_types
|
199
|
+
supported_map = {
|
200
|
+
pulp2: { supported_types: [] },
|
201
|
+
pulp3: { supported_types: [], overriden_to_pulp2: [] }
|
202
|
+
}
|
203
|
+
|
204
|
+
::Katello::RepositoryTypeManager.repository_types.keys.each do |type|
|
205
|
+
if pulp3_repository_type_support?(type, false)
|
206
|
+
if pulp2_preferred_for_type?(type)
|
207
|
+
supported_map[:pulp3][:overriden_to_pulp2] << type
|
208
|
+
else
|
209
|
+
supported_map[:pulp3][:supported_types] << type
|
210
|
+
end
|
211
|
+
else
|
212
|
+
supported_map[:pulp2][:supported_types] << type
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
supported_map
|
217
|
+
end
|
218
|
+
|
193
219
|
#deprecated methods
|
194
220
|
alias_method :pulp_node, :pulp_api
|
195
221
|
alias_method :default_capsule?, :pulp_master?
|
@@ -273,7 +299,7 @@ module Katello
|
|
273
299
|
end
|
274
300
|
|
275
301
|
def ping_pulp3
|
276
|
-
::Katello::Ping.pulp3_without_auth(self.pulp3_url
|
302
|
+
::Katello::Ping.pulp3_without_auth(self.pulp3_url)
|
277
303
|
rescue Errno::EHOSTUNREACH, Errno::ECONNREFUSED, RestClient::Exception => error
|
278
304
|
raise ::Katello::Errors::CapsuleCannotBeReached, _("%s is unreachable. %s" % [self.name, error])
|
279
305
|
end
|
@@ -15,21 +15,10 @@ module Katello
|
|
15
15
|
:partial => Katello::SubscriptionStatus::PARTIAL,
|
16
16
|
:invalid => Katello::SubscriptionStatus::INVALID,
|
17
17
|
:unknown => Katello::SubscriptionStatus::UNKNOWN,
|
18
|
+
:disabled => Katello::SubscriptionStatus::DISABLED,
|
18
19
|
:unsubscribed_hypervisor => Katello::SubscriptionStatus::UNSUBSCRIBED_HYPERVISOR
|
19
20
|
}.freeze
|
20
21
|
|
21
|
-
prepend ForemanTasks::Concerns::ActionTriggering
|
22
|
-
|
23
|
-
module Prepended
|
24
|
-
def update_action
|
25
|
-
if subscription_facet.try(:backend_update_needed?)
|
26
|
-
::Actions::Katello::Host::Update
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
prepend Prepended
|
32
|
-
|
33
22
|
accepts_nested_attributes_for :subscription_facet, :update_only => true, :reject_if => lambda { |attrs| attrs.values.compact.empty? }
|
34
23
|
|
35
24
|
has_many :activation_keys, :through => :subscription_facet
|
@@ -70,6 +59,39 @@ module Katello
|
|
70
59
|
scoped_search :on => :purpose_role, :rename => :role, :relation => :subscription_facet, :complete_value => true
|
71
60
|
scoped_search :on => :purpose_usage, :rename => :usage, :relation => :subscription_facet, :complete_value => true
|
72
61
|
scoped_search :on => :name, :rename => :addon, :relation => :purpose_addons, :complete_value => true, :ext_method => :find_by_purpose_addon
|
62
|
+
before_update :update_candlepin_associations, if: -> { subscription_facet.try(:backend_update_needed?) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def update_candlepin_associations(consumer_params = nil)
|
66
|
+
content_facet.save! if content_facet
|
67
|
+
|
68
|
+
auto_attach_enabled_via_checkin = consumer_params.try(:[], 'autoheal')
|
69
|
+
|
70
|
+
if subscription_facet
|
71
|
+
consumer_params ||= subscription_facet.consumer_attributes
|
72
|
+
|
73
|
+
host_uuid = consumer_params.dig(:facts, 'dmi.system.uuid')
|
74
|
+
if ::Katello::Host::SubscriptionFacet.override_dmi_uuid?(host_uuid)
|
75
|
+
# if host reported a dmi uuid to treat as a duplicate, override it with the stored host param
|
76
|
+
override_value = subscription_facet.dmi_uuid_override&.value
|
77
|
+
override_value ||= subscription_facet.update_dmi_uuid_override&.value
|
78
|
+
consumer_params[:facts]['dmi.system.uuid'] = override_value
|
79
|
+
end
|
80
|
+
::Katello::Resources::Candlepin::Consumer.update(subscription_facet.uuid, consumer_params)
|
81
|
+
|
82
|
+
if auto_attach_enabled_via_checkin
|
83
|
+
::Katello::Resources::Candlepin::Consumer.refresh_entitlements(subscription_facet.uuid)
|
84
|
+
end
|
85
|
+
|
86
|
+
if consumer_params.try(:[], :facts)
|
87
|
+
::Katello::Host::SubscriptionFacet.update_facts(self, consumer_params[:facts])
|
88
|
+
end
|
89
|
+
|
90
|
+
unless consumer_params.blank?
|
91
|
+
subscription_facet.update_from_consumer_attributes(consumer_params)
|
92
|
+
subscription_facet.save!
|
93
|
+
end
|
94
|
+
end
|
73
95
|
end
|
74
96
|
|
75
97
|
module ClassMethods
|