katello 3.18.0.rc1 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +0 -19
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -3
- 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_credentials_controller.rb +24 -24
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +98 -0
- data/app/controllers/katello/api/v2/content_exports_controller.rb +88 -0
- data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +16 -7
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +57 -92
- data/app/controllers/katello/api/v2/content_views_controller.rb +12 -3
- data/app/controllers/katello/api/v2/host_debs_controller.rb +1 -0
- data/app/controllers/katello/api/v2/host_errata_controller.rb +2 -2
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -3
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +20 -7
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/products_controller.rb +9 -9
- data/app/controllers/katello/api/v2/repositories_controller.rb +5 -19
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +24 -14
- data/app/controllers/katello/api/v2/simple_content_access_controller.rb +34 -0
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +8 -4
- data/app/controllers/katello/concerns/api/v2/authorization.rb +10 -0
- data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +22 -18
- data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +1 -1
- data/app/controllers/katello/concerns/registration_controller_extensions.rb +16 -0
- data/app/helpers/katello/sync_management_helper.rb +0 -2
- data/app/lib/actions/candlepin/environment/create.rb +1 -1
- data/app/lib/actions/candlepin/environment/set_content.rb +1 -1
- data/app/lib/actions/helpers/smart_proxy_sync_history_helper.rb +24 -0
- data/app/lib/actions/katello/activation_key/create.rb +9 -11
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
- data/app/lib/actions/katello/capsule_content/sync.rb +8 -8
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +31 -8
- data/app/lib/actions/katello/check_matching_content.rb +17 -0
- data/app/lib/actions/katello/content_view/environment_create.rb +6 -8
- data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +6 -5
- data/app/lib/actions/katello/content_view_version/import.rb +5 -11
- data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +30 -10
- data/app/lib/actions/katello/host/hypervisors_update.rb +4 -4
- data/app/lib/actions/katello/host/update_system_purpose.rb +1 -1
- data/app/lib/actions/katello/host/upload_package_profile.rb +3 -1
- data/app/lib/actions/katello/host/upload_profiles.rb +8 -6
- data/app/lib/actions/katello/organization/create.rb +3 -5
- data/app/lib/actions/katello/organization/destroy.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_delete.rb +3 -5
- data/app/lib/actions/katello/organization/manifest_import.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
- data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
- data/app/lib/actions/katello/repository/clone_contents.rb +8 -11
- data/app/lib/actions/katello/repository/create.rb +0 -8
- data/app/lib/actions/katello/repository/filtered_index_content.rb +3 -0
- data/app/lib/actions/katello/repository/import_upload.rb +2 -0
- data/app/lib/actions/katello/repository/index_content.rb +1 -0
- data/app/lib/actions/katello/repository/multi_clone_contents.rb +9 -12
- data/app/lib/actions/katello/repository/remove_content.rb +1 -1
- data/app/lib/actions/katello/repository/sync.rb +3 -1
- data/app/lib/actions/katello/repository/update.rb +1 -8
- data/app/lib/actions/katello/repository/upload_files.rb +1 -0
- data/app/lib/actions/middleware/execute_if_contents_changed.rb +4 -1
- data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +35 -0
- data/app/lib/actions/pulp/consumer/sync_capsule.rb +4 -2
- data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -6
- data/app/lib/actions/pulp/repository/distributor_publish.rb +1 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +1 -0
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +3 -3
- data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -0
- 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_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/content_view_version/export.rb +6 -1
- 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 +30 -9
- 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/generate_metadata.rb +4 -1
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
- data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -6
- 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/concerns/base_template_scope_extensions.rb +8 -0
- data/app/lib/katello/event_daemon/monitor.rb +53 -0
- data/app/lib/katello/event_daemon/runner.rb +99 -0
- data/app/lib/katello/logging.rb +32 -0
- data/app/lib/katello/messaging/connection.rb +1 -7
- data/app/lib/katello/validators/content_view_puppet_module_validator.rb +1 -1
- data/app/models/katello/activation_key.rb +2 -2
- data/app/models/katello/authorization/content_view_filter.rb +15 -0
- 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/candlepin/repository_mapper.rb +1 -1
- data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
- data/app/models/katello/concerns/organization_extensions.rb +2 -2
- data/app/models/katello/concerns/pulp_database_unit.rb +7 -0
- data/app/models/katello/concerns/redhat_extensions.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +33 -5
- data/app/models/katello/content_migration_progress.rb +4 -0
- data/app/models/katello/content_view.rb +35 -5
- data/app/models/katello/content_view_environment.rb +2 -2
- data/app/models/katello/content_view_filter.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_puppet_environment.rb +2 -2
- data/app/models/katello/content_view_puppet_module.rb +8 -0
- data/app/models/katello/content_view_repository.rb +13 -1
- data/app/models/katello/content_view_version.rb +2 -1
- data/app/models/katello/content_view_version_export_history.rb +26 -1
- data/app/models/katello/erratum.rb +3 -1
- data/app/models/katello/glue/candlepin/pool.rb +2 -0
- data/app/models/katello/glue/pulp/repo.rb +0 -6
- data/app/models/katello/glue/pulp/repos.rb +1 -22
- data/app/models/katello/host/subscription_facet.rb +4 -0
- data/app/models/katello/ping.rb +11 -6
- data/app/models/katello/pool.rb +5 -0
- data/app/models/katello/product.rb +3 -3
- data/app/models/katello/repository.rb +36 -3
- data/app/models/katello/smart_proxy_sync_history.rb +8 -0
- data/app/models/katello/subscription_status.rb +3 -2
- data/app/presenters/katello/host_subscription_presenter.rb +3 -4
- data/app/presenters/katello/host_subscriptions_presenter.rb +24 -0
- data/app/services/katello/applicability/applicable_content_helper.rb +44 -15
- data/app/services/katello/candlepin_event_listener.rb +11 -19
- data/app/services/katello/event_monitor/poller_thread.rb +2 -11
- data/app/services/katello/pulp/smart_proxy_repository.rb +0 -15
- data/app/services/katello/pulp3/api/docker.rb +4 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +122 -6
- data/app/services/katello/pulp3/content_view_version/import.rb +37 -22
- data/app/services/katello/pulp3/content_view_version/import_export_common.rb +6 -16
- data/app/services/katello/pulp3/content_view_version/import_validator.rb +84 -0
- 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/migration.rb +51 -10
- data/app/services/katello/pulp3/repository.rb +13 -4
- data/app/services/katello/pulp3/repository/docker.rb +5 -0
- data/app/services/katello/pulp3/repository/yum.rb +15 -10
- data/app/services/katello/pulp3/task.rb +7 -3
- data/app/services/katello/pulp3/task_group.rb +10 -0
- data/app/services/katello/repository_type.rb +3 -2
- data/app/services/katello/smart_proxy_helper.rb +9 -0
- data/app/views/foreman/hosts/_registration.html.erb +12 -0
- data/app/views/foreman/smart_proxies/_content_tab.html.erb +4 -47
- data/app/views/foreman/smart_proxies/show.html.erb +1 -1
- data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +22 -25
- data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -0
- data/app/views/katello/api/v2/content_views/base.json.rabl +1 -0
- data/app/views/katello/api/v2/content_views/show.json.rabl +6 -0
- data/app/views/katello/api/v2/organizations/show.json.rabl +7 -9
- data/app/views/katello/layouts/react.html.erb +3 -2
- data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
- data/app/views/overrides/organizations/_edit_override.html.erb +1 -4
- data/app/views/overrides/smart_proxies/_environment_tab.html.erb +1 -1
- data/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb +1 -1
- data/config/katello.yaml.example +0 -3
- data/config/routes/api/v2.rb +31 -13
- data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
- data/db/migrate/20191204214919_add_content_view_version_counts.rb +0 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +5 -2
- data/db/migrate/20200929200357_create_katello_smart_proxy_sync_history.rb +13 -0
- data/db/migrate/20201021150008_add_import_only_to_katello_content_view.rb +5 -0
- data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +56 -0
- data/db/migrate/20210128231228_add_type_and_from_cvv_to_cvv_export_history.rb +14 -0
- data/db/migrate/20210201163238_migrate_background_download_policy_to_migrate.rb +7 -0
- data/db/seeds.d/104-proxy.rb +1 -1
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.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/content-host-register-os-client.directive.js +17 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +12 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-deb-client.html +38 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-oracle-client.html +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-sles-client.html +28 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +14 -11
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +6 -2
- 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/content-view-details.controller.js +12 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +7 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +7 -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/content-views/new/content-view-new.controller.js +17 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +5 -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/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/download-policy.service.js +0 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository-types.service.js +8 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
- data/lib/katello/engine.rb +6 -6
- data/lib/katello/middleware/event_daemon.rb +1 -1
- data/lib/katello/permission_creator.rb +35 -14
- data/lib/katello/plugin.rb +8 -3
- data/lib/katello/tasks/delete_orphaned_content.rake +1 -3
- data/lib/katello/tasks/jenkins.rake +1 -1
- data/lib/katello/tasks/pulp3_content_switchover.rake +1 -1
- data/lib/katello/tasks/pulp3_migration.rake +18 -6
- data/lib/katello/tasks/pulp3_migration_abort.rake +22 -0
- data/lib/katello/tasks/pulp3_migration_stats.rake +28 -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/reimport.rake +1 -1
- data/lib/katello/tasks/repository.rake +3 -5
- data/lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/lib/proxy_api/container_gateway.rb +21 -0
- data/locale/action_names.rb +51 -51
- data/locale/bn/katello.edit.po +0 -0
- data/locale/bn/katello.po +136 -51
- data/locale/cs/katello.edit.po +0 -0
- data/locale/cs/katello.po +136 -49
- data/locale/de/katello.edit.po +0 -0
- data/locale/de/katello.po +136 -48
- data/locale/en/katello.edit.po +0 -0
- data/locale/en/katello.po +136 -48
- data/locale/es/katello.edit.po +0 -0
- data/locale/es/katello.po +136 -48
- data/locale/fr/katello.edit.po +0 -0
- data/locale/fr/katello.po +136 -48
- data/locale/gu/katello.edit.po +0 -0
- data/locale/gu/katello.po +136 -51
- data/locale/hi/katello.edit.po +0 -0
- data/locale/hi/katello.po +136 -51
- data/locale/it/katello.edit.po +0 -0
- data/locale/it/katello.po +136 -48
- data/locale/ja/katello.edit.po +0 -0
- data/locale/ja/katello.po +136 -48
- data/locale/katello.pot +941 -767
- data/locale/kn/katello.edit.po +0 -0
- data/locale/kn/katello.po +136 -51
- data/locale/ko/katello.edit.po +0 -0
- data/locale/ko/katello.po +136 -48
- data/locale/mr/katello.edit.po +0 -0
- data/locale/mr/katello.po +136 -51
- data/locale/or/katello.edit.po +0 -0
- data/locale/or/katello.po +136 -51
- data/locale/pa/katello.edit.po +0 -0
- data/locale/pa/katello.po +136 -51
- data/locale/pt/katello.edit.po +0 -0
- data/locale/pt/katello.po +136 -51
- data/locale/pt_BR/katello.edit.po +0 -0
- data/locale/pt_BR/katello.po +136 -48
- data/locale/ru/katello.edit.po +0 -0
- data/locale/ru/katello.po +136 -48
- data/locale/ta/katello.edit.po +0 -0
- data/locale/ta/katello.po +136 -51
- data/locale/te/katello.edit.po +0 -0
- data/locale/te/katello.po +136 -51
- data/locale/zh_CN/katello.edit.po +0 -0
- data/locale/zh_CN/katello.po +136 -48
- data/locale/zh_TW/katello.edit.po +0 -0
- data/locale/zh_TW/katello.po +136 -48
- data/package.json +1 -1
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -1
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +5 -0
- data/webpack/{scenes/ContentViews/Details/Repositories → components/SelectableDropdown}/SelectableDropdown.js +20 -3
- data/webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js +45 -0
- data/webpack/components/SelectableDropdown/index.js +3 -0
- data/webpack/components/Table/TableWrapper.js +2 -1
- data/webpack/components/Table/helpers.js +14 -0
- data/webpack/components/TypeAhead/TypeAhead.js +2 -1
- data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +2 -1
- data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +0 -1
- data/webpack/containers/Application/overrides.scss +6 -0
- data/webpack/index.js +6 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/scenes/ContentViews/ContentViewsActions.js +31 -2
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +5 -1
- data/webpack/scenes/ContentViews/Copy/ContentViewCopySelectors.js +16 -0
- data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +77 -0
- data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +44 -0
- data/webpack/scenes/ContentViews/Copy/__tests__/contentViewCopyResult.fixtures.json +42 -0
- data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +39 -0
- data/webpack/scenes/ContentViews/Copy/index.js +4 -0
- data/webpack/scenes/ContentViews/Create/ContentViewCreateSelectors.js +16 -0
- data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +58 -0
- data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +175 -0
- data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +27 -0
- data/webpack/scenes/ContentViews/Create/__tests__/contentViewCreateResult.fixtures.json +42 -0
- data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +92 -0
- data/webpack/scenes/ContentViews/Create/index.js +4 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +16 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +20 -1
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +17 -7
- data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +19 -13
- data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +40 -0
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +124 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.fixtures.json +134 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +92 -0
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +44 -25
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +17 -7
- data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +24 -0
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -3
- data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +4 -3
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +41 -0
- data/webpack/scenes/ContentViews/helpers.js +13 -0
- data/webpack/scenes/SmartProxy/Content.js +17 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +11 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentConstants.js +3 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentSelectors.js +16 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +152 -0
- data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentResult.fixtures.json +140 -0
- data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +38 -0
- data/webpack/scenes/SmartProxy/index.js +4 -0
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +13 -11
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +3 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +2 -2
- data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +2 -2
- data/webpack/test-utils/react-testing-lib-wrapper.js +8 -2
- data/webpack/utils/helpers.js +3 -0
- metadata +110 -31
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +0 -114
- data/app/overrides/disable_turbolinks_on_proxies_index.rb +0 -5
- data/app/services/katello/event_daemon.rb +0 -135
- data/app/services/katello/pulp/content_counts_calculator.rb +0 -60
- data/lib/katello/tasks/common.rake +0 -7
- data/lib/katello/tasks/reports.rake +0 -4
- data/lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake +0 -32
- data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +0 -3
- data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +0 -5
- data/webpack/scenes/ContentViews/Table/actionResolver.js +0 -28
@@ -43,9 +43,10 @@ module Katello
|
|
43
43
|
|
44
44
|
def to_status(options = {})
|
45
45
|
return UNKNOWN unless host.subscription_facet.try(:uuid)
|
46
|
-
|
46
|
+
return DISABLED if host.organization.simple_content_access?
|
47
|
+
status_override = 'unsubscribed_hypervisor' if host.subscription_facet.unsubscribed_hypervisor?
|
47
48
|
status_override ||= options.fetch(:status_override, nil)
|
48
|
-
status = status_override ||
|
49
|
+
status = status_override || host.subscription_facet.candlepin_consumer.entitlement_status
|
49
50
|
|
50
51
|
case status
|
51
52
|
when Katello::Candlepin::Consumer::ENTITLEMENTS_DISABLED
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module Katello
|
2
2
|
class HostSubscriptionPresenter < SimpleDelegator
|
3
|
-
|
3
|
+
attr_reader :quantity_consumed
|
4
4
|
|
5
|
-
def initialize(entitlement)
|
6
|
-
@subscription = Katello::Pool.find_by(:cp_id => entitlement['pool']['id'])
|
5
|
+
def initialize(pool:, entitlement:)
|
7
6
|
@quantity_consumed = entitlement.try(:[], :quantity)
|
8
|
-
super(
|
7
|
+
super(pool)
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Katello
|
2
|
+
class HostSubscriptionsPresenter
|
3
|
+
attr_reader :subscriptions
|
4
|
+
|
5
|
+
def initialize(host)
|
6
|
+
pools = host.subscription_facet&.pools || []
|
7
|
+
@pools = pools.group_by(&:cp_id)
|
8
|
+
|
9
|
+
entitlements = host.subscription_facet.candlepin_consumer.entitlements if @pools.any?
|
10
|
+
entitlements ||= []
|
11
|
+
|
12
|
+
@subscriptions = entitlements.map do |e|
|
13
|
+
HostSubscriptionPresenter.new(pool: pool_for_entitlement(e), entitlement: e)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def pool_for_entitlement(entitlement)
|
20
|
+
pool_cp_id = entitlement['pool']['id']
|
21
|
+
@pools[pool_cp_id]&.first
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -60,17 +60,7 @@ module Katello
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def fetch_rpm_content_ids
|
63
|
-
|
64
|
-
# -> Include all non-modular rpms or rpms that exist within installed module streams
|
65
|
-
enabled_module_stream_ids = ::Katello::ModuleStream.
|
66
|
-
joins("inner join katello_available_module_streams on
|
67
|
-
katello_module_streams.name = katello_available_module_streams.name and
|
68
|
-
katello_module_streams.stream = katello_available_module_streams.stream").
|
69
|
-
joins("inner join katello_host_available_module_streams on
|
70
|
-
katello_available_module_streams.id = katello_host_available_module_streams.available_module_stream_id").
|
71
|
-
where("katello_host_available_module_streams.host_id = :content_facet_id and
|
72
|
-
katello_host_available_module_streams.status = 'enabled'",
|
73
|
-
:content_facet_id => self.content_facet.host.id).select(:id)
|
63
|
+
enabled_module_stream_ids = fetch_enabled_module_stream_ids
|
74
64
|
|
75
65
|
::Katello::Rpm.
|
76
66
|
joins("INNER JOIN katello_repository_rpms ON
|
@@ -78,7 +68,8 @@ module Katello
|
|
78
68
|
joins("INNER JOIN katello_installed_packages ON
|
79
69
|
katello_rpms.name = katello_installed_packages.name AND
|
80
70
|
katello_rpms.arch = katello_installed_packages.arch AND
|
81
|
-
katello_rpms.evr > katello_installed_packages.evr
|
71
|
+
katello_rpms.evr > katello_installed_packages.evr AND
|
72
|
+
katello_installed_packages.id in (#{newest_distinct_installed_packages_query})").
|
82
73
|
joins("LEFT JOIN katello_module_stream_rpms ON
|
83
74
|
katello_rpms.id = katello_module_stream_rpms.rpm_id").
|
84
75
|
joins("INNER JOIN katello_host_installed_packages ON
|
@@ -87,9 +78,47 @@ module Katello
|
|
87
78
|
:bound_library_repos => self.bound_library_instance_repos).
|
88
79
|
where("katello_host_installed_packages.host_id = :content_facet_id",
|
89
80
|
:content_facet_id => self.content_facet.host.id).
|
90
|
-
where("katello_module_stream_rpms.module_stream_id
|
91
|
-
|
92
|
-
|
81
|
+
where("(katello_module_stream_rpms.module_stream_id IS NULL AND
|
82
|
+
katello_installed_packages.id NOT IN (:locked_modular_installed_packages)) OR
|
83
|
+
(katello_module_stream_rpms.module_stream_id IN (:enabled_module_streams)
|
84
|
+
AND katello_installed_packages.id IN (:locked_modular_installed_packages))",
|
85
|
+
:enabled_module_streams => enabled_module_stream_ids,
|
86
|
+
:locked_modular_installed_packages => locked_modular_installed_packages(enabled_module_stream_ids)).pluck(:id).uniq
|
87
|
+
end
|
88
|
+
|
89
|
+
def fetch_enabled_module_stream_ids
|
90
|
+
# Query for applicable RPM ids
|
91
|
+
# -> Include all non-modular rpms or rpms that exist within installed module streams
|
92
|
+
::Katello::ModuleStream.
|
93
|
+
joins("inner join katello_available_module_streams on
|
94
|
+
katello_module_streams.name = katello_available_module_streams.name and
|
95
|
+
katello_module_streams.stream = katello_available_module_streams.stream").
|
96
|
+
joins("inner join katello_host_available_module_streams on
|
97
|
+
katello_available_module_streams.id = katello_host_available_module_streams.available_module_stream_id").
|
98
|
+
where("katello_host_available_module_streams.host_id = :content_facet_id and
|
99
|
+
katello_host_available_module_streams.status = 'enabled'",
|
100
|
+
:content_facet_id => self.content_facet.host.id).select(:id)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Installed packages that are locked for the host due to enabled module stream membership
|
104
|
+
def locked_modular_installed_packages(enabled_module_streams)
|
105
|
+
rpms_in_enabled_module_streams = ::Katello::Rpm.
|
106
|
+
joins("INNER JOIN katello_module_stream_rpms ON katello_rpms.id = katello_module_stream_rpms.rpm_id").
|
107
|
+
where("katello_module_stream_rpms.module_stream_id IN (:enabled_module_streams)",
|
108
|
+
:enabled_module_streams => enabled_module_streams).select(:nvra, :epoch)
|
109
|
+
|
110
|
+
::Katello::InstalledPackage.where(nvra: rpms_in_enabled_module_streams.map(&:nvra),
|
111
|
+
epoch: rpms_in_enabled_module_streams.map(&:epoch)).select(:id)
|
112
|
+
end
|
113
|
+
|
114
|
+
def newest_distinct_installed_packages_query
|
115
|
+
"SELECT DISTINCT ON (katello_installed_packages.name) katello_installed_packages.id " \
|
116
|
+
"FROM katello_installed_packages INNER JOIN " \
|
117
|
+
"katello_host_installed_packages ON " \
|
118
|
+
"katello_installed_packages.id = " \
|
119
|
+
"katello_host_installed_packages.installed_package_id " \
|
120
|
+
"WHERE katello_host_installed_packages.host_id = " \
|
121
|
+
"#{content_facet.host.id} ORDER BY katello_installed_packages.name, katello_installed_packages.evr DESC"
|
93
122
|
end
|
94
123
|
|
95
124
|
def applicable_differences
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Katello
|
2
2
|
class CandlepinEventListener
|
3
|
-
STATUS_CACHE_KEY = 'candlepin_events_status'.freeze
|
4
|
-
|
5
3
|
Event = Struct.new(:subject, :content)
|
6
4
|
|
7
5
|
cattr_accessor :client_factory
|
@@ -14,22 +12,20 @@ module Katello
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.running?
|
17
|
-
@
|
15
|
+
@client&.running? || false
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.close
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@client&.close
|
19
|
+
if @client&.close
|
20
|
+
logger.info("Closed candlepin event listener")
|
21
|
+
end
|
25
22
|
reset
|
26
23
|
end
|
27
24
|
|
28
25
|
def self.reset
|
29
26
|
@processed_count = 0
|
30
27
|
@failed_count = 0
|
31
|
-
@
|
32
|
-
Rails.cache.delete(STATUS_CACHE_KEY)
|
28
|
+
@client = nil
|
33
29
|
end
|
34
30
|
|
35
31
|
def self.run
|
@@ -37,18 +33,14 @@ module Katello
|
|
37
33
|
@client.subscribe do |message|
|
38
34
|
handle_message(message)
|
39
35
|
end
|
40
|
-
|
41
|
-
@running = true
|
42
36
|
end
|
43
37
|
|
44
|
-
def self.status
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
end
|
38
|
+
def self.status
|
39
|
+
{
|
40
|
+
processed_count: @processed_count,
|
41
|
+
failed_count: @failed_count,
|
42
|
+
running: running?
|
43
|
+
}
|
52
44
|
end
|
53
45
|
|
54
46
|
def self.handle_message(message)
|
@@ -2,7 +2,6 @@ module Katello
|
|
2
2
|
module EventMonitor
|
3
3
|
class PollerThread
|
4
4
|
SLEEP_INTERVAL = 3
|
5
|
-
STATUS_CACHE_KEY = 'katello_events_status'.freeze
|
6
5
|
|
7
6
|
cattr_accessor :instance
|
8
7
|
|
@@ -15,7 +14,6 @@ module Katello
|
|
15
14
|
self.instance.close
|
16
15
|
self.instance = nil
|
17
16
|
end
|
18
|
-
reset_status
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.run
|
@@ -24,14 +22,8 @@ module Katello
|
|
24
22
|
instance.poll_for_events
|
25
23
|
end
|
26
24
|
|
27
|
-
def self.status
|
28
|
-
|
29
|
-
instance&.status
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.reset_status
|
34
|
-
Rails.cache.delete(STATUS_CACHE_KEY)
|
25
|
+
def self.status
|
26
|
+
instance&.status
|
35
27
|
end
|
36
28
|
|
37
29
|
def initialize(logger = nil)
|
@@ -85,7 +77,6 @@ module Katello
|
|
85
77
|
end
|
86
78
|
|
87
79
|
def poll_for_events
|
88
|
-
@thread&.kill
|
89
80
|
@thread = Thread.new do
|
90
81
|
@logger.info("Polling Katello Event Queue")
|
91
82
|
loop do
|
@@ -42,21 +42,6 @@ module Katello
|
|
42
42
|
puppet_repos.where(:pulp_id => pulp_repos.map { |pulp_repo| pulp_repo['id'] })
|
43
43
|
end
|
44
44
|
|
45
|
-
def current_repositories_data(environment = nil, content_view = nil)
|
46
|
-
@pulp_repositories ||= smart_proxy.pulp_repositories
|
47
|
-
|
48
|
-
repos = Katello::Repository
|
49
|
-
repos = repos.in_environment(environment) if environment
|
50
|
-
repos = repos.in_content_views([content_view]) if content_view
|
51
|
-
puppet_envs = Katello::ContentViewPuppetEnvironment
|
52
|
-
puppet_envs = puppet_envs.in_environment(environment) if environment
|
53
|
-
puppet_envs = puppet_envs.in_content_view(content_view) if content_view
|
54
|
-
|
55
|
-
repo_ids = repos.pluck(:pulp_id) + puppet_envs.pluck(:pulp_id)
|
56
|
-
|
57
|
-
@pulp_repositories.select { |r| repo_ids.include?(r['id']) }
|
58
|
-
end
|
59
|
-
|
60
45
|
def orphaned_repos
|
61
46
|
@smart_proxy.pulp_repositories.map { |x| x["id"] } - repos_available_to_capsule.map { |x| x.pulp_id }
|
62
47
|
end
|
@@ -32,6 +32,10 @@ module Katello
|
|
32
32
|
PulpContainerClient::RecursiveManage
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.tag_image_class
|
36
|
+
PulpContainerClient::TagImage
|
37
|
+
end
|
38
|
+
|
35
39
|
def api_client
|
36
40
|
PulpContainerClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpContainerClient::Configuration))
|
37
41
|
end
|
@@ -4,10 +4,35 @@ module Katello
|
|
4
4
|
class Export
|
5
5
|
include ImportExportCommon
|
6
6
|
|
7
|
-
def initialize(smart_proxy:,
|
7
|
+
def initialize(smart_proxy:,
|
8
|
+
content_view_version: nil,
|
9
|
+
destination_server: nil,
|
10
|
+
from_content_view_version: nil)
|
8
11
|
@smart_proxy = smart_proxy
|
9
12
|
@content_view_version = content_view_version
|
10
13
|
@destination_server = destination_server
|
14
|
+
@from_content_view_version = from_content_view_version
|
15
|
+
end
|
16
|
+
|
17
|
+
def repository_hrefs
|
18
|
+
version_hrefs.map { |href| version_href_to_repository_href(href) }.uniq
|
19
|
+
end
|
20
|
+
|
21
|
+
def version_hrefs
|
22
|
+
repositories.pluck(:version_href).compact
|
23
|
+
end
|
24
|
+
|
25
|
+
def repositories(fetch_all: false)
|
26
|
+
repos = if @content_view_version.default?
|
27
|
+
@content_view_version.repositories.yum_type
|
28
|
+
else
|
29
|
+
@content_view_version.archived_repos.yum_type
|
30
|
+
end
|
31
|
+
if fetch_all
|
32
|
+
repos
|
33
|
+
else
|
34
|
+
repos.immediate
|
35
|
+
end
|
11
36
|
end
|
12
37
|
|
13
38
|
def generate_exporter_path
|
@@ -25,9 +50,32 @@ module Katello
|
|
25
50
|
repositories: repository_hrefs)
|
26
51
|
end
|
27
52
|
|
28
|
-
def create_export(exporter_href, chunk_size
|
53
|
+
def create_export(exporter_href, chunk_size: nil)
|
29
54
|
options = { versions: version_hrefs }
|
30
55
|
options[:chunk_size] = "#{chunk_size}MB" if chunk_size
|
56
|
+
if @from_content_view_version
|
57
|
+
from_exporter = Export.new(smart_proxy: @smart_proxy, content_view_version: @from_content_view_version)
|
58
|
+
start_versions = from_exporter.version_hrefs
|
59
|
+
|
60
|
+
# current_cvv - cvv_from , i.e. repos in current cvv that are not in from
|
61
|
+
# implying something got added to the current cvv
|
62
|
+
# make sure you set the start_versions as 0
|
63
|
+
added_repo_hrefs = repository_hrefs - from_exporter.repository_hrefs
|
64
|
+
added_repo_hrefs.each do |added_repo_href|
|
65
|
+
start_versions << zero_version_href(added_repo_href)
|
66
|
+
end
|
67
|
+
|
68
|
+
# cvv_from - current_cvv , i.e. repos in from cvv that are not in current
|
69
|
+
# implying something got removed the current cvv
|
70
|
+
# make sure the start_versions doesn't contain those
|
71
|
+
deleted_repo_hrefs = from_exporter.repository_hrefs - repository_hrefs
|
72
|
+
start_versions.select! do |href|
|
73
|
+
!deleted_repo_hrefs.include?(version_href_to_repository_href(href))
|
74
|
+
end
|
75
|
+
|
76
|
+
options[:start_versions] = start_versions
|
77
|
+
options[:full] = 'false'
|
78
|
+
end
|
31
79
|
[api.export_api.create(exporter_href, options)]
|
32
80
|
end
|
33
81
|
|
@@ -42,15 +90,67 @@ module Katello
|
|
42
90
|
api.exporter_api.delete(exporter_href)
|
43
91
|
end
|
44
92
|
|
93
|
+
def validate!(fail_on_missing_content: true, validate_incremental: true)
|
94
|
+
validate_repositories_immediate! if fail_on_missing_content
|
95
|
+
validate_incremental_export! if validate_incremental && !@from_content_view_version.blank?
|
96
|
+
end
|
97
|
+
|
98
|
+
def validate_repositories_immediate!
|
99
|
+
non_immediate_repos = repositories(fetch_all: true).non_immediate
|
100
|
+
if non_immediate_repos.any?
|
101
|
+
fail _("NOTE: Unable to fully export Content View Version '%{content_view} %{current}'"\
|
102
|
+
" it contains repositories without the 'immediate' download policy."\
|
103
|
+
" Update the download policy and sync affected repositories. Once synced republish the content view"\
|
104
|
+
" and export the generated version. \n %{repos}" %
|
105
|
+
{ content_view: @content_view_version.content_view.name,
|
106
|
+
current: @content_view_version.version,
|
107
|
+
repos: self.class.generate_product_repo_strings(repositories: non_immediate_repos)})
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def validate_incremental_export!
|
112
|
+
from_exporter = Export.new(smart_proxy: @smart_proxy, content_view_version: @from_content_view_version)
|
113
|
+
|
114
|
+
from_exporter_repos = generate_repo_mapping(from_exporter.repositories(fetch_all: true))
|
115
|
+
to_exporter_repos = generate_repo_mapping(repositories(fetch_all: true))
|
116
|
+
|
117
|
+
invalid_repos_exist = (from_exporter_repos.keys & to_exporter_repos.keys).any? do |repo_id|
|
118
|
+
from_exporter_repos[repo_id] != to_exporter_repos[repo_id]
|
119
|
+
end
|
120
|
+
|
121
|
+
if invalid_repos_exist
|
122
|
+
fail _("The exported Content View Version '%{content_view} %{current}' cannot be incrementally updated from version '%{from}'."\
|
123
|
+
" Please do a full export." % { content_view: @content_view_version.content_view.name,
|
124
|
+
current: @content_view_version.version,
|
125
|
+
from: @from_content_view_version.version})
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def generate_repo_mapping(repositories)
|
130
|
+
# return a repo mapping with key being the library_instance_id and value being the repostiory_href
|
131
|
+
# used by validate_incremental_export
|
132
|
+
repo_map = {}
|
133
|
+
repositories.each do |repo|
|
134
|
+
repo_map[repo.library_instance_id] = version_href_to_repository_href(repo.version_href)
|
135
|
+
end
|
136
|
+
repo_map
|
137
|
+
end
|
138
|
+
|
45
139
|
def generate_metadata
|
46
140
|
ret = { organization: @content_view_version.organization.name,
|
47
141
|
repository_mapping: {},
|
48
142
|
content_view: @content_view_version.content_view.name,
|
49
|
-
content_view_version:
|
50
|
-
|
51
|
-
minor: @content_view_version.minor
|
52
|
-
}
|
143
|
+
content_view_version: @content_view_version.slice(:major, :minor),
|
144
|
+
incremental: @from_content_view_version.present?
|
53
145
|
}
|
146
|
+
|
147
|
+
unless @from_content_view_version.blank?
|
148
|
+
ret[:from_content_view_version] = {
|
149
|
+
major: @from_content_view_version.major,
|
150
|
+
minor: @from_content_view_version.minor
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
54
154
|
repositories.each do |repo|
|
55
155
|
next if repo.version_href.blank?
|
56
156
|
pulp3_repo = fetch_repository_info(repo.version_href).name
|
@@ -62,6 +162,22 @@ module Katello
|
|
62
162
|
end
|
63
163
|
ret
|
64
164
|
end
|
165
|
+
|
166
|
+
def self.find_library_export_view(create_by_default: false,
|
167
|
+
destination_server:,
|
168
|
+
organization:)
|
169
|
+
name = "Export-Library"
|
170
|
+
name += "-#{destination_server}" unless destination_server.blank?
|
171
|
+
select_method = create_by_default ? :first_or_create : :first
|
172
|
+
::Katello::ContentView.where(name: name, organization: organization).send(select_method)
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.generate_product_repo_strings(repositories:)
|
176
|
+
repositories.map do |repo|
|
177
|
+
_("Product: '%{product}', Repository: '%{repository}'" % { product: repo.product.name,
|
178
|
+
repository: repo.name})
|
179
|
+
end
|
180
|
+
end
|
65
181
|
end
|
66
182
|
end
|
67
183
|
end
|
@@ -3,7 +3,6 @@ module Katello
|
|
3
3
|
module ContentViewVersion
|
4
4
|
class Import
|
5
5
|
include ImportExportCommon
|
6
|
-
BASEDIR = '/var/lib/pulp'.freeze
|
7
6
|
|
8
7
|
def initialize(smart_proxy:, content_view_version: nil, path: nil, metadata: nil)
|
9
8
|
@smart_proxy = smart_proxy
|
@@ -44,32 +43,48 @@ module Katello
|
|
44
43
|
api.importer_api.delete(importer_href)
|
45
44
|
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
fail _("The import path must be in a subdirectory under '%s'." % BASEDIR) unless path.starts_with?(BASEDIR)
|
51
|
-
fail _("Pulp user or group unable to read content in '%s'." % path) unless pulp_user_accessible?(path)
|
52
|
-
|
53
|
-
Dir.glob("#{path}/*").each do |file|
|
54
|
-
fail _("Pulp user or group unable to read '%s'." % file) unless pulp_user_accessible?(file)
|
55
|
-
end
|
56
|
-
end
|
46
|
+
def self.check!(content_view:, metadata:, path:)
|
47
|
+
ImportValidator.new(content_view: content_view, metadata: metadata, path: path).check!
|
48
|
+
end
|
57
49
|
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
def self.reset_content_view_repositories_from_metadata!(content_view:, metadata:)
|
51
|
+
# Given metadata from the dump and a content view
|
52
|
+
# this method
|
53
|
+
# 1) Fetches ids of the library repos whose product name, repo name amd redhat?
|
54
|
+
# => match values provided in the metadata's repository mapping
|
55
|
+
# 2) Removes all the repositories associated to this content view
|
56
|
+
# 3) Adds the repositories matched from the dump
|
57
|
+
# The main intent of this method is to assume that the user intends for the
|
58
|
+
# content view to exaclty look like what is specified in metadata
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
repos_in_library = Katello::Repository.
|
61
|
+
in_default_view.
|
62
|
+
yum_type.
|
63
|
+
joins(:product => :provider, :content_view_version => :content_view).
|
64
|
+
joins(:root).
|
65
|
+
where("#{::Katello::ContentView.table_name}.organization_id" => content_view.organization_id).
|
66
|
+
pluck("#{::Katello::Repository.table_name}.id",
|
67
|
+
"#{::Katello::RootRepository.table_name}.name",
|
68
|
+
"#{::Katello::Product.table_name}.name",
|
69
|
+
"#{::Katello::Provider.table_name}.provider_type"
|
70
|
+
)
|
71
|
+
repos_in_library_map = {}
|
72
|
+
# repos_in_library_map is going to look like {['repo1', 'product1', false] => 100, ['repo1', 'product1', true] => 200 }
|
73
|
+
repos_in_library.each do |id, repo, product, provider_type|
|
74
|
+
repos_in_library_map[[repo, product, provider_type == Katello::Provider::REDHAT]] = id
|
66
75
|
end
|
67
76
|
|
68
|
-
|
69
|
-
|
70
|
-
Etc.passwd { |u| pulp_user = u if u.name == 'pulp' }
|
71
|
-
pulp_user
|
77
|
+
repo_ids = metadata[:repository_mapping].values.map do |repo|
|
78
|
+
repos_in_library_map[[repo[:repository], repo[:product], repo[:redhat]]]
|
72
79
|
end
|
80
|
+
content_view.update!(repository_ids: repo_ids)
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.find_or_create_library_import_view(organization)
|
84
|
+
name = ::Katello::ContentView::IMPORT_LIBRARY
|
85
|
+
::Katello::ContentView.where(name: name,
|
86
|
+
organization: organization,
|
87
|
+
import_only: true).first_or_create
|
73
88
|
end
|
74
89
|
end
|
75
90
|
end
|