katello 3.18.0.rc2.1 → 3.18.2.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/assets/stylesheets/katello/katello.scss +0 -72
- data/app/controllers/katello/api/v2/api_controller.rb +1 -2
- data/app/controllers/katello/api/v2/capsule_content_controller.rb +2 -2
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +98 -0
- data/app/controllers/katello/api/v2/content_exports_controller.rb +84 -0
- data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +56 -94
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +2 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +2 -0
- data/app/controllers/katello/concerns/api/v2/authorization.rb +14 -1
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
- data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -2
- data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +1 -1
- data/app/lib/actions/katello/content_view_version/import.rb +2 -1
- data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +19 -3
- data/app/lib/actions/katello/host/update_system_purpose.rb +1 -1
- data/app/lib/actions/katello/repository/sync.rb +5 -1
- data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +24 -4
- data/app/lib/actions/pulp3/content_migration.rb +10 -0
- data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
- data/app/lib/actions/pulp3/content_migration_reset.rb +22 -0
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/content_view_version/export.rb +3 -2
- data/app/lib/actions/pulp3/import_migration.rb +6 -1
- data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +17 -13
- data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
- data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +0 -4
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
- data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
- data/app/lib/actions/pulp3/repository/delete.rb +1 -1
- data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
- data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -1
- data/app/models/katello/authorization/content_view_version.rb +25 -2
- data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
- data/app/models/katello/authorization/organization.rb +8 -0
- data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
- data/app/models/katello/concerns/pulp_database_unit.rb +19 -0
- data/app/models/katello/concerns/redhat_extensions.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +7 -5
- data/app/models/katello/content_migration_progress.rb +4 -0
- data/app/models/katello/content_view.rb +5 -0
- data/app/models/katello/content_view_history.rb +2 -1
- data/app/models/katello/content_view_package_filter.rb +1 -1
- data/app/models/katello/content_view_version_export_history.rb +6 -1
- data/app/models/katello/file_unit.rb +4 -0
- data/app/models/katello/host/content_facet.rb +9 -31
- data/app/models/katello/host/subscription_facet.rb +4 -0
- data/app/models/katello/ping.rb +35 -15
- data/app/models/katello/repository.rb +7 -0
- data/app/models/katello/subscription_status.rb +3 -2
- data/app/services/katello/applicability/applicable_content_helper.rb +44 -15
- data/app/services/katello/pulp3/api/docker.rb +4 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +63 -5
- data/app/services/katello/pulp3/content_view_version/import.rb +40 -0
- data/app/services/katello/pulp3/content_view_version/import_export_common.rb +0 -16
- data/app/services/katello/pulp3/content_view_version/import_validator.rb +26 -49
- data/app/services/katello/pulp3/docker_manifest.rb +1 -0
- data/app/services/katello/pulp3/docker_tag.rb +1 -0
- data/app/services/katello/pulp3/erratum.rb +2 -1
- data/app/services/katello/pulp3/migration.rb +95 -12
- data/app/services/katello/pulp3/migration_plan.rb +2 -2
- data/app/services/katello/pulp3/migration_switchover.rb +23 -5
- data/app/services/katello/pulp3/repository.rb +10 -5
- data/app/services/katello/pulp3/repository/docker.rb +5 -0
- data/app/services/katello/pulp3/repository/yum.rb +23 -8
- data/app/services/katello/pulp3/rpm.rb +5 -1
- data/app/services/katello/pulp3/task.rb +4 -0
- data/app/services/katello/pulp3/task_group.rb +4 -0
- data/app/views/katello/api/v2/content_views/show.json.rabl +6 -0
- data/app/views/katello/layouts/react.html.erb +3 -2
- data/app/views/katello/sync_management/_products.html.erb +1 -1
- data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
- data/config/routes/api/v2.rb +23 -3
- data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +5 -2
- data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
- data/db/migrate/20210201165835_add_migration_missing_content.rb +12 -0
- data/engines/bastion/app/assets/javascripts/bastion/auth/authorization.service.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +35 -40
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +8 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +9 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +78 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
- data/lib/katello/permission_creator.rb +23 -3
- data/lib/katello/tasks/delete_orphaned_content.rake +1 -3
- data/lib/katello/tasks/pulp3_content_switchover.rake +3 -1
- data/lib/katello/tasks/pulp3_migration.rake +29 -6
- data/lib/katello/tasks/pulp3_migration_abort.rake +7 -2
- data/lib/katello/tasks/pulp3_migration_approve_corrupted.rake +16 -0
- data/lib/katello/tasks/pulp3_migration_reset.rake +26 -0
- data/lib/katello/tasks/pulp3_migration_stats.rake +61 -8
- data/lib/katello/tasks/pulp3_post_migration_check.rake +1 -3
- data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
- data/lib/katello/tasks/reports.rake +4 -1
- data/lib/katello/tasks/repository.rake +3 -5
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +51 -51
- data/locale/bn/katello.po +136 -51
- data/locale/cs/katello.po +136 -49
- data/locale/de/katello.po +136 -48
- data/locale/en/katello.po +136 -48
- data/locale/es/katello.po +136 -48
- data/locale/fr/katello.po +136 -48
- data/locale/gu/katello.po +136 -51
- data/locale/hi/katello.po +136 -51
- data/locale/it/katello.po +136 -48
- data/locale/ja/katello.po +136 -48
- data/locale/katello.pot +941 -767
- data/locale/kn/katello.po +136 -51
- data/locale/ko/katello.po +136 -48
- data/locale/mr/katello.po +136 -51
- data/locale/or/katello.po +136 -51
- data/locale/pa/katello.po +136 -51
- data/locale/pt/katello.po +136 -51
- data/locale/pt_BR/katello.po +136 -48
- data/locale/ru/katello.po +136 -48
- data/locale/ta/katello.po +136 -51
- data/locale/te/katello.po +136 -51
- data/locale/zh_CN/katello.po +136 -48
- data/locale/zh_TW/katello.po +136 -48
- data/webpack/components/TypeAhead/TypeAhead.js +2 -1
- data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +2 -1
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +7 -2
- data/webpack/scenes/Subscriptions/Manifest/index.js +1 -0
- metadata +31 -19
- data/lib/katello/tasks/common.rake +0 -7
@@ -0,0 +1,60 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module Orchestration
|
4
|
+
module ContentViewVersion
|
5
|
+
class ExportLibrary < Actions::EntryAction
|
6
|
+
def plan(organization, destination_server: nil,
|
7
|
+
chunk_size: nil,
|
8
|
+
from_history: nil,
|
9
|
+
fail_on_missing_content: false)
|
10
|
+
action_subject(organization)
|
11
|
+
validate_repositories_immediate!(organization) if fail_on_missing_content
|
12
|
+
|
13
|
+
content_view = ::Katello::Pulp3::ContentViewVersion::Export.find_library_export_view(destination_server: destination_server,
|
14
|
+
organization: organization,
|
15
|
+
create_by_default: true)
|
16
|
+
repo_ids_in_library = organization.default_content_view_version.repositories.yum_type.immediate.pluck(:id)
|
17
|
+
content_view.update!(repository_ids: repo_ids_in_library)
|
18
|
+
|
19
|
+
sequence do
|
20
|
+
publish_action = plan_action(::Actions::Katello::ContentView::Publish, content_view, '')
|
21
|
+
export_action = plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
|
22
|
+
content_view_version: publish_action.version,
|
23
|
+
destination_server: destination_server,
|
24
|
+
chunk_size: chunk_size,
|
25
|
+
from_history: from_history,
|
26
|
+
validate_incremental: false,
|
27
|
+
fail_on_missing_content: fail_on_missing_content)
|
28
|
+
plan_self(export_action_output: export_action.output)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
output[:export_history_id] = input[:export_action_output][:export_history_id]
|
34
|
+
end
|
35
|
+
|
36
|
+
def humanized_name
|
37
|
+
_("Export Library")
|
38
|
+
end
|
39
|
+
|
40
|
+
def rescue_strategy
|
41
|
+
Dynflow::Action::Rescue::Skip
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_repositories_immediate!(organization)
|
45
|
+
non_immediate_repos = organization.default_content_view_version.repositories.yum_type.non_immediate
|
46
|
+
if non_immediate_repos.any?
|
47
|
+
fail _("NOTE: Unable to fully export '%{organization}' organization's library because"\
|
48
|
+
" it contains repositories without the 'immediate' download policy."\
|
49
|
+
" Update the download policy and sync affected repositories to include them in the export."\
|
50
|
+
" \n %{repos}" %
|
51
|
+
{ organization: organization.name,
|
52
|
+
repos: ::Katello::Pulp3::ContentViewVersion::Export
|
53
|
+
.generate_product_repo_strings(repositories: non_immediate_repos)})
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:disable Metrics/MethodLength
|
1
2
|
module Actions
|
2
3
|
module Pulp3
|
3
4
|
module Orchestration
|
@@ -6,9 +7,19 @@ module Actions
|
|
6
7
|
def plan(repository, smart_proxy, args)
|
7
8
|
file = {:filename => args.dig(:unit_key, :name)}
|
8
9
|
content_unit_href = args.dig(:unit_key, :content_unit_id)
|
10
|
+
docker_tag = (args.dig(:unit_type_id) == "docker_tag")
|
9
11
|
sequence do
|
10
12
|
if content_unit_href
|
11
13
|
plan_self(:commit_output => [], :content_unit_href => content_unit_href)
|
14
|
+
action_output = plan_action(Pulp3::Repository::ImportUpload, content_unit_href, repository, smart_proxy).output
|
15
|
+
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
|
16
|
+
elsif docker_tag
|
17
|
+
tag_manifest_output = plan_action(Pulp3::Repository::UploadTag,
|
18
|
+
repository,
|
19
|
+
smart_proxy,
|
20
|
+
args).output
|
21
|
+
plan_self(:commit_output => tag_manifest_output[:pulp_tasks])
|
22
|
+
plan_action(Pulp3::Repository::SaveVersion, repository, {force_fetch_version: true, tasks: tag_manifest_output[:pulp_tasks]})
|
12
23
|
else
|
13
24
|
commit_output = plan_action(Pulp3::Repository::CommitUpload,
|
14
25
|
repository,
|
@@ -24,9 +35,9 @@ module Actions
|
|
24
35
|
args.dig(:unit_type_id)).output
|
25
36
|
content_unit_href = artifact_output[:pulp_tasks]
|
26
37
|
plan_self(:commit_output => commit_output[:pulp_tasks], :artifact_output => artifact_output[:pulp_tasks])
|
38
|
+
action_output = plan_action(Pulp3::Repository::ImportUpload, content_unit_href, repository, smart_proxy).output
|
39
|
+
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
|
27
40
|
end
|
28
|
-
action_output = plan_action(Pulp3::Repository::ImportUpload, content_unit_href, repository, smart_proxy).output
|
29
|
-
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
|
30
41
|
end
|
31
42
|
end
|
32
43
|
|
@@ -34,8 +45,10 @@ module Actions
|
|
34
45
|
output[:pulp_tasks] = input[:commit_output]
|
35
46
|
if input[:content_unit_href]
|
36
47
|
output[:content_unit_href] = input[:content_unit_href]
|
37
|
-
|
48
|
+
elsif input[:artifact_output]
|
38
49
|
output[:content_unit_href] = input[:artifact_output].last[:created_resources].first
|
50
|
+
else
|
51
|
+
output[:content_unit_href] = nil
|
39
52
|
end
|
40
53
|
end
|
41
54
|
end
|
@@ -13,7 +13,7 @@ module Actions
|
|
13
13
|
target = ::Katello::Repository.find(input[:target_repository_id] || input[:target_repository])
|
14
14
|
service = target.backend_service(smart_proxy)
|
15
15
|
output[:pulp_tasks] = if input[:copy_all]
|
16
|
-
service.copy_all(source)
|
16
|
+
service.copy_all(source, mirror: input[:mirror] || false)
|
17
17
|
else
|
18
18
|
service.copy_content_for_source(source, input)
|
19
19
|
end
|
@@ -2,7 +2,7 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
4
|
class SaveVersion < Pulp3::Abstract
|
5
|
-
def plan(repository, options)
|
5
|
+
def plan(repository, options = {})
|
6
6
|
fail "Cannot accept tasks and repository_details into Save Version." if options[:tasks].present? && options[:repository_details].present?
|
7
7
|
plan_self(:repository_id => repository.id, :tasks => options[:tasks], :repository_details => options[:repository_details], :force_fetch_version => options.fetch(:force_fetch_version, false))
|
8
8
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module Repository
|
4
|
+
class UploadTag < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(repository, smart_proxy, args)
|
6
|
+
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :args => args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def invoke_external_task
|
10
|
+
repo = ::Katello::Repository.find(input[:repository_id])
|
11
|
+
tag_name = input[:args].dig(:unit_key, :name)
|
12
|
+
manifest_digest = input[:args].dig(:unit_key, :digest)
|
13
|
+
output[:pulp_tasks] = [repo.backend_service(smart_proxy).tag_manifest(tag_name, manifest_digest)]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -8,7 +8,7 @@ module Katello
|
|
8
8
|
def filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs)
|
9
9
|
rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
|
10
10
|
package_groups.reject do |package_group|
|
11
|
-
(package_group.package_names
|
11
|
+
(package_group.package_names - rpms.pluck(:name)).any?
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -10,9 +10,32 @@ module Katello
|
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
13
|
+
def with_content_view_scope(scope)
|
14
|
+
joins(:content_view).merge(Katello::ContentView.send(scope))
|
15
|
+
end
|
16
|
+
|
13
17
|
def readable
|
14
|
-
|
15
|
-
|
18
|
+
with_content_view_scope(:readable)
|
19
|
+
end
|
20
|
+
|
21
|
+
def exportable
|
22
|
+
with_content_view_scope(:exportable)
|
23
|
+
end
|
24
|
+
|
25
|
+
def editable
|
26
|
+
with_content_view_scope(:editable)
|
27
|
+
end
|
28
|
+
|
29
|
+
def publishable
|
30
|
+
with_content_view_scope(:publishable)
|
31
|
+
end
|
32
|
+
|
33
|
+
def deletable
|
34
|
+
with_content_view_scope(:deletable)
|
35
|
+
end
|
36
|
+
|
37
|
+
def promotable_or_removable
|
38
|
+
with_content_view_scope(:promotable_or_removable)
|
16
39
|
end
|
17
40
|
end
|
18
41
|
end
|
@@ -12,6 +12,14 @@ module Katello
|
|
12
12
|
authorized?(:import_manifest)
|
13
13
|
end
|
14
14
|
|
15
|
+
def can_import_library_content?
|
16
|
+
authorized?(:import_library_content)
|
17
|
+
end
|
18
|
+
|
19
|
+
def can_export_library_content?
|
20
|
+
authorized?(:export_library_content)
|
21
|
+
end
|
22
|
+
|
15
23
|
def readable_promotion_paths
|
16
24
|
permissible_promotion_paths(KTEnvironment.readable)
|
17
25
|
end
|
@@ -17,6 +17,8 @@ module Katello
|
|
17
17
|
TemplateKind.all.each do |kind|
|
18
18
|
if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS && kind.name == "provision"
|
19
19
|
provisioning_template_name = Setting["katello_default_atomic_provision"]
|
20
|
+
elsif kind.name == 'registration'
|
21
|
+
provisioning_template_name = 'Linux registration default'
|
20
22
|
else
|
21
23
|
provisioning_template_name = Setting["katello_default_#{kind.name}"]
|
22
24
|
end
|
@@ -91,6 +91,13 @@ module Katello
|
|
91
91
|
service_class.pulp_units_batch_all(pulp_ids).each do |units|
|
92
92
|
units.each do |unit|
|
93
93
|
unit = unit.with_indifferent_access
|
94
|
+
if content_type == 'rpm' && repository
|
95
|
+
rpms_to_disassociate = ::Katello::Rpm.where(name: unit[:name], version: unit[:version], release: unit[:release],
|
96
|
+
epoch: unit[:epoch], arch: unit[:arch]).select(:id)
|
97
|
+
if rpms_to_disassociate.any?
|
98
|
+
::Katello::RepositoryRpm.where(rpm_id: rpms_to_disassociate, repository_id: repository.id).destroy_all
|
99
|
+
end
|
100
|
+
end
|
94
101
|
model = Katello::Util::Support.active_record_retry do
|
95
102
|
self.where(:pulp_id => unit[service_class.unit_identifier]).first_or_create
|
96
103
|
end
|
@@ -211,6 +218,18 @@ module Katello
|
|
211
218
|
def db_values(new_ids, pulp_id_href_map, repository)
|
212
219
|
new_ids.map { |unit_id| [unit_id.to_i, pulp_id_href_map.dig(unit_id), repository.id.to_i, Time.now.utc.to_s(:db), Time.now.utc.to_s(:db)].compact }
|
213
220
|
end
|
221
|
+
|
222
|
+
def unmigrated_content
|
223
|
+
self.where(migrated_pulp3_href: nil, ignore_missing_from_migration: false)
|
224
|
+
end
|
225
|
+
|
226
|
+
def missing_migrated_content #missing or corrupted content that could not be migrated
|
227
|
+
self.where(migrated_pulp3_href: nil, missing_from_migration: true, ignore_missing_from_migration: false)
|
228
|
+
end
|
229
|
+
|
230
|
+
def ignored_missing_migrated_content
|
231
|
+
self.where(migrated_pulp3_href: nil, missing_from_migration: true, ignore_missing_from_migration: true)
|
232
|
+
end
|
214
233
|
end
|
215
234
|
end
|
216
235
|
end
|
@@ -44,8 +44,8 @@ module Katello
|
|
44
44
|
|
45
45
|
def kickstart_repos(host)
|
46
46
|
distros = distribution_repositories(host).where(distribution_bootable: true)
|
47
|
-
if distros && host
|
48
|
-
distros.map { |distro| distro.to_hash(host.content_source) }
|
47
|
+
if distros && host&.content_facet&.content_source
|
48
|
+
distros.map { |distro| distro.to_hash(host.content_facet.content_source) }
|
49
49
|
else
|
50
50
|
[]
|
51
51
|
end
|
@@ -97,7 +97,7 @@ module Katello
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def self.sync_needed?(environment)
|
100
|
-
unscoped.with_environment(environment).any?
|
100
|
+
Setting[:foreman_proxy_content_auto_sync] && unscoped.with_environment(environment).any?
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -107,9 +107,9 @@ module Katello
|
|
107
107
|
|
108
108
|
def update_puppet_path
|
109
109
|
if has_feature?(PULP_FEATURE)
|
110
|
-
path = ProxyAPI::Pulp.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
|
110
|
+
path = ::ProxyAPI::Pulp.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
|
111
111
|
elsif has_feature?(PULP_NODE_FEATURE)
|
112
|
-
path = ProxyAPI::PulpNode.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
|
112
|
+
path = ::ProxyAPI::PulpNode.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
|
113
113
|
end
|
114
114
|
self.update_attribute(:puppet_path, path || '') if persisted?
|
115
115
|
path
|
@@ -130,7 +130,7 @@ module Katello
|
|
130
130
|
config.host = uri.host
|
131
131
|
config.scheme = uri.scheme
|
132
132
|
pulp3_ssl_configuration(config)
|
133
|
-
config.debugging =
|
133
|
+
config.debugging = false
|
134
134
|
config.logger = ::Foreman::Logging.logger('katello/pulp_rest')
|
135
135
|
config.username = self.setting(PULP3_FEATURE, 'username')
|
136
136
|
config.password = self.setting(PULP3_FEATURE, 'password')
|
@@ -179,7 +179,9 @@ module Katello
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def fix_pulp3_capabilities(type)
|
182
|
-
|
182
|
+
repository_type_obj = type.is_a?(String) || type.is_a?(Symbol) ? Katello::RepositoryTypeManager.repository_types[type] : type
|
183
|
+
|
184
|
+
if missing_pulp3_capabilities? && repository_type_obj.pulp3_plugin && !pulp2_preferred_for_type?(repository_type_obj.id)
|
183
185
|
self.refresh
|
184
186
|
if self.capabilities(::SmartProxy::PULP3_FEATURE).empty?
|
185
187
|
fail Katello::Errors::PulpcoreMissingCapabilities
|
@@ -8,6 +8,7 @@ module Katello
|
|
8
8
|
include ForemanTasks::Concerns::ActionSubject
|
9
9
|
|
10
10
|
CONTENT_DIR = "content_views".freeze
|
11
|
+
IMPORT_LIBRARY = "Import-Library".freeze
|
11
12
|
|
12
13
|
belongs_to :organization, :inverse_of => :content_views, :class_name => "::Organization"
|
13
14
|
|
@@ -102,6 +103,10 @@ module Katello
|
|
102
103
|
name
|
103
104
|
end
|
104
105
|
|
106
|
+
def library_import?
|
107
|
+
name == IMPORT_LIBRARY
|
108
|
+
end
|
109
|
+
|
105
110
|
def content_host_count
|
106
111
|
hosts.count
|
107
112
|
end
|
@@ -43,7 +43,7 @@ module Katello
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.generate_rpm_clauses(package_filenames = [])
|
46
|
-
{ 'filename' => { "$in" => package_filenames } } unless package_filenames.empty?
|
46
|
+
{ 'filename' => { "$in" => package_filenames.sort } } unless package_filenames.empty?
|
47
47
|
end
|
48
48
|
|
49
49
|
def applicable_rpms
|
@@ -5,7 +5,7 @@ module Katello
|
|
5
5
|
belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion", :inverse_of => :export_histories
|
6
6
|
validates_lengths_from_database
|
7
7
|
validates :content_view_version_id, :presence => true
|
8
|
-
validates :destination_server, :
|
8
|
+
validates :destination_server, :uniqueness => { :scope => [:content_view_version_id, :destination_server, :path] }
|
9
9
|
validates :metadata, :presence => true
|
10
10
|
serialize :metadata, Hash
|
11
11
|
|
@@ -20,5 +20,10 @@ module Katello
|
|
20
20
|
scoped_search :on => :content_view_id, :relation => :content_view_version, :validator => ScopedSearch::Validators::INTEGER, :only_explicit => true
|
21
21
|
scoped_search :on => :content_view_version_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
|
22
22
|
scoped_search :on => :id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
|
23
|
+
|
24
|
+
def self.latest(content_view, destination_server: nil)
|
25
|
+
where(content_view_version: content_view.versions,
|
26
|
+
destination_server: destination_server).order(:created_at).last
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
@@ -31,43 +31,21 @@ module Katello
|
|
31
31
|
validates :host, :presence => true, :allow_blank => false
|
32
32
|
validates_with Validators::ContentViewEnvironmentValidator
|
33
33
|
|
34
|
-
def bindable_types
|
35
|
-
[
|
36
|
-
{
|
37
|
-
type: Repository::DEB_TYPE,
|
38
|
-
matcher: '/pulp/deb/',
|
39
|
-
paths: []
|
40
|
-
},
|
41
|
-
{
|
42
|
-
type: Repository::YUM_TYPE,
|
43
|
-
matcher: '/pulp/repos/',
|
44
|
-
paths: []
|
45
|
-
}
|
46
|
-
]
|
47
|
-
end
|
48
|
-
|
49
34
|
def update_repositories_by_paths(paths)
|
50
|
-
|
35
|
+
prefixes = %w(/pulp/deb/ /pulp/repos/ /pulp/content/)
|
51
36
|
relative_paths = []
|
52
37
|
|
53
|
-
# paths == ["/pulp/repos/Default_Organization/Library/custom/Test_product/test2"
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
if absolute_path.starts_with?(supported[:matcher])
|
60
|
-
supported[:paths] << relative_path
|
61
|
-
break
|
62
|
-
end
|
38
|
+
# paths == ["/pulp/repos/Default_Organization/Library/custom/Test_product/test2"]
|
39
|
+
paths.each do |path|
|
40
|
+
if (prefix = prefixes.find { |pre| path.start_with?(pre) })
|
41
|
+
relative_paths << path.gsub(prefix, '')
|
42
|
+
else
|
43
|
+
Rails.logger.warn("System #{self.host.name} (#{self.host.id}) requested binding to repo with unknown prefix. #{path}")
|
63
44
|
end
|
64
45
|
end
|
65
46
|
|
66
|
-
repos =
|
67
|
-
|
68
|
-
relative_paths -= repos.pluck(:relative_path) # remove relative paths that match our repos
|
69
|
-
repos
|
70
|
-
end
|
47
|
+
repos = Repository.where(relative_path: relative_paths)
|
48
|
+
relative_paths -= repos.pluck(:relative_path) # remove relative paths that match our repos
|
71
49
|
|
72
50
|
# Any leftover relative paths do not match the repos we've just retrieved from the db,
|
73
51
|
# so we should log warnings about them.
|