katello 3.16.0.rc1 → 3.16.0.rc3.1
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/remote_execution_controller.rb +1 -1
- data/app/lib/actions/katello/applicability/hosts/{generate.rb → bulk_generate.rb} +11 -2
- data/app/lib/actions/katello/applicability/repository/regenerate.rb +7 -2
- data/app/lib/actions/katello/host/generate_applicability.rb +7 -2
- data/app/lib/actions/katello/host/upload_profiles.rb +45 -5
- data/app/lib/actions/katello/repository/sync.rb +1 -2
- data/app/lib/actions/katello/repository/update.rb +12 -1
- data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +17 -0
- data/app/lib/actions/pulp3/ContentGuard/refresh.rb +19 -0
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +6 -8
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +1 -1
- data/app/lib/actions/pulp3/repository/copy_content.rb +1 -0
- data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -0
- data/app/lib/actions/pulp3/repository/save_distribution_references.rb +3 -1
- data/app/lib/actions/pulp3/repository/save_version.rb +3 -1
- data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +15 -0
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +10 -1
- data/app/lib/katello/logging.rb +14 -0
- data/app/lib/katello/util/errata.rb +13 -0
- data/app/lib/katello/util/pulpcore_content_filters.rb +32 -0
- data/app/models/katello/concerns/host_managed_extensions.rb +3 -1
- data/app/models/katello/concerns/http_proxy_extensions.rb +30 -7
- data/app/models/katello/concerns/pulp_database_unit.rb +2 -2
- data/app/models/katello/content_view_erratum_filter.rb +29 -0
- data/app/models/katello/content_view_package_filter.rb +16 -1
- data/app/models/katello/content_view_package_group_filter.rb +7 -0
- data/app/models/katello/events/generate_host_applicability.rb +6 -5
- data/app/models/katello/glue/candlepin/candlepin_object.rb +9 -5
- data/app/models/katello/glue/candlepin/pool.rb +8 -3
- data/app/models/katello/glue/provider.rb +11 -4
- data/app/models/katello/host/content_facet.rb +2 -1
- data/app/models/katello/host_queue_element.rb +4 -0
- data/app/models/katello/package_group.rb +2 -1
- data/app/models/katello/pool.rb +1 -1
- data/app/models/katello/pulp3/content_guard.rb +14 -0
- data/app/models/katello/repository.rb +6 -2
- data/app/models/katello/rhsm_fact_parser.rb +4 -0
- data/app/models/katello/root_repository.rb +4 -1
- data/app/models/katello/subscription.rb +2 -0
- data/app/models/setting/content.rb +3 -1
- data/app/services/katello/applicability/applicable_content_helper.rb +27 -13
- data/app/services/katello/applicable_host_queue.rb +21 -0
- data/app/services/katello/pulp/pulp_content_unit.rb +4 -0
- data/app/services/katello/pulp3/api/content_guard.rb +45 -0
- data/app/services/katello/pulp3/api/yum.rb +24 -0
- data/app/services/katello/pulp3/erratum.rb +4 -0
- data/app/services/katello/pulp3/pulp_content_unit.rb +9 -7
- data/app/services/katello/pulp3/repository.rb +21 -5
- data/app/services/katello/pulp3/repository/yum.rb +90 -3
- data/app/services/katello/pulp3/rpm.rb +6 -16
- data/app/services/katello/pulp3/srpm.rb +5 -0
- data/db/migrate/20200407171926_create_content_guard.rb +10 -0
- data/db/migrate/20200511204005_create_katello_host_queue_elements.rb +12 -0
- data/db/migrate/20200526200422_encrypt_root_repository_upstream_password.rb +47 -0
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-traces.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.factory.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +367 -450
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +4046 -2509
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +4277 -2503
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +4372 -2591
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +4013 -2500
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +4127 -2630
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +4024 -2530
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +4492 -2766
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +4293 -2667
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +4072 -2460
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +4004 -2442
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +10 -10
- data/lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake +29 -0
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +51 -43
- data/locale/bn/katello.po +4015 -2558
- data/locale/cs/katello.po +3756 -2221
- data/locale/de/katello.po +4303 -3044
- data/locale/en/katello.po +3137 -1558
- data/locale/es/katello.po +4280 -3012
- data/locale/fr/katello.po +4302 -3080
- data/locale/gu/katello.po +4034 -2584
- data/locale/hi/katello.po +4034 -2575
- data/locale/it/katello.po +4291 -3040
- data/locale/ja/katello.po +4345 -2863
- data/locale/katello.pot +2631 -1460
- data/locale/kn/katello.po +4033 -2585
- data/locale/ko/katello.po +4320 -2815
- data/locale/mr/katello.po +3971 -2506
- data/locale/or/katello.po +4018 -2559
- data/locale/pa/katello.po +3985 -2514
- data/locale/pt/katello.po +3358 -1810
- data/locale/pt_BR/katello.po +4252 -2959
- data/locale/ru/katello.po +4308 -2902
- data/locale/ta/katello.po +4012 -2562
- data/locale/te/katello.po +4046 -2585
- data/locale/zh_CN/katello.po +4344 -2803
- data/locale/zh_TW/katello.po +4470 -2957
- data/webpack/global_test_setup.js +3 -0
- data/webpack/scenes/Subscriptions/SubscriptionActions.js +12 -14
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +14 -4
- data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +8 -0
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +10 -21
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +11 -6
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +2 -4
- data/webpack/scenes/Subscriptions/index.js +5 -1
- data/webpack/scenes/Tasks/TaskActions.js +2 -1
- data/webpack/test-utils/nockWrapper.js +1 -1
- metadata +30 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c111ad081f2588aaf6e770186fc98a2945887a06e465cdce62cc7fc20d56205
|
4
|
+
data.tar.gz: bb1a4f8f3872e632bf36deb2db63a92753f5f4eaab3cea97bb47d5809d24e9ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30b8f98b25c3a1f04d8796a9e060868e306f802dc50fc140f8d528eec3afe4c2c564d8f20858edb753c9ba75a6c3e56d26636c2b8bdbb5e6363e07d2af1d81a6
|
7
|
+
data.tar.gz: af95e39c10ea7d9ed8805db3dc18be1a58e90a2e24d18fbf9e99ff1eb710abb657737b6a5094c693a2cee42f2bcdc798a9de6395e250645059f3134c89d913c7
|
@@ -2,17 +2,26 @@ module Actions
|
|
2
2
|
module Katello
|
3
3
|
module Applicability
|
4
4
|
module Hosts
|
5
|
-
class
|
5
|
+
class BulkGenerate < Actions::EntryAction
|
6
6
|
input_format do
|
7
7
|
param :host_ids, Array
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
11
|
input[:host_ids].each do |host_id|
|
12
|
-
::
|
12
|
+
content_facet = ::Host.find(host_id).content_facet
|
13
|
+
content_facet.calculate_and_import_applicability
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
def queue
|
18
|
+
::Katello::HOST_TASKS_QUEUE
|
19
|
+
end
|
20
|
+
|
21
|
+
def resource_locks
|
22
|
+
:link
|
23
|
+
end
|
24
|
+
|
16
25
|
def humanized_name
|
17
26
|
_("Bulk generate applicability for hosts")
|
18
27
|
end
|
@@ -11,9 +11,14 @@ module Actions
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
::Katello::Repository.find(input[:repo_id]).
|
15
|
-
|
14
|
+
host_ids = ::Katello::Repository.find(input[:repo_id]).hosts_with_applicability.pluck(:id)
|
15
|
+
return if host_ids.empty?
|
16
|
+
|
17
|
+
host_ids.each do |host_id|
|
18
|
+
::Katello::ApplicableHostQueue.push_host(host_id)
|
16
19
|
end
|
20
|
+
|
21
|
+
::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
|
17
22
|
end
|
18
23
|
|
19
24
|
def humanized_name
|
@@ -8,7 +8,7 @@ module Actions
|
|
8
8
|
|
9
9
|
def plan(hosts, use_queue = true)
|
10
10
|
if SETTINGS[:katello][:katello_applicability]
|
11
|
-
|
11
|
+
plan_self(:host_ids => hosts.map(&:id))
|
12
12
|
else
|
13
13
|
uuids = hosts.map { |host| host.content_facet.try(:uuid) }.compact
|
14
14
|
unless uuids.empty?
|
@@ -19,7 +19,12 @@ module Actions
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def finalize
|
22
|
-
|
22
|
+
if SETTINGS[:katello][:katello_applicability]
|
23
|
+
input[:host_ids].each do |host_id|
|
24
|
+
::Katello::ApplicableHostQueue.push_host(host_id)
|
25
|
+
end
|
26
|
+
::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
|
27
|
+
else
|
23
28
|
input[:host_ids].each do |host_id|
|
24
29
|
if input[:use_queue]
|
25
30
|
::Katello::EventQueue.push_event(::Katello::Events::ImportHostApplicability::EVENT_TYPE, host_id)
|
@@ -33,16 +33,51 @@ module Actions
|
|
33
33
|
Dynflow::Action::Rescue::Skip
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.upload_modules_to_pulp(available_streams, host)
|
37
|
+
query_name_streams = available_streams.map do |profile|
|
38
|
+
::Katello::ModuleStream.where(profile.slice(:name, :stream))
|
39
|
+
end
|
40
|
+
|
41
|
+
updated_profiles = []
|
42
|
+
unless query_name_streams.empty?
|
43
|
+
query_name_streams = query_name_streams.inject(&:or)
|
44
|
+
|
45
|
+
bound_library_instances = host.content_facet.bound_repositories.map(&:library_instance_or_self)
|
46
|
+
query = ::Katello::ModuleStream.in_repositories(bound_library_instances).
|
47
|
+
select(:name, :stream, :version, :context, :arch).
|
48
|
+
merge(query_name_streams)
|
49
|
+
|
50
|
+
updated_profiles = query.map do |module_stream|
|
51
|
+
module_stream.slice(:name, :stream, :version, :context, :arch)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# We also need to pass module streams that are not found in the ModuleStream table
|
56
|
+
# but are present on the content host
|
57
|
+
unassociated_profiles = available_streams.select do |profile|
|
58
|
+
updated_profiles.none? { |p| p[:name] == profile[:name] && p[:stream] == profile[:stream] }
|
59
|
+
end
|
60
|
+
|
61
|
+
module_stream_profile = updated_profiles + unassociated_profiles
|
62
|
+
|
63
|
+
unless module_stream_profile.empty?
|
64
|
+
begin
|
65
|
+
::Katello::Pulp::Consumer.new(host.content_facet.uuid).
|
66
|
+
upload_module_stream_profile(module_stream_profile)
|
67
|
+
rescue RestClient::ResourceNotFound
|
68
|
+
Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
36
73
|
def import_module_streams(payload, host)
|
37
74
|
enabled_payload = payload.map do |profile|
|
38
|
-
profile.slice("name", "stream", "version", "context", "arch") if profile["status"] == "enabled"
|
75
|
+
profile.slice("name", "stream", "version", "context", "arch").with_indifferent_access if profile["status"] == "enabled"
|
39
76
|
end
|
40
77
|
enabled_payload.compact!
|
41
78
|
|
42
|
-
|
79
|
+
UploadProfiles.upload_modules_to_pulp(enabled_payload, host)
|
43
80
|
host.import_module_streams(payload)
|
44
|
-
rescue RestClient::ResourceNotFound
|
45
|
-
Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % input[:host_id])
|
46
81
|
end
|
47
82
|
|
48
83
|
def import_deb_package_profile(host, profile)
|
@@ -69,6 +104,7 @@ module Actions
|
|
69
104
|
payload = profiles.dig("deb_package_profile", "deb_packages") || []
|
70
105
|
import_deb_package_profile(host, payload)
|
71
106
|
else
|
107
|
+
module_streams = []
|
72
108
|
profiles.each do |profile|
|
73
109
|
payload = profile["profile"]
|
74
110
|
case profile["content_type"]
|
@@ -79,9 +115,13 @@ module Actions
|
|
79
115
|
when "enabled_repos"
|
80
116
|
host.import_enabled_repositories(payload)
|
81
117
|
else
|
82
|
-
|
118
|
+
module_streams << payload
|
83
119
|
end
|
84
120
|
end
|
121
|
+
|
122
|
+
module_streams.each do |module_stream_payload|
|
123
|
+
import_module_streams(module_stream_payload, host)
|
124
|
+
end
|
85
125
|
end
|
86
126
|
end
|
87
127
|
end
|
@@ -26,8 +26,7 @@ module Actions
|
|
26
26
|
incremental = options.fetch(:incremental, false)
|
27
27
|
validate_contents = options.fetch(:validate_contents, false)
|
28
28
|
skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && repo.yum?)
|
29
|
-
|
30
|
-
generate_applicability = repo.yum? && !SmartProxy.pulp_master.pulp3_support?(repo)
|
29
|
+
generate_applicability = repo.yum?
|
31
30
|
|
32
31
|
fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
|
33
32
|
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
|
@@ -10,6 +10,8 @@ module Actions
|
|
10
10
|
action_subject root.library_instance
|
11
11
|
|
12
12
|
repo_params[:url] = nil if repo_params[:url] == ''
|
13
|
+
update_cv_cert_protected = (repo_params[:unprotected] != repository.unprotected)
|
14
|
+
|
13
15
|
root.update!(repo_params)
|
14
16
|
|
15
17
|
if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
|
@@ -44,15 +46,24 @@ module Actions
|
|
44
46
|
::Actions::Pulp3::Orchestration::Repository::Update],
|
45
47
|
repository,
|
46
48
|
SmartProxy.pulp_master)
|
47
|
-
plan_self(:repository_id => root.library_instance.id)
|
49
|
+
plan_self(:repository_id => root.library_instance.id, :update_cv_cert_protected => update_cv_cert_protected)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
53
|
def run
|
52
54
|
repository = ::Katello::Repository.find(input[:repository_id])
|
55
|
+
output[:repository_id] = input[:repository_id]
|
56
|
+
output[:update_cv_cert_protected] = input[:update_cv_cert_protected]
|
53
57
|
ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository)
|
54
58
|
end
|
55
59
|
|
60
|
+
def finalize
|
61
|
+
repository = ::Katello::Repository.find(output[:repository_id])
|
62
|
+
if output[:update_cv_cert_protected]
|
63
|
+
ForemanTasks.async_task(::Actions::Katello::Repository::UpdateCVRepoCertGuard, repository, SmartProxy.pulp_master)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
56
67
|
private
|
57
68
|
|
58
69
|
def update_content?(repository)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Repository
|
4
|
+
class UpdateCVRepoCertGuard < Actions::Base
|
5
|
+
include Actions::Katello::PulpSelector
|
6
|
+
|
7
|
+
def plan(repository, smart_proxy)
|
8
|
+
plan_optional_pulp_action([::Actions::Pulp3::Repository::UpdateCVRepositoryCertGuard], repository, smart_proxy)
|
9
|
+
end
|
10
|
+
|
11
|
+
def humanized_name
|
12
|
+
_("Updating repository authentication configuration")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module ContentGuard
|
4
|
+
class Refresh < Pulp3::Abstract
|
5
|
+
def plan(smart_proxy, options = {})
|
6
|
+
return if (::Katello::Pulp3::ContentGuard.count > 0 || options.try(:[], :update))
|
7
|
+
content_guard_api = ::Katello::Pulp3::Api::ContentGuard.new(smart_proxy)
|
8
|
+
if options.try(:[], :update)
|
9
|
+
content_guard_href = ::Katello::Pulp3::ContentGuard.first.href
|
10
|
+
content_guard_api.partial_update content_guard_href
|
11
|
+
else
|
12
|
+
content_guard_api.create
|
13
|
+
::Katello::Pulp3::ContentGuard.import(smart_proxy)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -13,25 +13,23 @@ module Actions
|
|
13
13
|
if filter_ids.present? || rpm_filenames.present? || source_repositories.length > 1
|
14
14
|
sequence do
|
15
15
|
if filter_ids.present? || rpm_filenames.present?
|
16
|
-
copy_action = plan_action(Actions::Pulp3::Repository::CopyContent,
|
17
|
-
source_repositories.first, smart_proxy, target_repo,
|
16
|
+
copy_action = plan_action(Actions::Pulp3::Repository::CopyContent, source_repositories.first, smart_proxy, target_repo,
|
18
17
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
19
18
|
rpm_filenames: rpm_filenames)
|
20
|
-
|
21
|
-
|
19
|
+
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
|
20
|
+
repository_details: { latest_version_href: copy_action.output[:latest_version_href] }, tasks: copy_action.output[:pulp_tasks])
|
22
21
|
else
|
23
22
|
#if we are not filtering, copy the version to the cv repository, and the units for each additional repo
|
24
23
|
action = plan_action(Actions::Pulp3::Repository::CopyVersion, source_repositories.first, smart_proxy, target_repo)
|
25
|
-
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
|
24
|
+
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
|
25
|
+
repository_details: { latest_version_href: action.output[:latest_version_output] }, tasks: action.output[:pulp_tasks])
|
26
26
|
copy_actions = []
|
27
27
|
#since we're creating a new version from the first repo, start copying at the 2nd
|
28
28
|
source_repositories[1..-1].each do |source_repo|
|
29
|
-
copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent,
|
30
|
-
source_repo, smart_proxy, target_repo,
|
29
|
+
copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent, source_repo, smart_proxy, target_repo,
|
31
30
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
32
31
|
rpm_filenames: rpm_filenames)
|
33
32
|
end
|
34
|
-
|
35
33
|
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_actions.last.output[:pulp_tasks])
|
36
34
|
end
|
37
35
|
end
|
@@ -12,7 +12,7 @@ module Actions
|
|
12
12
|
elsif publication_content_type
|
13
13
|
plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options)
|
14
14
|
end
|
15
|
-
|
15
|
+
plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
|
16
16
|
plan_action(Actions::Pulp3::Repository::RefreshDistribution, repository, smart_proxy, :contents_changed => options[:contents_changed]) if repository.environment
|
17
17
|
end
|
18
18
|
end
|
@@ -11,6 +11,7 @@ module Actions
|
|
11
11
|
def invoke_external_task
|
12
12
|
source = ::Katello::Repository.find(input[:source_repository_id])
|
13
13
|
target = ::Katello::Repository.find(input[:target_repository_id] || input[:target_repository])
|
14
|
+
output[:latest_version_href] = target.backend_service(smart_proxy).read.latest_version_href
|
14
15
|
output[:pulp_tasks] = target.backend_service(smart_proxy).copy_content_for_source(source, input)
|
15
16
|
end
|
16
17
|
end
|
@@ -9,6 +9,7 @@ module Actions
|
|
9
9
|
sequence do
|
10
10
|
options = {:repository_id => repository.id, :smart_proxy_id => smart_proxy.id}
|
11
11
|
options[:contents_changed] if options.key?(:contents_changed)
|
12
|
+
plan_action(::Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
|
12
13
|
action = plan_self(options)
|
13
14
|
plan_action(SaveDistributionReferences, repository, smart_proxy,
|
14
15
|
action.output, :contents_changed => options[:contents_changed])
|
@@ -12,9 +12,11 @@ module Actions
|
|
12
12
|
if input[:tasks] && input[:tasks][:pulp_tasks] && input[:tasks][:pulp_tasks].first
|
13
13
|
distribution_hrefs = input[:tasks][:pulp_tasks].map { |task| task[:created_resources].first }
|
14
14
|
distribution_hrefs.compact!
|
15
|
+
repo = ::Katello::Repository.find(input[:repository_id])
|
15
16
|
if distribution_hrefs.any?
|
16
|
-
repo = ::Katello::Repository.find(input[:repository_id])
|
17
17
|
repo.backend_service(smart_proxy).save_distribution_references(distribution_hrefs)
|
18
|
+
else
|
19
|
+
repo.backend_service(smart_proxy).update_distribution
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -11,7 +11,9 @@ module Actions
|
|
11
11
|
|
12
12
|
if input[:tasks]
|
13
13
|
version_href = input[:tasks].last[:created_resources].first
|
14
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
if !version_href && input[:repository_details]
|
15
17
|
version_href = input[:repository_details][:latest_version_href]
|
16
18
|
end
|
17
19
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module Repository
|
4
|
+
class UpdateCVRepositoryCertGuard < Pulp3::Abstract
|
5
|
+
def plan(repository, _smart_proxy)
|
6
|
+
root = repository.root
|
7
|
+
cv_repositories = root.repositories - [root.library_instance]
|
8
|
+
cv_repositories.each do |repo|
|
9
|
+
plan_action(::Actions::Pulp3::Repository::RefreshDistribution, repo, SmartProxy.pulp_master)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -8,7 +8,8 @@ module Katello
|
|
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
10
|
:host_sla, :host_products, :sub_name, :sub_sku, :registered_through, :last_checkin, :host_collections,
|
11
|
-
:host_subscriptions_names, :host_subscriptions, :host_products_names, :host_collections_names
|
11
|
+
:host_subscriptions_names, :host_subscriptions, :host_products_names, :host_collections_names,
|
12
|
+
:host_redhat_subscription_names, :registered_at]
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -28,6 +29,10 @@ module Katello
|
|
28
29
|
host.subscriptions.map(&:name)
|
29
30
|
end
|
30
31
|
|
32
|
+
def host_redhat_subscription_names(host)
|
33
|
+
host.subscriptions.redhat.pluck(:name)
|
34
|
+
end
|
35
|
+
|
31
36
|
def host_content_facet(host)
|
32
37
|
host.content_facet
|
33
38
|
end
|
@@ -71,6 +76,10 @@ module Katello
|
|
71
76
|
host_subscription_facet(host)&.registered_through
|
72
77
|
end
|
73
78
|
|
79
|
+
def registered_at(host)
|
80
|
+
host_subscription_facet(host)&.registered_at
|
81
|
+
end
|
82
|
+
|
74
83
|
def host_applicable_errata_ids(host)
|
75
84
|
host.applicable_errata.map(&:errata_id)
|
76
85
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Katello
|
2
|
+
module Logging
|
3
|
+
def self.time(message, data: {}, logger: Rails.logger, level: :info)
|
4
|
+
start = Time.now
|
5
|
+
|
6
|
+
yield
|
7
|
+
|
8
|
+
data[:duration] = ((Time.now - start) * 1000).truncate(2)
|
9
|
+
data_string = data.map { |k, v| "#{k}=#{v}" }.join(' ')
|
10
|
+
|
11
|
+
logger.send(level, "#{message} #{data_string}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -45,6 +45,19 @@ module Katello
|
|
45
45
|
return errata_list
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
def filter_errata_by_pulp_href(errata, package_pulp_hrefs)
|
50
|
+
return [] if package_pulp_hrefs.empty?
|
51
|
+
rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
|
52
|
+
rpm_filenames = rpms.map { |rpm| File.basename(rpm.filename) }
|
53
|
+
matching_errata = []
|
54
|
+
errata.each do |erratum|
|
55
|
+
if erratum.packages.any? && (erratum.packages.pluck(:filename) - rpm_filenames).empty?
|
56
|
+
matching_errata << erratum
|
57
|
+
end
|
58
|
+
end
|
59
|
+
matching_errata
|
60
|
+
end
|
48
61
|
end
|
49
62
|
end
|
50
63
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Katello
|
2
|
+
module Util
|
3
|
+
module PulpcoreContentFilters
|
4
|
+
def filter_distribution_trees_by_pulp_hrefs(distributiontree_results, _content_pulp_hrefs)
|
5
|
+
distributiontree_results.collect { |result| result.pulp_href }.flatten.uniq
|
6
|
+
end
|
7
|
+
|
8
|
+
def filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs)
|
9
|
+
rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
|
10
|
+
package_groups.reject do |package_group|
|
11
|
+
(package_group.package_names & rpms.pluck(:name)).empty?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def filter_package_environments_by_pulp_hrefs(packageenvironment_results, package_pulp_hrefs)
|
16
|
+
matching_package_env_groups = []
|
17
|
+
|
18
|
+
packageenvironment_results.each do |result|
|
19
|
+
if (result.packagegroups & package_pulp_hrefs).any?
|
20
|
+
matching_package_env_groups << result.pulp_href
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
matching_package_env_groups.flatten.uniq
|
25
|
+
end
|
26
|
+
|
27
|
+
def filter_metadatafiles_by_pulp_hrefs(metadatafiles_results, _package_pulp_hrefs)
|
28
|
+
metadatafiles_results.collect { |result| result.pulp_href }.flatten.uniq
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|