katello 3.17.3 → 3.18.0.rc1
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.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
- data/app/controllers/katello/api/v2/api_controller.rb +2 -1
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
- data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
- data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -36
- data/app/controllers/katello/api/v2/content_views_controller.rb +27 -25
- data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
- data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +17 -0
- data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +8 -5
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
- data/app/controllers/katello/concerns/api/v2/authorization.rb +9 -5
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
- data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
- data/app/helpers/katello/katello_urls_helper.rb +5 -2
- data/app/lib/actions/candlepin/product/content_create.rb +2 -0
- data/app/lib/actions/candlepin/product/content_update.rb +2 -0
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -6
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +2 -6
- data/app/lib/actions/katello/content_view/publish.rb +3 -4
- data/app/lib/actions/katello/content_view_version/import.rb +4 -3
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
- data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
- data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
- data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
- data/app/lib/actions/katello/product/content_create.rb +7 -6
- data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
- data/app/lib/actions/katello/repository/import_upload.rb +2 -1
- data/app/lib/actions/katello/repository/update.rb +4 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +0 -1
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
- data/app/lib/actions/pulp3/content_view_version/export.rb +2 -1
- data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +15 -10
- data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
- data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
- data/app/lib/actions/pulp3/repository/delete.rb +1 -1
- data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
- data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
- data/app/lib/katello/resources/candlepin/owner.rb +5 -0
- data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
- data/app/lib/katello/resources/registry.rb +3 -3
- data/app/models/katello/authorization/activation_key.rb +4 -0
- data/app/models/katello/authorization/content_view.rb +13 -0
- data/app/models/katello/authorization/content_view_component.rb +15 -0
- data/app/models/katello/authorization/gpg_key.rb +12 -4
- data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
- data/app/models/katello/authorization/sync_plan.rb +16 -0
- data/app/models/katello/concerns/organization_extensions.rb +4 -5
- data/app/models/katello/concerns/redhat_extensions.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -3
- data/app/models/katello/content_view_component.rb +2 -0
- data/app/models/katello/content_view_version_export_history.rb +2 -0
- data/app/models/katello/glue/candlepin/pool.rb +9 -14
- data/app/models/katello/glue/pulp/repo.rb +8 -0
- data/app/models/katello/gpg_key.rb +1 -1
- data/app/models/katello/root_repository.rb +26 -1
- data/app/services/katello/applicability/applicable_content_helper.rb +1 -12
- data/app/services/katello/candlepin/event_handler.rb +2 -0
- data/app/services/katello/candlepin/message_handler.rb +34 -0
- data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
- data/app/services/katello/host_status_manager.rb +9 -0
- data/app/services/katello/pulp3/api/apt.rb +57 -0
- data/app/services/katello/pulp3/api/core.rb +8 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +4 -3
- data/app/services/katello/pulp3/content_view_version/import.rb +5 -15
- data/app/services/katello/pulp3/deb.rb +38 -0
- data/app/services/katello/pulp3/erratum.rb +1 -2
- data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
- data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
- data/app/services/katello/pulp3/repository/apt.rb +63 -0
- data/app/services/katello/pulp3/repository/docker.rb +4 -0
- data/app/services/katello/pulp3/repository/yum.rb +2 -1
- data/app/services/katello/pulp3/repository.rb +11 -9
- data/app/services/katello/pulp3/repository_mirror.rb +9 -4
- data/app/services/katello/pulp3/task.rb +3 -3
- data/app/services/katello/pulp3/task_group.rb +0 -6
- data/app/views/dashboard/_subscription_widget.html.erb +0 -5
- data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
- data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
- data/config/routes/api/v2.rb +2 -0
- data/config/routes/overrides.rb +1 -0
- data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +2 -5
- data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
- data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
- data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
- data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
- 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/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
- 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/host-collections/details/host-collection-details.controller.js +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +16 -14
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/permission_creator.rb +68 -59
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/plugin.rb +4 -1
- data/lib/katello/repository_types/deb.rb +9 -1
- data/lib/katello/tasks/pulp3_content_switchover.rake +1 -3
- data/lib/katello/tasks/pulp3_migration_stats.rake +21 -0
- data/lib/katello/tasks/reports.rake +1 -4
- data/lib/katello/tasks/reset.rake +2 -1
- data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +54 -47
- data/locale/bn/katello.po +165 -26
- data/locale/cs/katello.po +164 -24
- data/locale/de/katello.po +165 -26
- data/locale/en/katello.po +164 -23
- data/locale/es/katello.po +165 -25
- data/locale/fr/katello.po +165 -25
- data/locale/gu/katello.po +165 -26
- data/locale/hi/katello.po +165 -26
- data/locale/it/katello.po +165 -25
- data/locale/ja/katello.po +165 -26
- data/locale/katello.pot +1036 -802
- data/locale/kn/katello.po +165 -26
- data/locale/ko/katello.po +165 -25
- data/locale/mr/katello.po +165 -26
- data/locale/or/katello.po +165 -26
- data/locale/pa/katello.po +165 -26
- data/locale/pt/katello.po +164 -23
- data/locale/pt_BR/katello.po +165 -25
- data/locale/ru/katello.po +165 -25
- data/locale/ta/katello.po +165 -26
- data/locale/te/katello.po +165 -26
- data/locale/zh_CN/katello.po +165 -25
- data/locale/zh_TW/katello.po +165 -26
- data/webpack/components/ActionableDetail.js +2 -1
- data/webpack/components/Search/Search.js +1 -1
- data/webpack/components/Table/MainTable.js +6 -2
- data/webpack/components/Table/TableWrapper.js +46 -9
- data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
- data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
- data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
- data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
- data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
- data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
- data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
- data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +16 -8
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
- data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
- data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
- data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
- data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
- data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
- metadata +69 -26
|
@@ -23,10 +23,11 @@ module Actions
|
|
|
23
23
|
import_upload_args = {
|
|
24
24
|
pulp_id: repository.pulp_id,
|
|
25
25
|
unit_type_id: unit_type_id,
|
|
26
|
-
unit_key: unit_key,
|
|
26
|
+
unit_key: unit_key.with_indifferent_access,
|
|
27
27
|
upload_id: upload_id,
|
|
28
28
|
unit_metadata: unit_metadata
|
|
29
29
|
}
|
|
30
|
+
|
|
30
31
|
import_upload = plan_pulp_action([Actions::Pulp::Repository::ImportUpload,
|
|
31
32
|
Actions::Pulp3::Orchestration::Repository::ImportUpload],
|
|
32
33
|
repository, SmartProxy.pulp_primary, import_upload_args)
|
|
@@ -11,6 +11,7 @@ module Actions
|
|
|
11
11
|
|
|
12
12
|
repo_params[:url] = nil if repo_params[:url] == ''
|
|
13
13
|
update_cv_cert_protected = repo_params.key?(:unprotected) && (repo_params[:unprotected] != repository.unprotected)
|
|
14
|
+
|
|
14
15
|
root.update!(repo_params)
|
|
15
16
|
|
|
16
17
|
if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
|
|
@@ -32,7 +33,9 @@ module Actions
|
|
|
32
33
|
:gpg_key_url => repository.yum_gpg_key_url,
|
|
33
34
|
:label => content.label,
|
|
34
35
|
:type => root.content_type,
|
|
35
|
-
:arches => root.format_arches
|
|
36
|
+
:arches => root.format_arches,
|
|
37
|
+
:os_versions => root.os_versions&.join(',')
|
|
38
|
+
)
|
|
36
39
|
|
|
37
40
|
content.update!(name: root.name,
|
|
38
41
|
content_url: root.custom_content_path,
|
|
@@ -14,7 +14,7 @@ module Actions
|
|
|
14
14
|
content_view.repository_references.each do |repository_reference|
|
|
15
15
|
repo = repository_reference.root_repository.library_instance
|
|
16
16
|
#force pulp3 in case we've done migrations, but haven't switched over yet
|
|
17
|
-
tasks << repo.backend_service(smart_proxy, true).
|
|
17
|
+
tasks << repo.backend_service(smart_proxy, true).delete(repository_reference.repository_href)
|
|
18
18
|
end
|
|
19
19
|
content_view.repository_references.destroy_all
|
|
20
20
|
|
|
@@ -6,13 +6,17 @@ module Actions
|
|
|
6
6
|
param :smart_proxy_id, Integer
|
|
7
7
|
param :content_view_version_id, Integer
|
|
8
8
|
param :path, String
|
|
9
|
+
param :metadata, Hash
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def run
|
|
12
13
|
cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
|
|
13
|
-
output[:importer_data] = ::Katello::Pulp3::ContentViewVersion::Import.new(
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
output[:importer_data] = ::Katello::Pulp3::ContentViewVersion::Import.new(
|
|
15
|
+
smart_proxy: smart_proxy,
|
|
16
|
+
content_view_version: cvv,
|
|
17
|
+
path: input[:path],
|
|
18
|
+
metadata: input[:metadata]
|
|
19
|
+
).create_importer
|
|
16
20
|
end
|
|
17
21
|
end
|
|
18
22
|
end
|
|
@@ -6,12 +6,13 @@ module Actions
|
|
|
6
6
|
param :content_view_version_id, Integer
|
|
7
7
|
param :smart_proxy_id, Integer
|
|
8
8
|
param :exporter_data, Hash
|
|
9
|
+
param :chunk_size, Integer
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def invoke_external_task
|
|
12
13
|
cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
|
|
13
14
|
::Katello::Pulp3::ContentViewVersion::Export.new(smart_proxy: smart_proxy,
|
|
14
|
-
content_view_version: cvv).create_export(input[:exporter_data][:pulp_href])
|
|
15
|
+
content_view_version: cvv).create_export(input[:exporter_data][:pulp_href], input[:chunk_size])
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -7,13 +7,17 @@ module Actions
|
|
|
7
7
|
param :smart_proxy_id, Integer
|
|
8
8
|
param :importer_data, Hash
|
|
9
9
|
param :path, String
|
|
10
|
+
param :metadata, Hash
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def invoke_external_task
|
|
13
14
|
cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
|
|
14
|
-
output[:pulp_tasks] = ::Katello::Pulp3::ContentViewVersion::Import.new(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
output[:pulp_tasks] = ::Katello::Pulp3::ContentViewVersion::Import.new(
|
|
16
|
+
smart_proxy: smart_proxy,
|
|
17
|
+
content_view_version: cvv,
|
|
18
|
+
path: input[:path],
|
|
19
|
+
metadata: input[:metadata]
|
|
20
|
+
).create_import(input[:importer_data][:pulp_href])
|
|
17
21
|
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
@@ -12,11 +12,11 @@ module Actions
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
output_format do
|
|
15
|
-
param :
|
|
16
|
-
param :
|
|
15
|
+
param :exported_file_checksum, Hash
|
|
16
|
+
param :export_path, String
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def plan(content_view_version, destination_server:)
|
|
19
|
+
def plan(content_view_version, destination_server:, chunk_size: nil)
|
|
20
20
|
action_subject(content_view_version)
|
|
21
21
|
unless File.directory?(Setting['pulpcore_export_destination'])
|
|
22
22
|
fail ::Foreman::Exception, N_("Unable to export. 'pulpcore_export_destination' setting is not set to a valid directory.")
|
|
@@ -32,7 +32,8 @@ module Actions
|
|
|
32
32
|
plan_action(::Actions::Pulp3::ContentViewVersion::Export,
|
|
33
33
|
content_view_version_id: content_view_version.id,
|
|
34
34
|
smart_proxy_id: smart_proxy.id,
|
|
35
|
-
exporter_data: action_output[:exporter_data]
|
|
35
|
+
exporter_data: action_output[:exporter_data],
|
|
36
|
+
chunk_size: chunk_size
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
plan_self(exporter_data: action_output[:exporter_data], smart_proxy_id: smart_proxy.id,
|
|
@@ -49,18 +50,22 @@ module Actions
|
|
|
49
50
|
smart_proxy = ::SmartProxy.find(input[:smart_proxy_id])
|
|
50
51
|
api = ::Katello::Pulp3::Api::Core.new(smart_proxy)
|
|
51
52
|
export_data = api.export_api.list(input[:exporter_data][:pulp_href]).results.first
|
|
52
|
-
output[:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
path: path)
|
|
53
|
+
output[:exported_file_checksum] = export_data.output_file_info
|
|
54
|
+
file_name = output[:exported_file_checksum].first&.first
|
|
55
|
+
path = File.dirname(file_name.to_s)
|
|
56
|
+
output[:export_path] = path
|
|
57
57
|
cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
|
|
58
58
|
|
|
59
59
|
export_metadata = ::Katello::Pulp3::ContentViewVersion::Export.new(:content_view_version => cvv,
|
|
60
60
|
:smart_proxy => smart_proxy).generate_metadata
|
|
61
61
|
toc = Dir.glob("#{path}/*toc.json").first
|
|
62
62
|
export_metadata[:toc] = File.basename(toc) if toc
|
|
63
|
-
|
|
63
|
+
::Katello::ContentViewVersionExportHistory.create!(
|
|
64
|
+
content_view_version_id: input[:content_view_version_id],
|
|
65
|
+
destination_server: input[:destination_server],
|
|
66
|
+
path: path,
|
|
67
|
+
metadata: export_metadata
|
|
68
|
+
)
|
|
64
69
|
end
|
|
65
70
|
|
|
66
71
|
def humanized_name
|
|
@@ -3,20 +3,26 @@ module Actions
|
|
|
3
3
|
module Orchestration
|
|
4
4
|
module ContentViewVersion
|
|
5
5
|
class Import < Actions::EntryAction
|
|
6
|
-
def plan(content_view_version, path:)
|
|
6
|
+
def plan(content_view_version, path:, metadata:)
|
|
7
7
|
action_subject(content_view_version)
|
|
8
8
|
sequence do
|
|
9
9
|
smart_proxy = SmartProxy.pulp_primary!
|
|
10
|
-
importer_output = plan_action(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
importer_output = plan_action(
|
|
11
|
+
::Actions::Pulp3::ContentViewVersion::CreateImporter,
|
|
12
|
+
content_view_version_id: content_view_version.id,
|
|
13
|
+
smart_proxy_id: smart_proxy.id,
|
|
14
|
+
path: path,
|
|
15
|
+
metadata: metadata
|
|
16
|
+
).output
|
|
14
17
|
|
|
15
|
-
import_output = plan_action(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
import_output = plan_action(
|
|
19
|
+
::Actions::Pulp3::ContentViewVersion::Import,
|
|
20
|
+
content_view_version_id: content_view_version.id,
|
|
21
|
+
smart_proxy_id: smart_proxy.id,
|
|
22
|
+
importer_data: importer_output[:importer_data],
|
|
23
|
+
path: path,
|
|
24
|
+
metadata: metadata
|
|
25
|
+
).output
|
|
20
26
|
|
|
21
27
|
plan_action(Actions::Pulp3::Repository::SaveVersions, content_view_version.importable_repositories.pluck(:id),
|
|
22
28
|
tasks: import_output[:pulp_tasks])
|
|
@@ -10,7 +10,8 @@ module Actions
|
|
|
10
10
|
repo = ::Katello::Repository.find(input[:repository_id])
|
|
11
11
|
repo_backend_service = repo.backend_service(smart_proxy)
|
|
12
12
|
uploads_api = repo_backend_service.core_api.uploads_api
|
|
13
|
-
|
|
13
|
+
upload_commit = repo_backend_service.core_api.upload_commit_class.new(sha256: input[:sha256])
|
|
14
|
+
output[:pulp_tasks] = [uploads_api.commit(input[:upload_href], upload_commit)]
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
end
|
|
@@ -11,7 +11,7 @@ module Actions
|
|
|
11
11
|
artifact_href = input[:tasks].last[:created_resources].first
|
|
12
12
|
content_type = input[:unit_type_id]
|
|
13
13
|
content_backend_service = SmartProxy.pulp_primary.content_service(content_type)
|
|
14
|
-
output[:pulp_tasks] = [content_backend_service.
|
|
14
|
+
output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name], artifact: artifact_href)]
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -53,8 +53,8 @@ module Katello
|
|
|
53
53
|
JSON.parse(response).with_indifferent_access
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
def async_hypervisors(owner
|
|
57
|
-
url = "/candlepin/hypervisors/#{owner}"
|
|
56
|
+
def async_hypervisors(owner:, reporter_id:, raw_json:)
|
|
57
|
+
url = "/candlepin/hypervisors/#{owner}?reporter_id=#{reporter_id}"
|
|
58
58
|
headers = self.default_headers
|
|
59
59
|
headers['content-type'] = 'text/plain'
|
|
60
60
|
response = self.post(url, raw_json, headers)
|
|
@@ -5,6 +5,11 @@ module Katello
|
|
|
5
5
|
extend OwnerResource
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
+
def all
|
|
9
|
+
response = self.get(path, default_headers)
|
|
10
|
+
JSON.parse(response.body)
|
|
11
|
+
end
|
|
12
|
+
|
|
8
13
|
# Set the contentPrefix at creation time so that the client will get
|
|
9
14
|
# content only for the org it has been subscribed to
|
|
10
15
|
def create(key, description)
|
|
@@ -24,6 +24,12 @@ module Katello
|
|
|
24
24
|
raise ::Katello::Errors::UpstreamConsumerGone
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def content_access
|
|
28
|
+
JSON.parse(self['content_access'].get).with_indifferent_access
|
|
29
|
+
rescue RestClient::NotFound
|
|
30
|
+
{}
|
|
31
|
+
end
|
|
32
|
+
|
|
27
33
|
def remove_entitlement(entitlement_id)
|
|
28
34
|
fail ArgumentError, "No entitlement ID given to remove." if entitlement_id.blank?
|
|
29
35
|
|
|
@@ -10,11 +10,12 @@ module Katello
|
|
|
10
10
|
::Foreman::Logging.logger('katello/registry_proxy')
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def self.get(path, headers = {:accept => :json})
|
|
13
|
+
def self.get(path, headers = {:accept => :json}, options = {})
|
|
14
14
|
logger.debug "Sending GET request to Registry: #{path}"
|
|
15
15
|
resource = RegistryResource.load_class
|
|
16
16
|
joined_path = resource.prefix.chomp("/") + path
|
|
17
17
|
client = resource.rest_client(Net::HTTP::Get, :get, joined_path)
|
|
18
|
+
client.options.merge!(options)
|
|
18
19
|
client.get(headers)
|
|
19
20
|
end
|
|
20
21
|
end
|
|
@@ -22,7 +23,6 @@ module Katello
|
|
|
22
23
|
class RegistryResource < HttpResource
|
|
23
24
|
class << self
|
|
24
25
|
def load_class
|
|
25
|
-
container_config = SETTINGS.dig(:katello, :container_image_registry)
|
|
26
26
|
registry_url = nil
|
|
27
27
|
pulp_primary = ::SmartProxy.pulp_primary
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ module Katello
|
|
|
34
34
|
|
|
35
35
|
# Assume the registry uses the same CA as the Smart Proxy
|
|
36
36
|
ca_cert_file = Setting[:ssl_ca_file]
|
|
37
|
-
elsif container_config
|
|
37
|
+
elsif (container_config = SETTINGS.dig(:katello, :container_image_registry))
|
|
38
38
|
registry_url = container_config[:crane_url]
|
|
39
39
|
ca_cert_file = container_config[:registry_ca_cert_file]
|
|
40
40
|
end
|
|
@@ -24,6 +24,10 @@ module Katello
|
|
|
24
24
|
authorized?(:promote_or_remove_content_views) && Katello::KTEnvironment.any_promotable?
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def exportable?
|
|
28
|
+
authorized?(:export_content_views)
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
module ClassMethods
|
|
28
32
|
def readable
|
|
29
33
|
authorized(:view_content_views)
|
|
@@ -45,6 +49,15 @@ module Katello
|
|
|
45
49
|
authorized(:publish_content_views)
|
|
46
50
|
end
|
|
47
51
|
|
|
52
|
+
def promotable_or_removable
|
|
53
|
+
return where("1=0") unless Katello::KTEnvironment.any_promotable?
|
|
54
|
+
authorized(:promote_or_remove_content_views)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def exportable
|
|
58
|
+
authorized(:export_content_views)
|
|
59
|
+
end
|
|
60
|
+
|
|
48
61
|
def readable_repositories(repo_ids = nil)
|
|
49
62
|
query = Katello::Repository.all
|
|
50
63
|
content_views = Katello::ContentView.readable
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Katello
|
|
2
|
+
module Authorization::ContentViewComponent
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
module ClassMethods
|
|
6
|
+
def readable
|
|
7
|
+
where(:composite_content_view_id => ::Katello::ContentView.readable)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def editable
|
|
11
|
+
where(:composite_content_view_id => ::Katello::ContentView.editable)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -5,20 +5,28 @@ module Katello
|
|
|
5
5
|
include Authorizable
|
|
6
6
|
|
|
7
7
|
def readable?
|
|
8
|
-
authorized?(:
|
|
8
|
+
authorized?(:view_content_credentials)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def editable?
|
|
12
|
-
authorized?(:
|
|
12
|
+
authorized?(:edit_content_credentials)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def deletable?
|
|
16
|
-
authorized?(:
|
|
16
|
+
authorized?(:destroy_content_credentials)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
module ClassMethods
|
|
20
20
|
def readable
|
|
21
|
-
authorized(:
|
|
21
|
+
authorized(:view_content_credentials)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def editable
|
|
25
|
+
authorized(:edit_content_credentials)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def deletable
|
|
29
|
+
authorized(:destroy_content_credentials)
|
|
22
30
|
end
|
|
23
31
|
end
|
|
24
32
|
end
|
|
@@ -45,6 +45,14 @@ module Katello
|
|
|
45
45
|
::User.current.can?(:create_lifecycle_environments)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
def deletable
|
|
49
|
+
authorized(:destroy_lifecycle_environments)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def editable
|
|
53
|
+
authorized(:edit_lifecycle_environments)
|
|
54
|
+
end
|
|
55
|
+
|
|
48
56
|
def content_readable(org)
|
|
49
57
|
readable.where(:organization_id => org)
|
|
50
58
|
end
|
|
@@ -16,10 +16,26 @@ module Katello
|
|
|
16
16
|
authorized?(:destroy_sync_plans)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def syncable?
|
|
20
|
+
products.all? { |p| p.syncable? }
|
|
21
|
+
end
|
|
22
|
+
|
|
19
23
|
module ClassMethods
|
|
20
24
|
def readable
|
|
21
25
|
authorized(:view_sync_plans)
|
|
22
26
|
end
|
|
27
|
+
|
|
28
|
+
def editable
|
|
29
|
+
authorized(:edit_sync_plans)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def deletable
|
|
33
|
+
authorized(:destroy_sync_plans)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def syncable
|
|
37
|
+
authorized(:sync_sync_plans)
|
|
38
|
+
end
|
|
23
39
|
end
|
|
24
40
|
end
|
|
25
41
|
end
|
|
@@ -228,11 +228,6 @@ module Katello
|
|
|
228
228
|
subscriptions.select(&:expiring_soon?)
|
|
229
229
|
end
|
|
230
230
|
|
|
231
|
-
def clear_syspurpose_status
|
|
232
|
-
host_purpose = HostStatus::Status.where(type: ::Katello::HostStatusManager::PURPOSE_STATUS.map(&:to_s)).where('host_id in (?)', self.hosts.pluck(:id))
|
|
233
|
-
host_purpose.destroy_all
|
|
234
|
-
end
|
|
235
|
-
|
|
236
231
|
def notification_recipients_ids
|
|
237
232
|
users = User.unscoped.all.find_all do |user|
|
|
238
233
|
user.can?(:import_manifest) && user.can?(:view_organizations, self)
|
|
@@ -249,6 +244,10 @@ module Katello
|
|
|
249
244
|
# doesn't provide much benefit for the frustration it creates.
|
|
250
245
|
self.save(validate: false)
|
|
251
246
|
end
|
|
247
|
+
|
|
248
|
+
def upstream_consumer
|
|
249
|
+
Katello::Candlepin::UpstreamConsumer.new(self)
|
|
250
|
+
end
|
|
252
251
|
end
|
|
253
252
|
end
|
|
254
253
|
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.
|
|
47
|
+
if distros && host.content_source
|
|
48
|
+
distros.map { |distro| distro.to_hash(host.content_source) }
|
|
49
49
|
else
|
|
50
50
|
[]
|
|
51
51
|
end
|
|
@@ -177,9 +177,7 @@ module Katello
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
def fix_pulp3_capabilities(type)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if missing_pulp3_capabilities? && repository_type_obj.pulp3_plugin && !pulp2_preferred_for_type?(repository_type_obj.id)
|
|
180
|
+
if missing_pulp3_capabilities? && !pulp2_preferred_for_type?(type)
|
|
183
181
|
self.refresh
|
|
184
182
|
if self.capabilities(::SmartProxy::PULP3_FEATURE).empty?
|
|
185
183
|
fail Katello::Errors::PulpcoreMissingCapabilities
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentViewComponent < Katello::Model
|
|
3
|
+
include Authorization::ContentViewComponent
|
|
4
|
+
|
|
3
5
|
audited :associated_with => :composite_content_view
|
|
4
6
|
belongs_to :composite_content_view, :class_name => "Katello::ContentView",
|
|
5
7
|
:inverse_of => :content_view_components
|
|
@@ -6,6 +6,8 @@ module Katello
|
|
|
6
6
|
validates_lengths_from_database
|
|
7
7
|
validates :content_view_version_id, :presence => true
|
|
8
8
|
validates :destination_server, :presence => true, :uniqueness => { :scope => [:content_view_version_id, :destination_server, :path] }
|
|
9
|
+
validates :metadata, :presence => true
|
|
10
|
+
serialize :metadata, Hash
|
|
9
11
|
|
|
10
12
|
scope :with_organization_id, ->(organization_id) do
|
|
11
13
|
where(:content_view_version_id => ContentViewVersion.with_organization_id(organization_id))
|
|
@@ -21,6 +21,8 @@ module Katello
|
|
|
21
21
|
lazy_accessor :available, :initializer => lambda { |_s| self.quantity_available }
|
|
22
22
|
|
|
23
23
|
lazy_accessor :backend_data, :initializer => lambda { |_s| self.class.candlepin_data(self.cp_id) }
|
|
24
|
+
|
|
25
|
+
lazy_accessor :consumer_uuids, :initializer => lambda { |_s| Resources::Candlepin::Pool.consumer_uuids(self.cp_id) }
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -162,27 +164,20 @@ module Katello
|
|
|
162
164
|
end
|
|
163
165
|
|
|
164
166
|
def import_hosts
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
sub_facet_ids_from_cp, host_ids_from_cp = Katello::Host::SubscriptionFacet.where('uuid in (?)', uuids).pluck([:id, :host_id]).transpose
|
|
167
|
+
sub_facet_ids_from_cp, host_ids_from_cp = Katello::Host::SubscriptionFacet.where('uuid in (?)', consumer_uuids).pluck(:id, :host_id).transpose
|
|
168
168
|
sub_facet_ids_from_cp ||= []
|
|
169
169
|
host_ids_from_cp ||= []
|
|
170
170
|
|
|
171
|
-
sub_facet_ids_from_pool_table =
|
|
172
|
-
|
|
171
|
+
sub_facet_ids_from_pool_table, host_ids_from_pool_table = self.subscription_facets.pluck(:id, :host_id).transpose
|
|
172
|
+
sub_facet_ids_from_pool_table ||= []
|
|
173
|
+
host_ids_from_pool_table ||= []
|
|
173
174
|
|
|
174
175
|
entries_to_add = sub_facet_ids_from_cp - sub_facet_ids_from_pool_table
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
entries_to_add.each do |sub_facet_id|
|
|
178
|
-
query = "INSERT INTO #{Katello::SubscriptionFacetPool.table_name} (pool_id, subscription_facet_id) VALUES (#{self.id}, #{sub_facet_id})"
|
|
179
|
-
ActiveRecord::Base.connection.execute(query)
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
end
|
|
176
|
+
facet_pool_data = entries_to_add.map { |sub_facet_id| { pool_id: self.id, subscription_facet_id: sub_facet_id } }
|
|
177
|
+
Katello::SubscriptionFacetPool.import(facet_pool_data) unless facet_pool_data.empty?
|
|
183
178
|
|
|
184
179
|
entries_to_remove = sub_facet_ids_from_pool_table - sub_facet_ids_from_cp
|
|
185
|
-
|
|
180
|
+
self.subscription_facet_pools.where(subscription_facet_id: entries_to_remove).delete_all
|
|
186
181
|
self.import_audit_record(host_ids_from_pool_table, host_ids_from_cp)
|
|
187
182
|
end
|
|
188
183
|
|
|
@@ -240,6 +240,8 @@ module Katello
|
|
|
240
240
|
"iso"
|
|
241
241
|
when Repository::DEB_TYPE
|
|
242
242
|
"deb"
|
|
243
|
+
when Repository::ANSIBLE_COLLECTION_TYPE
|
|
244
|
+
"ansible_collection"
|
|
243
245
|
end
|
|
244
246
|
end
|
|
245
247
|
|
|
@@ -271,6 +273,10 @@ module Katello
|
|
|
271
273
|
self.content_type == Repository::DEB_TYPE
|
|
272
274
|
end
|
|
273
275
|
|
|
276
|
+
def ansible_collection?
|
|
277
|
+
self.content_type == Repository::ANSIBLE_COLLECTION_TYPE
|
|
278
|
+
end
|
|
279
|
+
|
|
274
280
|
def published?
|
|
275
281
|
distributors.map { |dist| dist['last_publish'] }.compact.any?
|
|
276
282
|
end
|
|
@@ -378,6 +384,8 @@ module Katello
|
|
|
378
384
|
"#{scheme}://#{pulp_uri.host.downcase}/pulp/ostree/web/#{relative_path}"
|
|
379
385
|
elsif deb?
|
|
380
386
|
"#{scheme}://#{pulp_uri.host.downcase}/pulp/deb/#{relative_path}/"
|
|
387
|
+
elsif ansible_collection?
|
|
388
|
+
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/#{relative_path}/"
|
|
381
389
|
else
|
|
382
390
|
"#{scheme}://#{pulp_uri.host.downcase}/pulp/repos/#{relative_path}/"
|
|
383
391
|
end
|
|
@@ -3,6 +3,7 @@ module Katello
|
|
|
3
3
|
audited :except => [:content_id]
|
|
4
4
|
serialize :ignorable_content
|
|
5
5
|
serialize :docker_tags_whitelist
|
|
6
|
+
serialize :os_versions
|
|
6
7
|
|
|
7
8
|
include Ext::LabelFromName
|
|
8
9
|
include Encryptable
|
|
@@ -34,6 +35,11 @@ module Katello
|
|
|
34
35
|
NO_DEFAULT_HTTP_PROXY,
|
|
35
36
|
USE_SELECTED_HTTP_PROXY].freeze
|
|
36
37
|
|
|
38
|
+
RHEL6 = 'rhel-6'.freeze
|
|
39
|
+
RHEL7 = 'rhel-7'.freeze
|
|
40
|
+
RHEL8 = 'rhel-8'.freeze
|
|
41
|
+
ALLOWED_OS_VERSIONS = [RHEL6, RHEL7, RHEL8].freeze
|
|
42
|
+
|
|
37
43
|
belongs_to :product, :inverse_of => :root_repositories, :class_name => "Katello::Product"
|
|
38
44
|
belongs_to :gpg_key, :inverse_of => :root_repositories, :class_name => "Katello::GpgKey"
|
|
39
45
|
belongs_to :ssl_ca_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_ca_root_repos
|
|
@@ -63,6 +69,7 @@ module Katello
|
|
|
63
69
|
validate :ensure_compatible_download_policy, :if => :yum?
|
|
64
70
|
validate :ensure_valid_ignorable_content
|
|
65
71
|
validate :ensure_valid_docker_tags_whitelist
|
|
72
|
+
validate :ensure_valid_os_versions
|
|
66
73
|
validate :ensure_content_attribute_restrictions
|
|
67
74
|
validate :ensure_valid_upstream_authorization
|
|
68
75
|
validate :ensure_no_checksum_on_demand
|
|
@@ -214,6 +221,24 @@ module Katello
|
|
|
214
221
|
end
|
|
215
222
|
end
|
|
216
223
|
|
|
224
|
+
def ensure_valid_os_versions
|
|
225
|
+
return if os_versions.empty?
|
|
226
|
+
# os_versions here translate to candlepin as 'required tags'.
|
|
227
|
+
# A host must provide ALL required tags in order for the repo to be enabled.
|
|
228
|
+
# So os_versions such as ['rhel-7', 'rhel-8'] is not allowed, since the repo would always be disabled.
|
|
229
|
+
unless yum?
|
|
230
|
+
errors.add(:os_versions, N_("are only allowed for Yum repositories."))
|
|
231
|
+
end
|
|
232
|
+
if os_versions.length > 1
|
|
233
|
+
errors.add(:os_versions, N_("invalid: Repositories can only require one OS version."))
|
|
234
|
+
end
|
|
235
|
+
os_versions.each do |tag|
|
|
236
|
+
unless ALLOWED_OS_VERSIONS.include?(tag)
|
|
237
|
+
errors.add(:os_versions, N_("must be one of: %s" % ALLOWED_OS_VERSIONS.join(', ')))
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
217
242
|
def ensure_valid_upstream_authorization
|
|
218
243
|
return if (self.upstream_username.blank? && self.upstream_password.blank?)
|
|
219
244
|
if redhat?
|
|
@@ -340,7 +365,7 @@ module Katello
|
|
|
340
365
|
property :url, String, desc: 'Returns repository source URL'
|
|
341
366
|
end
|
|
342
367
|
class Jail < ::Safemode::Jail
|
|
343
|
-
allow :name, :label, :docker_upstream_name, :url
|
|
368
|
+
allow :name, :label, :docker_upstream_name, :url, :os_versions
|
|
344
369
|
end
|
|
345
370
|
end
|
|
346
371
|
end
|