katello 4.7.6 → 4.8.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/registry/registry_proxies_controller.rb +6 -4
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -12
- data/app/controllers/katello/api/v2/capsule_content_controller.rb +0 -4
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +22 -81
- data/app/controllers/katello/api/v2/content_exports_controller.rb +11 -80
- data/app/controllers/katello/api/v2/content_imports_controller.rb +1 -0
- data/app/controllers/katello/api/v2/exports_controller.rb +130 -0
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +7 -8
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +8 -4
- data/app/controllers/katello/api/v2/organizations_controller.rb +3 -0
- data/app/controllers/katello/api/v2/package_groups_controller.rb +0 -52
- data/app/controllers/katello/api/v2/simple_content_access_controller.rb +1 -3
- data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -6
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -2
- data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +4 -1
- data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +24 -0
- data/app/controllers/katello/concerns/hosts_controller_extensions.rb +3 -3
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +55 -24
- data/app/helpers/katello/katello_urls_helper.rb +0 -15
- data/app/helpers/katello/sync_management_helper.rb +0 -4
- data/app/lib/actions/candlepin/owner/destroy_imports.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync.rb +0 -4
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +1 -2
- data/app/lib/actions/katello/content_view/publish.rb +6 -2
- data/app/lib/actions/katello/content_view/remove.rb +8 -2
- data/app/lib/actions/katello/content_view_version/destroy.rb +1 -1
- data/app/lib/actions/katello/environment/destroy.rb +8 -2
- data/app/lib/actions/katello/host/reassign.rb +4 -2
- data/app/lib/actions/katello/organization/simple_content_access/enable.rb +0 -10
- data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +2 -12
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +0 -1
- data/app/lib/actions/katello/product/destroy.rb +2 -1
- data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -10
- data/app/lib/actions/katello/repository/import_upload.rb +0 -1
- data/app/lib/actions/katello/repository/sync.rb +0 -1
- data/app/lib/actions/katello/repository/update.rb +5 -3
- data/app/lib/actions/katello/repository/upload_files.rb +0 -1
- data/app/lib/actions/pulp3/abstract.rb +0 -6
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -2
- data/app/lib/actions/pulp3/content_view_version/create_syncable_export_history.rb +4 -0
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +1 -0
- data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +7 -2
- data/app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb +7 -2
- data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -2
- data/app/lib/actions/pulp3/repository/save_distribution_references.rb +2 -2
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
- data/app/lib/katello/concerns/renderer_extensions.rb +1 -1
- data/app/lib/katello/event_daemon/runner.rb +12 -9
- data/app/lib/katello/resources/candlepin/consumer.rb +6 -6
- data/app/lib/katello/resources/candlepin/owner.rb +1 -1
- data/app/lib/katello/resources/candlepin/upstream_consumer.rb +3 -4
- data/app/lib/katello/resources/candlepin.rb +4 -4
- data/app/lib/katello/util/errata.rb +12 -10
- data/app/lib/katello/util/search.rb +0 -1
- data/app/lib/katello/validators/content_view_environment_org_validator.rb +5 -2
- data/app/lib/katello/validators/content_view_environment_validator.rb +1 -2
- data/app/lib/katello/validators/generated_content_view_validator.rb +16 -0
- data/app/mailers/katello/errata_mailer.rb +4 -2
- data/app/models/katello/alternate_content_source.rb +5 -1
- data/app/models/katello/concerns/content_facet_host_extensions.rb +25 -14
- data/app/models/katello/concerns/host_managed_extensions.rb +17 -8
- data/app/models/katello/concerns/redhat_extensions.rb +16 -6
- data/app/models/katello/concerns/smart_proxy_extensions.rb +0 -12
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -0
- data/app/models/katello/content_view.rb +22 -5
- data/app/models/katello/content_view_environment.rb +11 -2
- data/app/models/katello/content_view_environment_content_facet.rb +9 -0
- data/app/models/katello/content_view_version.rb +10 -5
- data/app/models/katello/erratum.rb +6 -1
- data/app/models/katello/glue/candlepin/pool.rb +6 -0
- data/app/models/katello/glue/candlepin/product.rb +7 -1
- data/app/models/katello/glue/candlepin/subscription.rb +5 -0
- data/app/models/katello/glue/provider.rb +26 -26
- data/app/models/katello/host/content_facet.rb +106 -18
- data/app/models/katello/host/info_provider.rb +25 -21
- data/app/models/katello/host/subscription_facet.rb +18 -14
- data/app/models/katello/kt_environment.rb +12 -7
- data/app/models/katello/package_group.rb +0 -12
- data/app/models/katello/pool.rb +4 -1
- data/app/models/katello/product.rb +11 -1
- data/app/models/katello/product_content.rb +0 -4
- data/app/models/katello/repository.rb +11 -11
- data/app/models/katello/root_repository.rb +4 -3
- data/app/models/katello/task_status.rb +0 -18
- data/app/services/katello/candlepin/consumer.rb +2 -2
- data/app/services/katello/host/package_profile_uploader.rb +1 -1
- data/app/services/katello/product_content_finder.rb +11 -12
- data/app/services/katello/pulp3/content_view_version/export.rb +8 -65
- data/app/services/katello/pulp3/content_view_version/export_validation_error.rb +7 -0
- data/app/services/katello/pulp3/content_view_version/export_validator.rb +105 -0
- data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -1
- data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +7 -1
- data/app/services/katello/pulp3/erratum.rb +1 -0
- data/app/services/katello/pulp3/module_stream.rb +26 -11
- data/app/services/katello/pulp3/repository/yum.rb +2 -1
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +2 -1
- data/app/services/katello/registration_manager.rb +46 -26
- data/app/services/katello/repository_type.rb +3 -9
- data/app/services/katello/simple_package.rb +22 -0
- data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -0
- data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +1 -0
- data/app/views/katello/api/v2/content_facet/base.json.rabl +23 -2
- data/app/views/katello/api/v2/content_facet/show.json.rabl +11 -8
- data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
- data/app/views/katello/api/v2/hosts/base.json.rabl +22 -2
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +2 -2
- data/config/initializers/monkeys.rb +0 -2
- data/config/routes/api/registry.rb +8 -7
- data/config/routes/api/v2.rb +0 -2
- data/config/routes.rb +3 -0
- data/db/migrate/20200429153103_installed_package_bad_nvrea.rb +1 -1
- data/db/migrate/20220110223754_update_disconnected_settings.rb +4 -8
- data/db/migrate/20220228173251_remove_drpm_from_ignorable_content.rb +7 -3
- data/db/migrate/20220419193414_content_settings_to_dsl_category.rb +1 -1
- data/db/migrate/20220929204746_add_content_view_environment_content_facet.rb +52 -0
- data/db/migrate/20221123212341_remove_pulp_docker_registry_port_setting.rb +5 -0
- data/db/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb +1 -1
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion/app/assets/stylesheets/bastion/bastion.scss +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +0 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +11 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +8 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +5485 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +5397 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +5658 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +5284 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ka.po +5231 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +5275 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +5389 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +5212 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +5145 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +2 -2
- data/lib/katello/engine.rb +2 -1
- data/lib/katello/permission_creator.rb +2 -4
- data/lib/katello/permissions/registry_permissions.rb +5 -5
- data/lib/katello/plugin.rb +22 -14
- data/lib/katello/repository_types/README.md +136 -19
- data/lib/katello/repository_types/deb.rb +0 -1
- data/lib/katello/repository_types/docker.rb +0 -1
- data/lib/katello/repository_types/file.rb +0 -1
- data/lib/katello/repository_types/yum.rb +0 -4
- data/lib/katello/tasks/clean_candlepin_orphaned_products.rake +38 -0
- data/lib/katello/tasks/clean_orphaned_facets.rb +20 -0
- data/lib/katello/tasks/reimport.rake +1 -2
- data/lib/katello/tasks/repository.rake +1 -22
- data/lib/katello/tasks/reset.rake +1 -0
- data/lib/katello/tasks/upgrades/4.8/fix_incorrect_providers.rake +29 -0
- data/lib/katello/version.rb +1 -1
- data/lib/katello.rb +0 -5
- data/locale/bn/katello.po +69 -27
- data/locale/cs/katello.po +69 -27
- data/locale/de/katello.po +78 -36
- data/locale/en/katello.po +69 -27
- data/locale/es/katello.po +70 -28
- data/locale/fr/katello.po +73 -31
- data/locale/gu/katello.po +69 -27
- data/locale/hi/katello.po +69 -27
- data/locale/it/katello.po +69 -27
- data/locale/ja/katello.po +73 -31
- data/locale/ka/katello.po +73 -31
- data/locale/katello.pot +335 -262
- data/locale/kn/katello.po +69 -27
- data/locale/ko/katello.po +69 -27
- data/locale/mr/katello.po +69 -27
- data/locale/or/katello.po +69 -27
- data/locale/pa/katello.po +69 -27
- data/locale/pt/katello.po +69 -27
- data/locale/pt_BR/katello.po +70 -28
- data/locale/ru/katello.po +70 -28
- data/locale/ta/katello.po +69 -27
- data/locale/te/katello.po +69 -27
- data/locale/zh_CN/katello.po +73 -31
- data/locale/zh_TW/katello.po +70 -28
- data/webpack/components/Content/ContentPage.js +51 -35
- data/webpack/components/Content/__tests__/ContentPage.test.js +2 -4
- data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +22 -3
- data/webpack/components/Table/EmptyStateMessage.js +14 -11
- data/webpack/components/Table/MainTable.js +36 -15
- data/webpack/components/Table/TableWrapper.js +25 -25
- data/webpack/components/Table/__test__/emptyStateMessage.test.js +51 -0
- data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +5 -4
- data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +1 -1
- data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsModal.test.js +1 -17
- data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +18 -9
- data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -2
- data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +1 -2
- data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +1 -2
- data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +47 -27
- data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +1 -2
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -21
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +1 -28
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +1 -10
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +1 -18
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +1 -17
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -15
- data/webpack/global_test_setup.js +1 -1
- data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +12 -10
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +6 -0
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +1 -0
- data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +3 -10
- data/webpack/scenes/AlternateContentSources/Create/Steps/NameACS.js +1 -0
- data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +3 -3
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +1 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +12 -4
- data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +7 -4
- data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +4 -8
- data/webpack/scenes/AlternateContentSources/helpers.js +1 -1
- data/webpack/scenes/Content/Details/ContentRepositories.js +5 -4
- data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +1 -12
- data/webpack/scenes/Content/Table/ContentTable.js +2 -1
- data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -14
- data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -25
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +44 -31
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -0
- data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +6 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +2 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +2 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +3 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -1
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +2 -0
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +1 -1
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +1 -1
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +35 -33
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +48 -45
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +58 -24
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +64 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +36 -20
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +40 -23
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +0 -13
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +0 -13
- data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -1
- data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -10
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -10
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +21 -9
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +4 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +1 -32
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +3 -1
- data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -15
- data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +1 -1
- data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +1 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -9
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +4 -0
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +30 -14
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +55 -120
- data/webpack/scenes/ContentViews/components/WizardHeader.js +1 -1
- data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +1 -1
- data/webpack/scenes/ContentViews/expansions/__tests__/contentViewComponentsModal.test.js +8 -1
- data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +3 -9
- data/webpack/scenes/ModuleStreams/__tests__/__snapshots__/ModuleStreamPage.test.js.snap +7 -1
- data/webpack/scenes/RedHatRepositories/components/Search.js +22 -16
- data/webpack/scenes/RedHatRepositories/index.scss +20 -1
- data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +12 -1
- data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +1 -1
- data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +1 -1
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +21 -19
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +34 -1
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +20 -7
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +0 -1
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +65 -15
- metadata +49 -146
- data/app/lib/actions/katello/organization/simple_content_access/prepare_content_overrides.rb +0 -36
- data/app/lib/actions/katello/pulp_selector.rb +0 -24
- data/app/lib/actions/katello/repository/correct_checksum.rb +0 -24
- data/app/lib/actions/katello/repository/destroy_package_group.rb +0 -26
- data/app/lib/actions/katello/repository/upload_package_group.rb +0 -24
- data/app/lib/actions/pulp/abstract.rb +0 -37
- data/app/lib/actions/pulp/abstract_async_task.rb +0 -154
- data/app/lib/actions/pulp/abstract_async_task_group.rb +0 -94
- data/app/lib/actions/pulp/consumer/sync_capsule.rb +0 -45
- data/app/lib/actions/pulp/consumer/unassociate_units.rb +0 -20
- data/app/lib/actions/pulp/expect_one_task.rb +0 -11
- data/app/lib/actions/pulp/orchestration/orphan_cleanup/remove_orphans.rb +0 -16
- data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +0 -19
- data/app/lib/actions/pulp/orchestration/repository/delete.rb +0 -15
- data/app/lib/actions/pulp/orchestration/repository/refresh.rb +0 -14
- data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +0 -13
- data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -19
- data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +0 -14
- data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +0 -34
- data/app/lib/actions/pulp/orchestration/repository/sync.rb +0 -18
- data/app/lib/actions/pulp/orchestration/repository/upload_content.rb +0 -37
- data/app/lib/actions/pulp/orphan_cleanup/remove_orphans.rb +0 -15
- data/app/lib/actions/pulp/orphan_cleanup/remove_unneeded_repos.rb +0 -16
- data/app/lib/actions/pulp/repository/abstract_copy_content.rb +0 -45
- data/app/lib/actions/pulp/repository/abstract_remove_content.rb +0 -32
- data/app/lib/actions/pulp/repository/clear.rb +0 -18
- data/app/lib/actions/pulp/repository/copy_all_units.rb +0 -30
- data/app/lib/actions/pulp/repository/copy_units.rb +0 -25
- data/app/lib/actions/pulp/repository/create.rb +0 -28
- data/app/lib/actions/pulp/repository/create_in_plan.rb +0 -15
- data/app/lib/actions/pulp/repository/create_upload_request.rb +0 -20
- data/app/lib/actions/pulp/repository/delete_upload_request.rb +0 -19
- data/app/lib/actions/pulp/repository/destroy.rb +0 -28
- data/app/lib/actions/pulp/repository/distributor_publish.rb +0 -25
- data/app/lib/actions/pulp/repository/download.rb +0 -16
- data/app/lib/actions/pulp/repository/import_upload.rb +0 -19
- data/app/lib/actions/pulp/repository/presenters/abstract_sync_presenter.rb +0 -47
- data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +0 -95
- data/app/lib/actions/pulp/repository/presenters/docker_presenter.rb +0 -103
- data/app/lib/actions/pulp/repository/presenters/file_unit_presenter.rb +0 -42
- data/app/lib/actions/pulp/repository/presenters/yum_presenter.rb +0 -131
- data/app/lib/actions/pulp/repository/refresh.rb +0 -21
- data/app/lib/actions/pulp/repository/regenerate_applicability.rb +0 -21
- data/app/lib/actions/pulp/repository/remove_distribution.rb +0 -11
- data/app/lib/actions/pulp/repository/remove_units.rb +0 -44
- data/app/lib/actions/pulp/repository/sync.rb +0 -99
- data/app/lib/actions/pulp/repository/upload_file.rb +0 -28
- data/app/lib/actions/pulp/repository_group/create.rb +0 -31
- data/app/lib/actions/pulp/repository_group/delete.rb +0 -17
- data/app/lib/actions/pulp/repository_group/export.rb +0 -51
- data/app/lib/katello/util/content_overrides_migrator.rb +0 -98
- data/app/lib/katello/util/package_clause_generator.rb +0 -77
- data/app/models/katello/glue/pulp/pulp_errors.rb +0 -9
- data/app/models/katello/glue/pulp/repo.rb +0 -353
- data/app/models/katello/pulp_sync_status.rb +0 -165
- data/app/models/katello/pulp_task_status.rb +0 -63
- data/app/services/katello/pulp/content.rb +0 -24
- data/app/services/katello/pulp/importer_comparison.rb +0 -28
- data/app/services/katello/pulp/repository/deb.rb +0 -61
- data/app/services/katello/pulp/repository/docker.rb +0 -82
- data/app/services/katello/pulp/repository/file.rb +0 -52
- data/app/services/katello/pulp/repository/yum.rb +0 -205
- data/app/services/katello/pulp/repository.rb +0 -327
- data/app/services/katello/pulp/server.rb +0 -35
- data/app/services/katello/pulp/simple_package.rb +0 -24
- data/app/services/katello/pulp/smart_proxy_repository.rb +0 -52
- data/lib/monkeys/fix_deb_optimized_sync.rb +0 -35
- data/lib/monkeys/fix_pulp_container_path.rb +0 -35
- data/locale/bn/LC_MESSAGES/katello.mo +0 -0
- data/locale/cs/LC_MESSAGES/katello.mo +0 -0
- data/locale/de/LC_MESSAGES/katello.mo +0 -0
- data/locale/en/LC_MESSAGES/katello.mo +0 -0
- data/locale/es/LC_MESSAGES/katello.mo +0 -0
- data/locale/fr/LC_MESSAGES/katello.mo +0 -0
- data/locale/gu/LC_MESSAGES/katello.mo +0 -0
- data/locale/hi/LC_MESSAGES/katello.mo +0 -0
- data/locale/it/LC_MESSAGES/katello.mo +0 -0
- data/locale/ja/LC_MESSAGES/katello.mo +0 -0
- data/locale/ka/LC_MESSAGES/katello.mo +0 -0
- data/locale/kn/LC_MESSAGES/katello.mo +0 -0
- data/locale/ko/LC_MESSAGES/katello.mo +0 -0
- data/locale/mr/LC_MESSAGES/katello.mo +0 -0
- data/locale/or/LC_MESSAGES/katello.mo +0 -0
- data/locale/pa/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
- data/locale/ru/LC_MESSAGES/katello.mo +0 -0
- data/locale/ta/LC_MESSAGES/katello.mo +0 -0
- data/locale/te/LC_MESSAGES/katello.mo +0 -0
- data/locale/zanata.xml +0 -30
- data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentSearch.fixtures.json +0 -33
@@ -39,10 +39,13 @@ module Katello
|
|
39
39
|
|
40
40
|
has_many :activation_keys, :class_name => "Katello::ActivationKey", :dependent => :restrict_with_exception
|
41
41
|
|
42
|
-
has_many :
|
43
|
-
:
|
42
|
+
has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet",
|
43
|
+
:through => :content_view_environments
|
44
|
+
has_many :content_facets, :class_name => "Katello::Host::ContentFacet", :through => :content_view_environment_content_facets,
|
45
|
+
:inverse_of => :content_views
|
44
46
|
has_many :hosts, :class_name => "::Host::Managed", :through => :content_facets,
|
45
|
-
:inverse_of => :
|
47
|
+
:inverse_of => :content_views
|
48
|
+
|
46
49
|
has_many :hostgroup_content_facets, :class_name => "Katello::Hostgroup::ContentFacet",
|
47
50
|
:inverse_of => :content_view, :dependent => :nullify
|
48
51
|
has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets,
|
@@ -421,8 +424,10 @@ module Katello
|
|
421
424
|
# update errata applicability counts for all hosts in the CV & LE
|
422
425
|
Location.no_taxonomy_scope do
|
423
426
|
User.as_anonymous_admin do
|
424
|
-
::Katello::Host::ContentFacet.
|
425
|
-
|
427
|
+
::Katello::Host::ContentFacet.in_content_views_and_environments(
|
428
|
+
content_views: [self],
|
429
|
+
lifecycle_environments: [environment]
|
430
|
+
).each do |facet|
|
426
431
|
facet.update_applicability_counts
|
427
432
|
facet.update_errata_status
|
428
433
|
end
|
@@ -599,6 +604,7 @@ module Katello
|
|
599
604
|
fail _("Import-only content views can not be published directly") if import_only? && !syncable
|
600
605
|
check_composite_action_allowed!(organization.library)
|
601
606
|
check_docker_repository_names!([organization.library])
|
607
|
+
check_orphaned_content_facets!(environments: self.environments)
|
602
608
|
end
|
603
609
|
|
604
610
|
true
|
@@ -645,6 +651,17 @@ module Katello
|
|
645
651
|
true
|
646
652
|
end
|
647
653
|
|
654
|
+
def check_orphaned_content_facets!(environments: [])
|
655
|
+
::Katello::Host::ContentFacet.in_content_views_and_environments(
|
656
|
+
content_views: [self],
|
657
|
+
lifecycle_environments: environments
|
658
|
+
).each do |facet|
|
659
|
+
unless facet.host
|
660
|
+
fail _("Orphaned content facets for deleted hosts exist for the content view and environment. Please run rake task : katello:clean_orphaned_facets and try again!")
|
661
|
+
end
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
648
665
|
def check_remove_from_environment!(env)
|
649
666
|
errors = []
|
650
667
|
|
@@ -8,9 +8,13 @@ module Katello
|
|
8
8
|
|
9
9
|
belongs_to :content_view, :class_name => "Katello::ContentView", :inverse_of => :content_view_environments
|
10
10
|
belongs_to :environment, :class_name => "Katello::KTEnvironment", :inverse_of => :content_view_environments
|
11
|
+
belongs_to :lifecycle_environment, :class_name => "Katello::KTEnvironment", :foreign_key => :environment_id, :inverse_of => :content_view_environments
|
11
12
|
belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion",
|
12
13
|
:inverse_of => :content_view_environments
|
13
14
|
|
15
|
+
has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet", :dependent => :destroy, :inverse_of => :content_view_environment
|
16
|
+
has_many :content_facets, through: :content_view_environment_content_facets, :class_name => "::Katello::Host::ContentFacet", :inverse_of => :content_view_environments
|
17
|
+
|
14
18
|
validates_lengths_from_database
|
15
19
|
validates :environment_id, uniqueness: {scope: :content_view_id}, presence: true
|
16
20
|
validates :content_view_id, presence: true
|
@@ -19,10 +23,10 @@ module Katello
|
|
19
23
|
before_save :generate_info
|
20
24
|
|
21
25
|
scope :non_default, -> { joins(:content_view).where("katello_content_views.default" => false) }
|
26
|
+
alias :lifecycle_environment :environment
|
22
27
|
|
23
28
|
def self.for_content_facets(content_facets)
|
24
|
-
joins(
|
25
|
-
where("#{Host::ContentFacet.table_name}.content_view_id = #{ContentViewEnvironment.table_name}.content_view_id").where("#{Host::ContentFacet.table_name}.id" => content_facets).uniq
|
29
|
+
joins(:content_view_environment_content_facets, :content_facets).where("#{Katello::ContentViewEnvironmentContentFacet.table_name}.content_facet_id" => content_facets).uniq
|
26
30
|
end
|
27
31
|
|
28
32
|
# retrieve the owning environment for this content view environment.
|
@@ -38,6 +42,11 @@ module Katello
|
|
38
42
|
content_view.activation_keys.in_environment(environment)
|
39
43
|
end
|
40
44
|
|
45
|
+
# TODO: uncomment when we need to start showing multiple CVE names in UI
|
46
|
+
# def candlepin_name
|
47
|
+
# "#{environment.label}/#{content_view.label}"
|
48
|
+
# end
|
49
|
+
|
41
50
|
private
|
42
51
|
|
43
52
|
def generate_info
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Katello
|
2
|
+
class ContentViewEnvironmentContentFacet < Katello::Model
|
3
|
+
belongs_to :content_view_environment, :class_name => "::Katello::ContentViewEnvironment", :inverse_of => :content_view_environment_content_facets
|
4
|
+
belongs_to :content_facet, :class_name => "::Katello::Host::ContentFacet", :inverse_of => :content_view_environment_content_facets
|
5
|
+
|
6
|
+
validates :content_view_environment_id, presence: true
|
7
|
+
validates :content_facet_id, presence: true, unless: :new_record?
|
8
|
+
end
|
9
|
+
end
|
@@ -99,8 +99,7 @@ module Katello
|
|
99
99
|
def self.for_version(version)
|
100
100
|
major, minor = version.to_s.split('.')
|
101
101
|
minor ||= 0
|
102
|
-
|
103
|
-
query
|
102
|
+
where(:major => major, :minor => minor)
|
104
103
|
end
|
105
104
|
|
106
105
|
def to_s
|
@@ -165,6 +164,10 @@ module Katello
|
|
165
164
|
"#{major}.#{minor}"
|
166
165
|
end
|
167
166
|
|
167
|
+
def incrementally_updated?
|
168
|
+
minor != 0
|
169
|
+
end
|
170
|
+
|
168
171
|
def repos(env)
|
169
172
|
self.repositories.in_environment(env)
|
170
173
|
end
|
@@ -333,9 +336,10 @@ module Katello
|
|
333
336
|
def update_content_counts!
|
334
337
|
self.content_counts = {}
|
335
338
|
RepositoryTypeManager.indexable_content_types.each do |content_type|
|
336
|
-
|
339
|
+
case content_type&.model_class::CONTENT_TYPE
|
340
|
+
when DockerTag::CONTENT_TYPE
|
337
341
|
content_counts[DockerTag::CONTENT_TYPE] = docker_tags.count
|
338
|
-
|
342
|
+
when GenericContentUnit::CONTENT_TYPE
|
339
343
|
content_counts[content_type.content_type] = content_type&.model_class&.in_repositories(self.repositories.archived)&.where(:content_type => content_type.content_type)&.count
|
340
344
|
else
|
341
345
|
content_counts[content_type&.model_class::CONTENT_TYPE] = content_type&.model_class&.in_repositories(self.repositories.archived)&.count
|
@@ -376,9 +380,10 @@ module Katello
|
|
376
380
|
fail _("Default content view versions cannot be promoted") if default?
|
377
381
|
content_view.check_composite_action_allowed!(to_env)
|
378
382
|
content_view.check_docker_repository_names!(to_env)
|
383
|
+
content_view.check_orphaned_content_facets!(environments: [to_env])
|
379
384
|
end
|
380
385
|
|
381
|
-
def validate_destroyable!(skip_environment_check
|
386
|
+
def validate_destroyable!(skip_environment_check: false)
|
382
387
|
unless organization.being_deleted?
|
383
388
|
if !skip_environment_check && in_environment?
|
384
389
|
fail _("Cannot delete version while it is in environments: %s") %
|
@@ -24,7 +24,8 @@ module Katello
|
|
24
24
|
has_many :cves, :class_name => "Katello::ErratumCve", :dependent => :destroy, :inverse_of => :erratum
|
25
25
|
has_many :packages, :class_name => "Katello::ErratumPackage", :dependent => :destroy, :inverse_of => :erratum
|
26
26
|
|
27
|
-
scoped_search :on => :
|
27
|
+
scoped_search :on => :id, :rename => :db_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
|
28
|
+
scoped_search :on => :errata_id, :complete_value => true, :only_explicit => true
|
28
29
|
scoped_search :on => :errata_id, :rename => :id, :complete_value => true, :only_explicit => true
|
29
30
|
scoped_search :on => :title
|
30
31
|
scoped_search :on => :title, :rename => :synopsis, :complete_value => true, :only_explicit => true
|
@@ -152,6 +153,10 @@ module Katello
|
|
152
153
|
end
|
153
154
|
end
|
154
155
|
|
156
|
+
def module_stream_specs
|
157
|
+
packages.collect { |package| package.module_streams.map(&:module_spec) }.flatten.uniq
|
158
|
+
end
|
159
|
+
|
155
160
|
def module_stream_objects
|
156
161
|
streams = packages.map do |pack|
|
157
162
|
pack.module_streams
|
@@ -56,6 +56,12 @@ module Katello
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def import_candlepin_records(pools, org)
|
60
|
+
# Skip import of pools that were associated with an orphaned custom product
|
61
|
+
pools = pools.reject { |cp_pool| ::Katello::Glue::Provider.orphaned_custom_product?(cp_pool['productId'], org) }
|
62
|
+
super(pools, org)
|
63
|
+
end
|
64
|
+
|
59
65
|
def import_candlepin_record(record:, organization:)
|
60
66
|
subscription = determine_subscription(
|
61
67
|
product_id: record['productId'],
|
@@ -32,7 +32,7 @@ module Katello
|
|
32
32
|
id.match(/^\d+$/) #engineering products are numeric
|
33
33
|
end
|
34
34
|
|
35
|
-
def self.
|
35
|
+
def self.import_redhat_product_from_cp(attrs, organization)
|
36
36
|
import_logger = attrs[:import_logger]
|
37
37
|
|
38
38
|
product_attrs = {'name' => attrs['name'],
|
@@ -50,6 +50,12 @@ module Katello
|
|
50
50
|
raise e
|
51
51
|
end
|
52
52
|
|
53
|
+
def self.custom_product_id?(id)
|
54
|
+
# Engineering products with 12 digits are custom products (see Katello::Product#unused_product_id)
|
55
|
+
# however, previously generated ids are random and can be shorter than 12 digits
|
56
|
+
id =~ /^\d{8,12}$/
|
57
|
+
end
|
58
|
+
|
53
59
|
module InstanceMethods
|
54
60
|
def support_level
|
55
61
|
return _attr(:support_level)
|
@@ -21,6 +21,11 @@ module Katello
|
|
21
21
|
!Glue::Candlepin::Product.engineering_product_id?(product['id']) || Katello::Product.find_by(:cp_id => product['id']).try(:custom?)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def import_candlepin_records(cp_subs, org)
|
26
|
+
cp_subs = cp_subs.reject { |cp_subscription| ::Katello::Glue::Provider.orphaned_custom_product?(cp_subscription['productId'], org) }
|
27
|
+
super(cp_subs, org)
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
module InstanceMethods
|
@@ -6,6 +6,30 @@ module Katello
|
|
6
6
|
base.send :include, InstanceMethods
|
7
7
|
end
|
8
8
|
|
9
|
+
def self.orphaned_custom_product?(cp_id, organization)
|
10
|
+
return unless cp_id.present? && orphaned_product?(cp_id, organization)
|
11
|
+
product_provider = provider_for_cp_id(cp_id: cp_id, organization: organization)
|
12
|
+
if product_provider.redhat_provider?
|
13
|
+
false
|
14
|
+
else
|
15
|
+
Rails.logger.warn "Found orphaned object with id #{cp_id} in Candlepin. Skipping import into Katello; run rake katello:delete_orphaned_custom_products to remove it from Candlepin."
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.orphaned_product?(cp_id, organization)
|
21
|
+
!organization.products.where(:cp_id => cp_id).exists?
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.provider_for_cp_id(cp_id:, organization:)
|
25
|
+
return organization.redhat_provider unless ::Katello::Glue::Candlepin::Product.engineering_product_id?(cp_id)
|
26
|
+
if ::Katello::Glue::Candlepin::Product.custom_product_id?(cp_id)
|
27
|
+
organization.anonymous_provider
|
28
|
+
else
|
29
|
+
organization.redhat_provider
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
9
33
|
module InstanceMethods
|
10
34
|
API_URL = 'https://subscription.rhsm.redhat.com/subscription/consumers/'.freeze
|
11
35
|
|
@@ -21,31 +45,6 @@ module Katello
|
|
21
45
|
self.products.any? { |p| p.synced? }
|
22
46
|
end
|
23
47
|
|
24
|
-
# Get the most relavant status for all the repos in this Provider
|
25
|
-
def sync_status
|
26
|
-
statuses = self.products.reject { |r| r.empty? }.map { |r| r.sync_status }
|
27
|
-
return PulpSyncStatus.new(:state => PulpSyncStatus::Status::NOT_SYNCED) if statuses.empty?
|
28
|
-
|
29
|
-
[PulpSyncStatus::Status::RUNNING,
|
30
|
-
PulpSyncStatus::Status::NOT_SYNCED,
|
31
|
-
PulpSyncStatus::Status::CANCELED,
|
32
|
-
PulpSyncStatus::Status::ERROR].each do |interesting_status|
|
33
|
-
relevant_status = statuses.find { |s| s[:state].to_s == interesting_status.to_s }
|
34
|
-
return relevant_status if relevant_status
|
35
|
-
end
|
36
|
-
|
37
|
-
#else -> all finished
|
38
|
-
return statuses[0]
|
39
|
-
end
|
40
|
-
|
41
|
-
def sync_state
|
42
|
-
self.sync_status[:state]
|
43
|
-
end
|
44
|
-
|
45
|
-
def sync_size
|
46
|
-
self.products.inject(0) { |sum, v| sum + v.sync_status.progress.total_size }
|
47
|
-
end
|
48
|
-
|
49
48
|
def last_sync
|
50
49
|
sync_times = []
|
51
50
|
self.products.each do |prod|
|
@@ -126,6 +125,7 @@ module Katello
|
|
126
125
|
|
127
126
|
Katello::Logging.time("Imported #{cp_products.size} products") do
|
128
127
|
cp_products.each do |product_json|
|
128
|
+
next if ::Katello::Glue::Provider.orphaned_custom_product?(product_json['id'], organization)
|
129
129
|
product = import_product(product_json)
|
130
130
|
prod_content_importer.add_product_content(product, product_json['productContent']) if product.redhat?
|
131
131
|
end
|
@@ -144,7 +144,7 @@ module Katello
|
|
144
144
|
if product&.redhat?
|
145
145
|
product.update!(:name => product_json['name']) unless product.name == product_json['name']
|
146
146
|
elsif product.nil?
|
147
|
-
product = Glue::Candlepin::Product.
|
147
|
+
product = Glue::Candlepin::Product.import_redhat_product_from_cp(product_json, organization)
|
148
148
|
end
|
149
149
|
product
|
150
150
|
end
|
@@ -10,10 +10,15 @@ module Katello
|
|
10
10
|
SUBSCRIPTION_MANAGER_PACKAGE_NAME = 'subscription-manager'.freeze
|
11
11
|
|
12
12
|
belongs_to :kickstart_repository, :class_name => "::Katello::Repository", :inverse_of => :kickstart_content_facets
|
13
|
-
belongs_to :content_view, :inverse_of => :content_facets, :class_name => "Katello::ContentView"
|
14
|
-
belongs_to :lifecycle_environment, :inverse_of => :content_facets, :class_name => "Katello::KTEnvironment"
|
15
13
|
belongs_to :content_source, :class_name => "::SmartProxy", :inverse_of => :content_facets
|
16
14
|
|
15
|
+
has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet", :dependent => :destroy, :inverse_of => :content_facet
|
16
|
+
has_many :content_view_environments, :through => :content_view_environment_content_facets,
|
17
|
+
:class_name => "Katello::ContentViewEnvironment", :source => :content_view_environment,
|
18
|
+
:after_add => :mark_cves_changed, :after_remove => :mark_cves_changed
|
19
|
+
has_many :content_views, :through => :content_view_environments, :class_name => "Katello::ContentView"
|
20
|
+
has_many :lifecycle_environments, :through => :content_view_environments, :class_name => "Katello::KTEnvironment"
|
21
|
+
|
17
22
|
has_many :content_facet_errata, :class_name => "Katello::ContentFacetErratum", :dependent => :delete_all, :inverse_of => :content_facet
|
18
23
|
has_many :applicable_errata, :through => :content_facet_errata, :class_name => "Katello::Erratum", :source => :erratum
|
19
24
|
|
@@ -31,11 +36,85 @@ module Katello
|
|
31
36
|
has_many :content_facet_applicable_module_streams, :class_name => "Katello::ContentFacetApplicableModuleStream", :dependent => :delete_all, :inverse_of => :content_facet
|
32
37
|
has_many :applicable_module_streams, :through => :content_facet_applicable_module_streams, :class_name => "Katello::ModuleStream", :source => :module_stream
|
33
38
|
|
34
|
-
validates :content_view, :presence => true, :allow_blank => false
|
35
|
-
validates :lifecycle_environment, :presence => true, :allow_blank => false
|
36
39
|
validates_with ::AssociationExistsValidator, attributes: [:content_source]
|
40
|
+
validates_with Katello::Validators::GeneratedContentViewValidator
|
37
41
|
validates :host, :presence => true, :allow_blank => false
|
38
|
-
|
42
|
+
|
43
|
+
attr_accessor :cves_changed
|
44
|
+
|
45
|
+
def initialize(*args)
|
46
|
+
init_args = args.first || {}
|
47
|
+
env_id = init_args.delete(:lifecycle_environment_id)
|
48
|
+
cv_id = init_args.delete(:content_view_id)
|
49
|
+
super(*args)
|
50
|
+
if env_id && cv_id
|
51
|
+
assign_single_environment(
|
52
|
+
lifecycle_environment_id: env_id,
|
53
|
+
content_view_id: cv_id
|
54
|
+
)
|
55
|
+
end
|
56
|
+
self.cves_changed = false
|
57
|
+
end
|
58
|
+
|
59
|
+
def mark_cves_changed(_cve)
|
60
|
+
self.cves_changed = true
|
61
|
+
end
|
62
|
+
|
63
|
+
def cves_changed?
|
64
|
+
cves_changed
|
65
|
+
end
|
66
|
+
|
67
|
+
def multi_content_view_environment?
|
68
|
+
content_view_environments.size > 1
|
69
|
+
end
|
70
|
+
|
71
|
+
def single_content_view_environment?
|
72
|
+
content_view_environments.size == 1
|
73
|
+
end
|
74
|
+
|
75
|
+
def single_content_view
|
76
|
+
if multi_content_view_environment?
|
77
|
+
Rails.logger.warn _("Content facet for host %s has more than one content view. Use #content_views instead.") % host.name
|
78
|
+
end
|
79
|
+
content_view_environments&.first&.content_view
|
80
|
+
end
|
81
|
+
|
82
|
+
def single_lifecycle_environment
|
83
|
+
if multi_content_view_environment?
|
84
|
+
Rails.logger.warn _("Content facet for host %s has more than one lifecycle environment. Use #lifecycle_environments instead.") % host.name
|
85
|
+
end
|
86
|
+
content_view_environments&.first&.lifecycle_environment
|
87
|
+
end
|
88
|
+
|
89
|
+
def assign_single_environment(
|
90
|
+
content_view_id: nil, lifecycle_environment_id: nil, environment_id: nil,
|
91
|
+
content_view: nil, lifecycle_environment: nil, environment: nil
|
92
|
+
)
|
93
|
+
lifecycle_environment_id ||= environment_id || lifecycle_environment&.id || environment&.id
|
94
|
+
content_view_id ||= content_view&.id
|
95
|
+
|
96
|
+
unless lifecycle_environment_id
|
97
|
+
fail _("Lifecycle environment must be specified")
|
98
|
+
end
|
99
|
+
|
100
|
+
unless content_view_id
|
101
|
+
fail _("Content view must be specified")
|
102
|
+
end
|
103
|
+
|
104
|
+
content_view_environment = ::Katello::ContentViewEnvironment
|
105
|
+
.where(:content_view_id => content_view_id, :environment_id => lifecycle_environment_id)
|
106
|
+
.first_or_create do |cve|
|
107
|
+
Rails.logger.info("ContentViewEnvironment not found for content view '#{cve.content_view_name}' and environment '#{cve.environment&.name}'; creating a new one.")
|
108
|
+
end
|
109
|
+
fail _("Unable to create ContentViewEnvironment. Check the logs for more information.") if content_view_environment.nil?
|
110
|
+
self.content_view_environments = [content_view_environment]
|
111
|
+
end
|
112
|
+
|
113
|
+
def default_environment?
|
114
|
+
content_view_environments.any? do |cve|
|
115
|
+
cve.content_view.default? && cve.lifecycle_environment.library?
|
116
|
+
end
|
117
|
+
end
|
39
118
|
|
40
119
|
def update_repositories_by_paths(paths)
|
41
120
|
prefixes = %w(/pulp/deb/ /pulp/repos/ /pulp/content/)
|
@@ -138,13 +217,21 @@ module Katello
|
|
138
217
|
end
|
139
218
|
|
140
219
|
def self.in_content_view_version_environments(version_environments)
|
141
|
-
#takes a structure of [{:content_view_version => ContentViewVersion, :environments => [KTEnvironment]}]
|
220
|
+
# takes a structure of [{:content_view_version => ContentViewVersion, :environments => [KTEnvironment]}]
|
221
|
+
relation = self.joins(:content_view_environment_content_facets => :content_view_environment)
|
142
222
|
queries = version_environments.map do |version_environment|
|
143
223
|
version = version_environment[:content_view_version]
|
144
224
|
env_ids = version_environment[:environments].map(&:id)
|
145
|
-
"(#{table_name}.
|
225
|
+
"(#{::Katello::ContentViewEnvironment.table_name}.content_view_version_id = #{version.id} AND #{::Katello::ContentViewEnvironment.table_name}.environment_id IN (#{env_ids.join(',')}))"
|
146
226
|
end
|
147
|
-
where(queries.join(" OR "))
|
227
|
+
relation.where(queries.join(" OR "))
|
228
|
+
end
|
229
|
+
|
230
|
+
def self.in_content_views_and_environments(content_views: nil, lifecycle_environments: nil)
|
231
|
+
relation = self.joins(:content_view_environment_content_facets => :content_view_environment)
|
232
|
+
relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.content_view_id" => content_views) if content_views
|
233
|
+
relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.environment_id" => lifecycle_environments) if lifecycle_environments
|
234
|
+
relation
|
148
235
|
end
|
149
236
|
|
150
237
|
def self.with_non_installable_errata(errata, hosts = nil)
|
@@ -202,12 +289,10 @@ module Katello
|
|
202
289
|
where("#{facet_repository}.content_facet_id = #{self.table_name}.id")
|
203
290
|
end
|
204
291
|
|
205
|
-
def content_view_version
|
206
|
-
content_view.version(lifecycle_environment)
|
207
|
-
end
|
208
|
-
|
209
292
|
def available_releases
|
210
|
-
self.
|
293
|
+
self.content_view_environments.flat_map do |cve|
|
294
|
+
cve.content_view.version(cve.lifecycle_environment).available_releases
|
295
|
+
end
|
211
296
|
end
|
212
297
|
|
213
298
|
def katello_agent_installed?
|
@@ -231,6 +316,11 @@ module Katello
|
|
231
316
|
host.refresh_global_status!
|
232
317
|
end
|
233
318
|
|
319
|
+
# TODO: uncomment when we need to display multiple CVE names in the UI
|
320
|
+
# def content_view_environment_names
|
321
|
+
# content_view_environments.map(&:candlepin_name).join(', ')
|
322
|
+
# end
|
323
|
+
|
234
324
|
def self.joins_installable_relation(content_model, facet_join_model)
|
235
325
|
facet_repository = Katello::ContentFacetRepository.table_name
|
236
326
|
content_table = content_model.table_name
|
@@ -267,16 +357,14 @@ module Katello
|
|
267
357
|
property :upgradable_rpm_count, Integer, desc: 'Returns upgradable RPM count'
|
268
358
|
property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source'
|
269
359
|
prop_group :katello_idname_props, Katello::Model, meta: { resource: 'content_source' }
|
270
|
-
prop_group :katello_idname_props, Katello::Model, meta: { resource: 'content_view' }
|
271
360
|
property :errata_counts, Hash, desc: 'Returns key=value object with errata counts, e.g. {security: 0, bugfix: 0, enhancement: 0, total: 0}'
|
272
361
|
property :kickstart_repository, 'Repository', desc: 'Returns Kickstart repository object'
|
273
362
|
prop_group :katello_idname_props, Katello::Model, meta: { resource: 'kickstart_repository' }
|
274
|
-
prop_group :katello_idname_props, Katello::Model, meta: { resource: 'lifecycle_environment' }
|
275
363
|
end
|
276
364
|
class Jail < ::Safemode::Jail
|
277
|
-
allow :applicable_deb_count, :applicable_module_stream_count, :applicable_rpm_count, :content_source, :content_source_id, :content_source_name,
|
278
|
-
:
|
279
|
-
:
|
365
|
+
allow :applicable_deb_count, :applicable_module_stream_count, :applicable_rpm_count, :content_source, :content_source_id, :content_source_name,
|
366
|
+
:errata_counts, :id, :kickstart_repository, :kickstart_repository_id, :kickstart_repository_name,
|
367
|
+
:upgradable_deb_count, :upgradable_module_stream_count, :upgradable_rpm_count, :uuid
|
280
368
|
end
|
281
369
|
end
|
282
370
|
end
|
@@ -6,15 +6,21 @@ module Katello
|
|
6
6
|
def host_info
|
7
7
|
info = {}
|
8
8
|
info['parameters'] = {
|
9
|
-
'foreman_host_collections' => host.host_collections.map(&:name)
|
10
|
-
'lifecycle_environment' => host.lifecycle_environment.try(:label),
|
11
|
-
|
12
|
-
'content_view' => host.content_view.try(:label),
|
13
|
-
'content_view_info' => content_view_info
|
9
|
+
'foreman_host_collections' => host.host_collections.map(&:name)
|
14
10
|
}
|
15
11
|
|
16
12
|
if host.content_facet.present?
|
17
13
|
info['parameters']['kickstart_repository'] = host.content_facet.kickstart_repository.try(:label)
|
14
|
+
if host.single_content_view_environment?
|
15
|
+
info['parameters']['lifecycle_environment'] = host.single_lifecycle_environment.try(:label)
|
16
|
+
info['parameters']['content_view'] = host.single_content_view.try(:label)
|
17
|
+
info['parameters']['content_view_info'] = content_view_info(host.content_view_environments.first)
|
18
|
+
end
|
19
|
+
info['parameters']['content_views'] = host.content_view_environments.map do |cve|
|
20
|
+
content_view_info(cve).merge(
|
21
|
+
'lifecycle_environment' => cve.lifecycle_environment.try(:label)
|
22
|
+
)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
if (rhsm_url = host.content_source&.rhsm_url)
|
@@ -28,25 +34,23 @@ module Katello
|
|
28
34
|
info
|
29
35
|
end
|
30
36
|
|
31
|
-
def content_view_info
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
'label' =>
|
36
|
-
'latest-version' =>
|
37
|
-
'version' => content_version.try(:version),
|
38
|
-
'published' => content_version.try(:created_at).try(:time).to_s,
|
39
|
-
'components' => content_view_components
|
37
|
+
def content_view_info(content_view_environment)
|
38
|
+
content_view = content_view_environment.content_view
|
39
|
+
return {} if content_view.blank?
|
40
|
+
{
|
41
|
+
'label' => content_view.try(:label),
|
42
|
+
'latest-version' => content_view.try(:latest_version),
|
43
|
+
'version' => content_version(content_view_environment).try(:version),
|
44
|
+
'published' => content_version(content_view_environment).try(:created_at).try(:time).to_s,
|
45
|
+
'components' => content_view_components(content_view_environment)
|
40
46
|
}
|
41
|
-
|
42
|
-
content_view_info
|
43
47
|
end
|
44
48
|
|
45
|
-
def content_view_components
|
46
|
-
return {} unless
|
49
|
+
def content_view_components(content_view_environment)
|
50
|
+
return {} unless content_view_environment.content_view.try(:composite)
|
47
51
|
|
48
52
|
components = {}
|
49
|
-
content_version.try(:content_view_version_components).map do |cv|
|
53
|
+
content_version(content_view_environment).try(:content_view_version_components).map do |cv|
|
50
54
|
cv_label = cv.component_version.content_view.label
|
51
55
|
components[cv_label] = {}
|
52
56
|
components[cv_label]['version'] = cv.component_version.try(:version)
|
@@ -55,8 +59,8 @@ module Katello
|
|
55
59
|
components
|
56
60
|
end
|
57
61
|
|
58
|
-
def content_version
|
59
|
-
|
62
|
+
def content_version(content_view_environment)
|
63
|
+
content_view_environment.content_view.try(:version, content_view_environment.lifecycle_environment)
|
60
64
|
end
|
61
65
|
end
|
62
66
|
end
|
@@ -114,9 +114,10 @@ module Katello
|
|
114
114
|
if self.hypervisor
|
115
115
|
if !consumer_params.try(:[], 'guestIds').empty?
|
116
116
|
guest_ids = consumer_params['guestIds'].map do |id|
|
117
|
-
|
117
|
+
case id
|
118
|
+
when Hash
|
118
119
|
id['guestId'].downcase
|
119
|
-
|
120
|
+
when String
|
120
121
|
id.downcase
|
121
122
|
end
|
122
123
|
end
|
@@ -144,7 +145,7 @@ module Katello
|
|
144
145
|
:addOns => purpose_addons.pluck(:name),
|
145
146
|
:serviceLevel => service_level,
|
146
147
|
:releaseVer => release_version,
|
147
|
-
:
|
148
|
+
:environments => self.candlepin_environments,
|
148
149
|
:installedProducts => self.installed_products.map(&:consumer_attributes),
|
149
150
|
:guestIds => virtual_guest_uuids
|
150
151
|
}
|
@@ -152,20 +153,18 @@ module Katello
|
|
152
153
|
HashWithIndifferentAccess.new(attrs)
|
153
154
|
end
|
154
155
|
|
155
|
-
def
|
156
|
+
def candlepin_environments
|
156
157
|
if self.host.content_facet
|
157
|
-
self.host.content_facet.
|
158
|
+
self.host.content_facet.content_view_environments.map do |cve|
|
159
|
+
{ :id => cve.content_view.cp_environment_id(cve.lifecycle_environment) }
|
160
|
+
end
|
158
161
|
else
|
159
162
|
self.host.organization.default_content_view.cp_environment_id(self.host.organization.library)
|
160
163
|
end
|
161
164
|
end
|
162
165
|
|
163
|
-
def
|
164
|
-
self.host.content_facet.try(:
|
165
|
-
end
|
166
|
-
|
167
|
-
def lifecycle_environment
|
168
|
-
self.host.content_facet.try(:lifecycle_environment) || self.organization.library
|
166
|
+
def content_view_environments
|
167
|
+
self.host.content_facet.try(:content_view_environments)
|
169
168
|
end
|
170
169
|
|
171
170
|
def organization
|
@@ -294,10 +293,15 @@ module Katello
|
|
294
293
|
|
295
294
|
def backend_update_needed?
|
296
295
|
%w(release_version service_level autoheal purpose_role purpose_usage purpose_addon_ids).each do |method|
|
297
|
-
|
296
|
+
if self.send("#{method}_changed?")
|
297
|
+
Rails.logger.debug("backend_update_needed: subscription facet #{method} changed")
|
298
|
+
return true
|
299
|
+
end
|
298
300
|
end
|
299
|
-
|
300
|
-
|
301
|
+
facet = self.host&.content_facet
|
302
|
+
if facet&.cves_changed? && !facet.new_record?
|
303
|
+
Rails.logger.debug("backend_update_needed: content facet CVEs changed")
|
304
|
+
return true
|
301
305
|
end
|
302
306
|
false
|
303
307
|
end
|