katello 4.1.0.rc2 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_exports_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_imports_controller.rb +2 -2
- data/app/controllers/katello/api/v2/errata_controller.rb +2 -23
- data/app/controllers/katello/api/v2/host_errata_controller.rb +5 -32
- data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -1
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +0 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/host_errata_extensions.rb +41 -0
- data/app/controllers/katello/remote_execution_controller.rb +5 -9
- data/app/lib/actions/candlepin/abstract_async_task.rb +9 -1
- data/app/lib/actions/katello/agent_action.rb +2 -0
- data/app/lib/actions/katello/applicability/repository/regenerate.rb +10 -10
- data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
- data/app/lib/actions/katello/content_view_version/auto_create_redhat_repositories.rb +22 -0
- data/app/lib/actions/katello/content_view_version/import.rb +1 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +12 -15
- data/app/lib/actions/katello/host/upload_package_profile.rb +1 -6
- data/app/lib/actions/katello/host/upload_profiles.rb +2 -41
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +2 -2
- data/app/lib/actions/katello/repository/check_matching_content.rb +13 -14
- data/app/lib/actions/katello/repository/sync.rb +3 -14
- data/app/lib/actions/katello/repository/verify_checksum.rb +1 -1
- data/app/lib/actions/katello/sync_plan/run.rb +7 -2
- data/app/lib/actions/pulp3/content_guard/refresh.rb +6 -10
- data/app/lib/actions/pulp3/content_view_version/destroy_exporter.rb +2 -2
- data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +1 -1
- data/app/lib/actions/pulp3/repository/create_remote.rb +4 -0
- data/app/lib/actions/pulp3/repository/save_version.rb +1 -0
- data/app/lib/katello/errors.rb +1 -1
- data/app/lib/katello/event_daemon/monitor.rb +1 -0
- data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +6 -10
- data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
- data/app/models/katello/authorization/content_view.rb +5 -9
- data/app/models/katello/authorization/organization.rb +4 -4
- data/app/models/katello/concerns/hostgroup_extensions.rb +3 -1
- data/app/models/katello/concerns/pulp_database_unit.rb +42 -0
- data/app/models/katello/concerns/redhat_extensions.rb +18 -10
- data/app/models/katello/content_view_version.rb +26 -2
- data/app/models/katello/erratum.rb +0 -4
- data/app/models/katello/glue/pulp/repo.rb +0 -19
- data/app/models/katello/host/content_facet.rb +11 -20
- data/app/models/katello/host_available_module_stream.rb +4 -4
- data/app/models/katello/module_stream.rb +0 -4
- data/app/models/katello/ping.rb +3 -11
- data/app/models/katello/repository.rb +14 -4
- data/app/models/katello/root_repository.rb +15 -1
- data/app/models/katello/rpm.rb +0 -4
- data/app/services/cert/certs.rb +4 -0
- data/app/services/katello/applicable_host_queue.rb +2 -2
- data/app/services/katello/pulp/yum_metadata_file.rb +6 -2
- data/app/services/katello/pulp3/api/content_guard.rb +39 -5
- data/app/services/katello/pulp3/api/core.rb +3 -3
- data/app/services/katello/pulp3/api/docker.rb +3 -1
- data/app/services/katello/pulp3/content_view_version/import.rb +2 -2
- data/app/services/katello/pulp3/content_view_version/import_validator.rb +39 -14
- data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +23 -10
- data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +6 -0
- data/app/services/katello/pulp3/docker_manifest.rb +3 -9
- data/app/services/katello/pulp3/docker_manifest_list.rb +1 -1
- data/app/services/katello/pulp3/repository/ansible_collection.rb +2 -2
- data/app/services/katello/pulp3/repository/yum.rb +1 -0
- data/app/services/katello/pulp3/task_group.rb +2 -2
- data/app/services/katello/registration_manager.rb +4 -24
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -0
- data/app/views/katello/api/v2/repository_sets/show.json.rabl +9 -5
- data/app/views/overrides/smart_proxies/_download_policy.erb +1 -1
- data/config/initializers/monkeys.rb +1 -0
- data/config/katello.yaml.example +0 -13
- data/config/routes/api/v2.rb +0 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +15 -1
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +18 -22
- data/db/migrate/20210512170039_add_repo_timestamps.rb +6 -0
- data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +11 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +26 -27
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-module-streams-modal.controller.js +1 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +1 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +7 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +5 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-traces.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +7 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +2 -2
- 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/i18n/bastion_katello.pot +5 -10
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +11 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +10 -9
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +6 -9
- data/lib/katello.rb +1 -1
- data/lib/katello/engine.rb +0 -2
- data/lib/katello/permission_creator.rb +7 -14
- data/lib/katello/plugin.rb +9 -0
- data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
- data/lib/katello/tasks/upgrades/4.1/update_content_import_export_perms.rake +33 -0
- data/lib/katello/version.rb +1 -1
- data/lib/monkeys/pulp3_13_checksumfix.rb +17 -0
- data/locale/action_names.rb +39 -39
- data/locale/bn/katello.po +12 -6
- data/locale/cs/katello.po +12 -6
- data/locale/de/katello.po +12 -6
- data/locale/en/katello.po +12 -6
- data/locale/es/katello.po +12 -6
- data/locale/fr/katello.po +13 -9
- data/locale/gu/katello.po +12 -6
- data/locale/hi/katello.po +12 -6
- data/locale/it/katello.po +12 -6
- data/locale/ja/katello.po +13 -9
- data/locale/katello.pot +124 -114
- data/locale/kn/katello.po +12 -6
- data/locale/ko/katello.po +12 -6
- data/locale/mr/katello.po +12 -6
- data/locale/or/katello.po +12 -6
- data/locale/pa/katello.po +12 -6
- data/locale/pt/katello.po +12 -6
- data/locale/pt_BR/katello.po +12 -6
- data/locale/ru/katello.po +12 -6
- data/locale/ta/katello.po +12 -6
- data/locale/te/katello.po +12 -6
- data/locale/zh_CN/katello.po +13 -9
- data/locale/zh_TW/katello.po +12 -6
- data/webpack/components/react-bootstrap-select/index.js +1 -1
- metadata +70 -90
- data/app/lib/actions/katello/host/generate_applicability.rb +0 -41
- data/app/lib/actions/katello/repository/import_applicability.rb +0 -25
- data/app/lib/actions/pulp/consumer.rb +0 -100
- data/app/lib/actions/pulp/consumer/create.rb +0 -19
- data/app/lib/actions/pulp/consumer/destroy.rb +0 -17
- data/app/lib/actions/pulp/consumer/generate_applicability.rb +0 -24
- data/app/lib/actions/pulp/consumer/update.rb +0 -20
- data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +0 -17
- data/app/models/katello/events/import_host_applicability.rb +0 -16
- data/app/services/katello/applicable_content_helper.rb +0 -111
- data/app/services/katello/pulp/consumer.rb +0 -83
- data/app/services/katello/pulp/consumer_group.rb +0 -95
- data/locale/bn/katello.edit.po +0 -8293
- data/locale/bn/katello.po.time_stamp +0 -0
- data/locale/cs/katello.edit.po +0 -8570
- data/locale/cs/katello.po.time_stamp +0 -0
- data/locale/de/katello.edit.po +0 -8329
- data/locale/de/katello.po.time_stamp +0 -0
- data/locale/en/katello.edit.po +0 -8289
- data/locale/en/katello.po.time_stamp +0 -0
- data/locale/es/katello.edit.po +0 -8353
- data/locale/es/katello.po.time_stamp +0 -0
- data/locale/fr/katello.edit.po +0 -8441
- data/locale/fr/katello.po.time_stamp +0 -0
- data/locale/gu/katello.edit.po +0 -8293
- data/locale/gu/katello.po.time_stamp +0 -0
- data/locale/hi/katello.edit.po +0 -8293
- data/locale/hi/katello.po.time_stamp +0 -0
- data/locale/it/katello.edit.po +0 -8313
- data/locale/it/katello.po.time_stamp +0 -0
- data/locale/ja/katello.edit.po +0 -8417
- data/locale/ja/katello.po.time_stamp +0 -0
- data/locale/kn/katello.edit.po +0 -8293
- data/locale/kn/katello.po.time_stamp +0 -0
- data/locale/ko/katello.edit.po +0 -8311
- data/locale/ko/katello.po.time_stamp +0 -0
- data/locale/mr/katello.edit.po +0 -8293
- data/locale/mr/katello.po.time_stamp +0 -0
- data/locale/or/katello.edit.po +0 -8293
- data/locale/or/katello.po.time_stamp +0 -0
- data/locale/pa/katello.edit.po +0 -8294
- data/locale/pa/katello.po.time_stamp +0 -0
- data/locale/pt/katello.edit.po +0 -8293
- data/locale/pt/katello.po.time_stamp +0 -0
- data/locale/pt_BR/katello.edit.po +0 -8351
- data/locale/pt_BR/katello.po.time_stamp +0 -0
- data/locale/ru/katello.edit.po +0 -8319
- data/locale/ru/katello.po.time_stamp +0 -0
- data/locale/ta/katello.edit.po +0 -8293
- data/locale/ta/katello.po.time_stamp +0 -0
- data/locale/te/katello.edit.po +0 -8293
- data/locale/te/katello.po.time_stamp +0 -0
- data/locale/zh_CN/katello.edit.po +0 -8417
- data/locale/zh_CN/katello.po.time_stamp +0 -0
- data/locale/zh_TW/katello.edit.po +0 -8329
- data/locale/zh_TW/katello.po.time_stamp +0 -0
|
@@ -13,7 +13,6 @@ module Actions
|
|
|
13
13
|
|
|
14
14
|
sequence do
|
|
15
15
|
plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
|
|
16
|
-
plan_action(GenerateApplicability, [host])
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -33,52 +32,12 @@ module Actions
|
|
|
33
32
|
Dynflow::Action::Rescue::Skip
|
|
34
33
|
end
|
|
35
34
|
|
|
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
|
-
if SmartProxy.pulp_primary&.has_feature?(SmartProxy::PULP_FEATURE)
|
|
64
|
-
unless module_stream_profile.empty?
|
|
65
|
-
begin
|
|
66
|
-
::Katello::Pulp::Consumer.new(host.content_facet.uuid).
|
|
67
|
-
upload_module_stream_profile(module_stream_profile)
|
|
68
|
-
rescue RestClient::ResourceNotFound
|
|
69
|
-
Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
35
|
def import_module_streams(payload, host)
|
|
76
36
|
enabled_payload = payload.map do |profile|
|
|
77
37
|
profile.slice("name", "stream", "version", "context", "arch").with_indifferent_access if profile["status"] == "enabled"
|
|
78
38
|
end
|
|
79
39
|
enabled_payload.compact!
|
|
80
40
|
|
|
81
|
-
UploadProfiles.upload_modules_to_pulp(enabled_payload, host)
|
|
82
41
|
host.import_module_streams(payload)
|
|
83
42
|
end
|
|
84
43
|
|
|
@@ -124,6 +83,8 @@ module Actions
|
|
|
124
83
|
module_streams.each do |module_stream_payload|
|
|
125
84
|
import_module_streams(module_stream_payload, host)
|
|
126
85
|
end
|
|
86
|
+
|
|
87
|
+
::Katello::Host::ContentFacet.trigger_applicability_generation(host.id)
|
|
127
88
|
end
|
|
128
89
|
end
|
|
129
90
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module Actions
|
|
2
2
|
module Katello
|
|
3
3
|
module OrphanCleanup
|
|
4
|
-
class RemoveOrphans <
|
|
4
|
+
class RemoveOrphans < Actions::Base
|
|
5
5
|
input_format do
|
|
6
6
|
param :capsule_id
|
|
7
7
|
end
|
|
8
8
|
def plan(proxy)
|
|
9
9
|
sequence do
|
|
10
|
-
plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy)
|
|
10
|
+
plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy) if (proxy.has_feature?(SmartProxy::PULP_FEATURE) || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE))
|
|
11
11
|
if proxy.pulp3_enabled?
|
|
12
12
|
plan_action(
|
|
13
13
|
Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans,
|
|
@@ -13,6 +13,7 @@ module Actions
|
|
|
13
13
|
def run
|
|
14
14
|
source_repo = ::Katello::Repository.find(input[:source_repo_id])
|
|
15
15
|
target_repo = ::Katello::Repository.find(input[:target_repo_id])
|
|
16
|
+
target_repo_published = target_repo.backend_service(SmartProxy.pulp_primary).published?
|
|
16
17
|
|
|
17
18
|
if source_repo.content_type == ::Katello::Repository::YUM_TYPE
|
|
18
19
|
srpms_match = srpms_match?(source_repo, target_repo)
|
|
@@ -23,16 +24,14 @@ module Actions
|
|
|
23
24
|
yum_metadata_files = yum_metadata_files_match?(source_repo, target_repo)
|
|
24
25
|
checksum_match = (target_repo.saved_checksum_type == source_repo.saved_checksum_type)
|
|
25
26
|
|
|
26
|
-
published = target_repo.backend_service(SmartProxy.pulp_primary).published?
|
|
27
|
-
|
|
28
27
|
output[:checksum_match] = checksum_match
|
|
29
|
-
output[:matching_content] = yum_metadata_files && srpms_match && rpms && errata && package_groups && distributions &&
|
|
28
|
+
output[:matching_content] = yum_metadata_files && srpms_match && rpms && errata && package_groups && distributions && target_repo_published && checksum_match
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
if source_repo.content_type == ::Katello::Repository::DEB_TYPE
|
|
33
32
|
debs = debs_match?(source_repo, target_repo)
|
|
34
33
|
|
|
35
|
-
output[:matching_content] = debs &&
|
|
34
|
+
output[:matching_content] = debs && target_repo_published
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -41,26 +40,26 @@ module Actions
|
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
def srpms_match?(source_repo, target_repo)
|
|
44
|
-
source_repo_ids = source_repo.srpm_ids.sort
|
|
45
|
-
target_repo_ids = target_repo.srpm_ids.sort
|
|
43
|
+
source_repo_ids = source_repo.srpm_ids.sort.uniq
|
|
44
|
+
target_repo_ids = target_repo.srpm_ids.sort.uniq
|
|
46
45
|
source_repo_ids == target_repo_ids
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def rpms_match?(source_repo, target_repo)
|
|
50
|
-
source_repo_ids = source_repo.rpm_ids.sort
|
|
51
|
-
target_repo_ids = target_repo.rpm_ids.sort
|
|
49
|
+
source_repo_ids = source_repo.rpm_ids.sort.uniq
|
|
50
|
+
target_repo_ids = target_repo.rpm_ids.sort.uniq
|
|
52
51
|
source_repo_ids == target_repo_ids
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
def errata_match?(source_repo, target_repo)
|
|
56
|
-
source_repo_ids = source_repo.erratum_ids.sort
|
|
57
|
-
target_repo_ids = target_repo.erratum_ids.sort
|
|
55
|
+
source_repo_ids = source_repo.erratum_ids.sort.uniq
|
|
56
|
+
target_repo_ids = target_repo.erratum_ids.sort.uniq
|
|
58
57
|
source_repo_ids == target_repo_ids
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
def package_groups_match?(source_repo, target_repo)
|
|
62
|
-
source_repo_ids = source_repo.package_groups.order(:name).pluck(:name)
|
|
63
|
-
target_repo_ids = target_repo.package_groups.order(:name).pluck(:name)
|
|
61
|
+
source_repo_ids = source_repo.package_groups.order(:name).pluck(:name).uniq
|
|
62
|
+
target_repo_ids = target_repo.package_groups.order(:name).pluck(:name).uniq
|
|
64
63
|
source_repo_ids == target_repo_ids
|
|
65
64
|
end
|
|
66
65
|
|
|
@@ -69,8 +68,8 @@ module Actions
|
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
def yum_metadata_files_match?(source_repo, target_repo)
|
|
72
|
-
source_repo_items = source_repo.yum_metadata_files.pluck(:name, :checksum).sort
|
|
73
|
-
target_repo_items = target_repo.yum_metadata_files.pluck(:name, :checksum).sort
|
|
71
|
+
source_repo_items = source_repo.yum_metadata_files.pluck(:name, :checksum).sort.uniq
|
|
72
|
+
target_repo_items = target_repo.yum_metadata_files.pluck(:name, :checksum).sort.uniq
|
|
74
73
|
source_repo_items == target_repo_items
|
|
75
74
|
end
|
|
76
75
|
end
|
|
@@ -21,14 +21,14 @@ module Actions
|
|
|
21
21
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
22
22
|
# rubocop:disable Metrics/PerceivedComplexity
|
|
23
23
|
# rubocop:disable Metrics/AbcSize
|
|
24
|
-
def plan(repo,
|
|
24
|
+
def plan(repo, options = {})
|
|
25
25
|
action_subject(repo)
|
|
26
26
|
|
|
27
27
|
source_url = options.fetch(:source_url, nil)
|
|
28
28
|
incremental = options.fetch(:incremental, false)
|
|
29
29
|
validate_contents = options.fetch(:validate_contents, false)
|
|
30
30
|
skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && repo.yum?)
|
|
31
|
-
generate_applicability = repo.yum?
|
|
31
|
+
generate_applicability = options.fetch(:generate_applicability, repo.yum?)
|
|
32
32
|
|
|
33
33
|
fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
|
|
34
34
|
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
|
|
@@ -68,13 +68,10 @@ module Actions
|
|
|
68
68
|
plan_action(Pulp::Repository::Download, :pulp_id => repo.pulp_id, :options => {:verify_all_units => true}) if validate_contents && repo.yum?
|
|
69
69
|
plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check && repo.yum?
|
|
70
70
|
plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
|
|
71
|
-
if generate_applicability
|
|
72
|
-
regenerate_applicability(repo, contents_changed)
|
|
73
|
-
end
|
|
71
|
+
plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability
|
|
74
72
|
end
|
|
75
73
|
plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
|
|
76
74
|
:contents_changed => contents_changed)
|
|
77
|
-
plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed) if generate_applicability
|
|
78
75
|
plan_action(Katello::Repository::SyncHook, :id => repo.id)
|
|
79
76
|
end
|
|
80
77
|
end
|
|
@@ -115,14 +112,6 @@ module Actions
|
|
|
115
112
|
end
|
|
116
113
|
end
|
|
117
114
|
|
|
118
|
-
def regenerate_applicability(repo, contents_changed)
|
|
119
|
-
if SETTINGS[:katello][:katello_applicability]
|
|
120
|
-
plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_id => repo.id, :contents_changed => contents_changed)
|
|
121
|
-
else
|
|
122
|
-
plan_action(Pulp::Repository::RegenerateApplicability, :repository_id => repo.id, :contents_changed => contents_changed)
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
115
|
def rescue_strategy
|
|
127
116
|
Dynflow::Action::Rescue::Skip
|
|
128
117
|
end
|
|
@@ -19,8 +19,13 @@ module Actions
|
|
|
19
19
|
syncable_products = sync_plan.products.syncable
|
|
20
20
|
syncable_roots = ::Katello::RootRepository.where(:product_id => syncable_products).has_url
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
sequence do
|
|
23
|
+
plan_self(:sync_plan_name => sync_plan.name)
|
|
24
|
+
if syncable_roots.any?
|
|
25
|
+
plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance).compact, generate_applicability: false)
|
|
26
|
+
plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => syncable_roots.map(&:library_instance).map(&:id))
|
|
27
|
+
end
|
|
28
|
+
end
|
|
24
29
|
end
|
|
25
30
|
end
|
|
26
31
|
|
|
@@ -2,16 +2,12 @@ module Actions
|
|
|
2
2
|
module Pulp3
|
|
3
3
|
module ContentGuard
|
|
4
4
|
class Refresh < Pulp3::Abstract
|
|
5
|
-
def plan(smart_proxy
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
else
|
|
12
|
-
content_guard_api.create
|
|
13
|
-
::Katello::Pulp3::ContentGuard.import(smart_proxy)
|
|
14
|
-
end
|
|
5
|
+
def plan(smart_proxy)
|
|
6
|
+
plan_self(smart_proxy_id: smart_proxy.id)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def run
|
|
10
|
+
::Katello::Pulp3::Api::ContentGuard.new(smart_proxy).refresh
|
|
15
11
|
end
|
|
16
12
|
end
|
|
17
13
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module Actions
|
|
2
2
|
module Pulp3
|
|
3
3
|
module ContentViewVersion
|
|
4
|
-
class DestroyExporter < Pulp3::
|
|
4
|
+
class DestroyExporter < Pulp3::AbstractAsyncTask
|
|
5
5
|
input_format do
|
|
6
6
|
param :smart_proxy_id, Integer
|
|
7
7
|
param :exporter_data, Hash
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def
|
|
10
|
+
def invoke_external_task
|
|
11
11
|
::Katello::Pulp3::ContentViewVersion::Export.new(smart_proxy: smart_proxy).destroy_exporter(input[:exporter_data][:pulp_href])
|
|
12
12
|
end
|
|
13
13
|
end
|
data/app/lib/katello/errors.rb
CHANGED
|
@@ -53,7 +53,7 @@ module Katello
|
|
|
53
53
|
|
|
54
54
|
class PulpcoreMissingCapabilities < StandardError
|
|
55
55
|
def message
|
|
56
|
-
_("A smart proxy seems to have been refreshed without pulpcore being running.
|
|
56
|
+
_("A smart proxy seems to have been refreshed without pulpcore being running. Please refresh the smart proxy after ensuring that pulpcore services are running.")
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -2,8 +2,6 @@ module Katello
|
|
|
2
2
|
module EventDaemon
|
|
3
3
|
module Services
|
|
4
4
|
class AgentEventReceiver
|
|
5
|
-
STATUS_CACHE_KEY = 'katello_agent_events'.freeze
|
|
6
|
-
|
|
7
5
|
class Handler
|
|
8
6
|
attr_accessor :processed, :failed
|
|
9
7
|
|
|
@@ -48,14 +46,12 @@ module Katello
|
|
|
48
46
|
@agent_connection&.open? && @thread&.status.present?
|
|
49
47
|
end
|
|
50
48
|
|
|
51
|
-
def self.status
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
end
|
|
49
|
+
def self.status
|
|
50
|
+
{
|
|
51
|
+
running: running?,
|
|
52
|
+
processed_count: @handler&.processed || 0,
|
|
53
|
+
failed_count: @handler&.failed || 0
|
|
54
|
+
}
|
|
59
55
|
end
|
|
60
56
|
end
|
|
61
57
|
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Used exclusively by fix_hostgroup_facets.rake task
|
|
2
|
+
module Katello
|
|
3
|
+
module Util
|
|
4
|
+
class HostgroupFacetsHelper
|
|
5
|
+
def initialize
|
|
6
|
+
@logger = Logger.new($stdout)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def interested_hostgroups
|
|
10
|
+
groups = ::Hostgroup.unscoped.where(
|
|
11
|
+
id: Katello::Hostgroup::ContentFacet.
|
|
12
|
+
where(content_source_id: nil,
|
|
13
|
+
kickstart_repository_id: nil,
|
|
14
|
+
content_view_id: nil,
|
|
15
|
+
lifecycle_environment_id: nil).select(:hostgroup_id))
|
|
16
|
+
parents = groups.select { |group| group.parent.blank? }
|
|
17
|
+
children = groups.reject { |group| group.parent.blank? }
|
|
18
|
+
# we want the parents to get created before the children
|
|
19
|
+
# hence the order
|
|
20
|
+
parents + children
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def pick_facet_values(hg)
|
|
24
|
+
# This call looks at the audit logs for a host group.
|
|
25
|
+
# Pries out information related to lce, ks, cv and content_source_id from the audit logs.
|
|
26
|
+
# The audit logs typically only contain updates.
|
|
27
|
+
# So if the user changed just the content_view_id, then that is the only thing marked as audited_changes.
|
|
28
|
+
# Hence we need to go through all the audit logs until we have information on lce, ks, cv and cs.
|
|
29
|
+
# If there was only one audit log and that was during the creation of hostgroup
|
|
30
|
+
# the audited changes look like this
|
|
31
|
+
# ```ruby
|
|
32
|
+
# {
|
|
33
|
+
# content_view_id: 10,
|
|
34
|
+
# kickstart_repository_id: 1000
|
|
35
|
+
# ......
|
|
36
|
+
# }
|
|
37
|
+
# ```
|
|
38
|
+
# However if you updated the hostgroup and set the kickstart_repository_id, or
|
|
39
|
+
# content_view_id then audited changes look like
|
|
40
|
+
# ```ruby
|
|
41
|
+
# {
|
|
42
|
+
# content_view_id: [10, 11],
|
|
43
|
+
# kickstart_repository_id: [1000, 1200]
|
|
44
|
+
# ......
|
|
45
|
+
# }
|
|
46
|
+
# ```
|
|
47
|
+
# So the code says "if the attribute value is an array pick the last value else just keep the value as it is "
|
|
48
|
+
|
|
49
|
+
# Further along it is to be noted that `hostgroup.audits` returns the audits ordered by the version number in ascending order, so the latest audit will be `hostgroup.audits.last`
|
|
50
|
+
|
|
51
|
+
# We want to iterate though each audit from latest audit to start, and as soon as we find a content_view_id key or kickstart_repository_id key or lifecycle environment_id key or content_source_id key we want it to be set once.
|
|
52
|
+
|
|
53
|
+
# So if I had an audit history like
|
|
54
|
+
# ``` ruby
|
|
55
|
+
# {
|
|
56
|
+
# content_view_id: 10,
|
|
57
|
+
# kickstart_repository_id: 1000,
|
|
58
|
+
# version:1
|
|
59
|
+
# ......
|
|
60
|
+
# },
|
|
61
|
+
# {
|
|
62
|
+
# content_view_id: [10, 11],
|
|
63
|
+
# kickstart_repository_id: [1000, 1200],
|
|
64
|
+
# version: 2
|
|
65
|
+
# ......
|
|
66
|
+
# }
|
|
67
|
+
# ```
|
|
68
|
+
|
|
69
|
+
# The code would start at version 2, notice that cv_id and ks_repo were set there
|
|
70
|
+
# and keep them as the final.
|
|
71
|
+
# So when it goes to version 1 since cv_id and ks_repo are already set,
|
|
72
|
+
# it will ignore. It will finally
|
|
73
|
+
# return {content_view_id: 11, kickstart_repository_id: 1200}
|
|
74
|
+
facet_values = {}
|
|
75
|
+
hg.audits.reverse_each do |audit|
|
|
76
|
+
hg_changes = audit.audited_changes.slice("lifecycle_environment_id",
|
|
77
|
+
"kickstart_repository_id",
|
|
78
|
+
"content_view_id",
|
|
79
|
+
"content_source_id")
|
|
80
|
+
facet_values = hg_changes.merge(facet_values)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
values = facet_values.map do |k, v|
|
|
84
|
+
v = v[-1] if v.is_a? Array
|
|
85
|
+
[k, v]
|
|
86
|
+
end
|
|
87
|
+
values.to_h.with_indifferent_access
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def main
|
|
91
|
+
bad_hgs = []
|
|
92
|
+
good_hgs = []
|
|
93
|
+
|
|
94
|
+
groups = interested_hostgroups.each do |hg|
|
|
95
|
+
facet = hg.content_facet
|
|
96
|
+
values = pick_facet_values(hg)
|
|
97
|
+
if !values.empty? && facet.update(values)
|
|
98
|
+
good_hgs << { hostgroup: hg, facet_values: values }
|
|
99
|
+
else
|
|
100
|
+
bad_hgs << { hostgroup: hg, facet_values: values }
|
|
101
|
+
facet.save(validate: false)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
unless bad_hgs.empty?
|
|
106
|
+
@logger.warn "Some of the hostgroups reported a validation error. "\
|
|
107
|
+
"The hostgroups have been updated. "\
|
|
108
|
+
"Check via the Web UI."
|
|
109
|
+
|
|
110
|
+
bad_hgs.each do |bad_group|
|
|
111
|
+
@logger.warn "Hostgroup #{bad_group[:hostgroup]}"
|
|
112
|
+
@logger.warn "Facet Values #{bad_group[:facet_values]}"
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
unless good_hgs.empty?
|
|
116
|
+
@logger.info "Following hostgroups were succesfully updated."
|
|
117
|
+
good_hgs.each do |good_group|
|
|
118
|
+
@logger.info "Hostgroup #{good_group[:hostgroup]}"
|
|
119
|
+
@logger.info "Facet Values #{good_group[:facet_values]}"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
@logger.info("#{groups.count} Hostgroup(s) were updated.")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|