katello 4.13.0 → 4.14.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/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +12 -8
- data/app/assets/javascripts/katello/locale/bn/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/bn_IN/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ca/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/cs/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/cs_CZ/katello.js +275 -23
- data/app/assets/javascripts/katello/locale/de/katello.js +280 -28
- data/app/assets/javascripts/katello/locale/de_AT/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/de_DE/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/el/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/en/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/en_GB/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/en_US/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/es/katello.js +276 -24
- data/app/assets/javascripts/katello/locale/et_EE/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/fr/katello.js +283 -31
- data/app/assets/javascripts/katello/locale/gl/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/gu/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/he_IL/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/hi/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/id/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/it/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ja/katello.js +283 -31
- data/app/assets/javascripts/katello/locale/ka/katello.js +280 -28
- data/app/assets/javascripts/katello/locale/kn/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ko/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ml_IN/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/mr/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/nl_NL/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/or/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/pa/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/pl/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/pl_PL/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/pt/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/pt_BR/katello.js +276 -24
- data/app/assets/javascripts/katello/locale/ro/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ro_RO/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ru/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/sl/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/sv_SE/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ta/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/ta_IN/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/te/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/tr/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/vi/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/vi_VN/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/zh/katello.js +274 -22
- data/app/assets/javascripts/katello/locale/zh_CN/katello.js +283 -31
- data/app/assets/javascripts/katello/locale/zh_TW/katello.js +274 -22
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +118 -74
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -2
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +1 -1
- data/app/controllers/katello/api/v2/api_controller.rb +7 -0
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +4 -4
- data/app/controllers/katello/api/v2/debs_controller.rb +3 -2
- data/app/controllers/katello/api/v2/environments_controller.rb +2 -4
- data/app/controllers/katello/api/v2/host_contents_controller.rb +8 -3
- data/app/controllers/katello/api/v2/host_errata_controller.rb +4 -4
- data/app/controllers/katello/api/v2/host_packages_controller.rb +2 -2
- data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
- data/app/controllers/katello/api/v2/packages_controller.rb +13 -3
- data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +6 -2
- data/app/controllers/katello/api/v2/repositories_controller.rb +3 -4
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +13 -14
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +15 -9
- data/app/controllers/katello/api/v2/sync_controller.rb +2 -2
- data/app/controllers/katello/application_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/authorization.rb +3 -2
- data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +28 -0
- data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +4 -3
- data/app/controllers/katello/concerns/hosts_controller_extensions.rb +2 -4
- data/app/controllers/katello/remote_execution_controller.rb +53 -58
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +19 -2
- data/app/helpers/katello/katello_urls_helper.rb +1 -1
- data/app/lib/actions/katello/alternate_content_source/alternate_content_source_common.rb +1 -1
- data/app/lib/actions/katello/alternate_content_source/update.rb +2 -1
- data/app/lib/actions/katello/capsule_content/verify_checksum.rb +1 -2
- data/app/lib/actions/katello/content_view/publish.rb +1 -0
- data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +3 -2
- data/app/lib/actions/katello/environment/{publish_repositories.rb → publish_container_repositories.rb} +10 -8
- data/app/lib/actions/katello/foreman/content_update.rb +4 -6
- data/app/lib/actions/katello/host/hypervisors_update.rb +6 -4
- data/app/lib/actions/katello/repository/create.rb +4 -4
- data/app/lib/actions/katello/repository/discover.rb +11 -4
- data/app/lib/actions/katello/repository/import_upload.rb +4 -6
- data/app/lib/actions/katello/repository/metadata_generate.rb +1 -0
- data/app/lib/actions/katello/repository/update.rb +3 -3
- data/app/lib/actions/katello/repository_set/enable_repository.rb +5 -6
- data/app/lib/actions/middleware/backend_services_check.rb +3 -2
- data/app/lib/actions/pulp3/abstract_async_task.rb +2 -4
- data/app/lib/actions/pulp3/capsule_content/verify_checksum.rb +1 -2
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +5 -1
- data/app/lib/actions/pulp3/orchestration/repository/delete.rb +5 -2
- data/app/lib/actions/pulp3/repository/create_publication.rb +4 -0
- data/app/lib/actions/pulp3/repository/save_version.rb +3 -5
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +5 -9
- data/app/lib/katello/errors.rb +1 -0
- data/app/lib/katello/http_resource.rb +1 -0
- data/app/lib/katello/lazy_accessor.rb +1 -1
- data/app/lib/katello/repo_discovery.rb +4 -190
- data/app/lib/katello/resources/candlepin/candlepin_ping.rb +0 -5
- data/app/lib/katello/resources/candlepin/owner.rb +1 -1
- data/app/lib/katello/resources/candlepin/pool.rb +1 -2
- data/app/lib/katello/resources/candlepin/upstream_job.rb +1 -1
- data/app/lib/katello/resources/cdn.rb +3 -2
- data/app/lib/katello/resources/discovery/container.rb +127 -0
- data/app/lib/katello/resources/discovery/yum.rb +95 -0
- data/app/lib/katello/util/cdn_var_substitutor.rb +5 -3
- data/app/lib/katello/util/data.rb +3 -2
- data/app/lib/katello/util/errata.rb +4 -3
- data/app/lib/katello/util/package.rb +3 -3
- data/app/lib/katello/util/path_with_substitutions.rb +1 -1
- data/app/lib/katello/util/report_table.rb +3 -2
- data/app/lib/katello/util/url_matcher.rb +1 -1
- data/app/lib/katello/validators/alternate_content_source_path_validator.rb +4 -3
- data/app/lib/katello/validators/alternate_content_source_products_validator.rb +5 -7
- data/app/lib/katello/validators/container_image_name_validator.rb +1 -1
- data/app/lib/katello/validators/katello_name_format_validator.rb +2 -2
- data/app/lib/katello/validators/no_trailing_space_validator.rb +2 -2
- data/app/lib/katello/validators/prior_validator.rb +2 -2
- data/app/lib/katello/validators/product_unique_attribute_validator.rb +2 -4
- data/app/models/katello/activation_key.rb +4 -6
- data/app/models/katello/alternate_content_source.rb +1 -1
- data/app/models/katello/authorization/host_tracer.rb +1 -2
- data/app/models/katello/candlepin/repository_mapper.rb +2 -2
- data/app/models/katello/concerns/host_managed_extensions.rb +41 -10
- data/app/models/katello/concerns/hostgroup_extensions.rb +2 -4
- data/app/models/katello/concerns/location_extensions.rb +2 -4
- data/app/models/katello/concerns/operatingsystem_extensions.rb +84 -16
- data/app/models/katello/concerns/smart_proxy_extensions.rb +4 -4
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +2 -0
- data/app/models/katello/content_view.rb +5 -1
- data/app/models/katello/content_view_environment.rb +19 -4
- data/app/models/katello/content_view_environment_content_facet.rb +11 -0
- data/app/models/katello/erratum.rb +1 -1
- data/app/models/katello/event.rb +1 -1
- data/app/models/katello/glue/provider.rb +1 -2
- data/app/models/katello/hash_util.rb +1 -1
- data/app/models/katello/host/content_facet.rb +16 -3
- data/app/models/katello/host/subscription_facet.rb +27 -4
- data/app/models/katello/host_collection.rb +12 -8
- data/app/models/katello/pool.rb +5 -1
- data/app/models/katello/product.rb +7 -4
- data/app/models/katello/provider.rb +1 -2
- data/app/models/katello/repository.rb +18 -4
- data/app/models/katello/root_repository.rb +29 -0
- data/app/models/katello/rpm.rb +2 -2
- data/app/models/katello/subscription_facet_pool.rb +1 -1
- data/app/models/katello/sync_plan.rb +5 -4
- data/app/models/katello/task_status.rb +18 -18
- data/app/presenters/katello/product_host_count_presenter.rb +10 -0
- data/app/services/katello/candlepin/consumer.rb +11 -11
- data/app/services/katello/candlepin/message_handler.rb +3 -2
- data/app/services/katello/content_unit_indexer.rb +6 -0
- data/app/services/katello/pulp3/alternate_content_source.rb +1 -3
- data/app/services/katello/pulp3/api/core.rb +1 -1
- data/app/services/katello/pulp3/api/docker.rb +10 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +1 -0
- data/app/services/katello/pulp3/content_view_version/import.rb +6 -4
- data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -3
- data/app/services/katello/pulp3/repository/apt.rb +4 -16
- data/app/services/katello/pulp3/repository/yum.rb +9 -5
- data/app/services/katello/pulp3/repository.rb +2 -2
- data/app/services/katello/pulp3/repository_mirror.rb +2 -9
- data/app/services/katello/pulp3/task.rb +4 -2
- data/app/services/katello/registration_manager.rb +13 -3
- data/app/services/katello/repository_type.rb +1 -1
- data/app/services/katello/smart_proxy_helper.rb +1 -0
- data/app/views/dashboard/_host_collection_widget.html.erb +5 -4
- data/app/views/foreman/job_templates/install_errata.erb +2 -0
- data/app/views/foreman/job_templates/install_errata_-_katello_ansible_default.erb +2 -0
- data/app/views/foreman/job_templates/install_errata_by_search_query.erb +2 -0
- data/app/views/foreman/job_templates/install_errata_by_search_query_-_katello_ansible_default.erb +3 -1
- data/app/views/foreman/job_templates/install_packages_by_search_query_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/remove_packages_by_search_query_-_katello_ansible_default.erb +2 -2
- data/app/views/foreman/job_templates/resolve_traces.erb +5 -1
- data/app/views/foreman/job_templates/update_packages_by_search_query_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/upload_profile.erb +2 -0
- data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +7 -5
- data/app/views/katello/api/v2/content_facet/base.json.rabl +18 -2
- data/app/views/katello/api/v2/packages/thindex.json.rabl +6 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +8 -8
- data/app/views/katello/api/v2/repository_sets/show.json.rabl +1 -1
- data/app/views/katello/api/v2/subscription_facet/base.json.rabl +1 -1
- data/app/views/katello/api/v2/subscriptions/index.json.rabl +1 -0
- data/app/views/katello/api/v2/subscriptions/show.json.rabl +1 -0
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +14 -11
- data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +4 -4
- data/config/initializers/monkeys.rb +0 -1
- data/config/routes/api/v2.rb +3 -1
- data/config/routes.rb +1 -3
- data/db/migrate/20160114200145_add_mirror_on_sync_to_repositories.rb +1 -0
- data/db/migrate/20160131182301_add_download_policy_to_katello_repositories.rb +1 -0
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +3 -0
- data/db/migrate/20240522165308_add_priority_to_content_view_environment_content_facet.rb +5 -0
- data/db/migrate/20240621121212_katello_repository_debs_id_bigint.rb +6 -0
- data/db/migrate/20240729192228_add_convert2rhel_to_host_facets.rb +9 -0
- data/db/seeds.d/102-organizations.rb +5 -7
- data/db/seeds.d/150-module_job_templates.rb +7 -9
- data/db/seeds.d/75-job_templates.rb +9 -16
- data/engines/bastion_katello/README.md +3 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-info.html +6 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-content-hosts.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +4 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/package-info.html +6 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +31 -27
- data/engines/bastion_katello/lib/bastion_katello/engine.rb +2 -2
- data/lib/katello/engine.rb +1 -8
- data/lib/katello/permission_creator.rb +3 -2
- data/lib/katello/plugin.rb +31 -27
- data/lib/katello/repository_types/docker.rb +1 -0
- data/lib/katello/repository_types/yum.rb +1 -0
- data/lib/katello/tasks/clean_old_file_repos.rake +2 -4
- data/lib/katello/tasks/reset.rake +3 -4
- data/lib/katello/version.rb +1 -1
- data/lib/katello.rb +0 -4
- data/lib/monkeys/ar_postgres_evr_t.rb +2 -0
- data/locale/action_names.rb +1 -1
- data/locale/bn/LC_MESSAGES/katello.mo +0 -0
- data/locale/bn/katello.po +274 -22
- data/locale/bn_IN/katello.po +274 -22
- data/locale/ca/katello.po +274 -22
- data/locale/cs/katello.po +274 -22
- data/locale/cs_CZ/LC_MESSAGES/katello.mo +0 -0
- data/locale/cs_CZ/katello.po +275 -23
- data/locale/de/LC_MESSAGES/katello.mo +0 -0
- data/locale/de/katello.po +280 -28
- data/locale/de_AT/katello.po +274 -22
- data/locale/de_DE/katello.po +274 -22
- data/locale/el/katello.po +274 -22
- data/locale/en/katello.po +274 -22
- data/locale/en_GB/katello.po +274 -22
- data/locale/en_US/katello.po +274 -22
- data/locale/es/LC_MESSAGES/katello.mo +0 -0
- data/locale/es/katello.po +276 -24
- data/locale/et_EE/katello.po +274 -22
- data/locale/fr/LC_MESSAGES/katello.mo +0 -0
- data/locale/fr/katello.po +283 -31
- data/locale/gl/katello.po +274 -22
- data/locale/gu/katello.po +274 -22
- data/locale/he_IL/katello.po +274 -22
- data/locale/hi/katello.po +274 -22
- data/locale/id/katello.po +274 -22
- data/locale/it/LC_MESSAGES/katello.mo +0 -0
- data/locale/it/katello.po +274 -22
- data/locale/ja/LC_MESSAGES/katello.mo +0 -0
- data/locale/ja/katello.po +283 -31
- data/locale/ka/LC_MESSAGES/katello.mo +0 -0
- data/locale/ka/katello.po +280 -28
- data/locale/katello.pot +1001 -527
- data/locale/kn/katello.po +274 -22
- data/locale/ko/LC_MESSAGES/katello.mo +0 -0
- data/locale/ko/katello.po +274 -22
- data/locale/ml_IN/katello.po +274 -22
- data/locale/mr/katello.po +274 -22
- data/locale/nl_NL/katello.po +274 -22
- data/locale/or/katello.po +274 -22
- data/locale/pa/katello.po +274 -22
- data/locale/pl/katello.po +274 -22
- data/locale/pl_PL/katello.po +274 -22
- data/locale/pt/katello.po +274 -22
- data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt_BR/katello.po +276 -24
- data/locale/ro/katello.po +274 -22
- data/locale/ro_RO/katello.po +274 -22
- data/locale/ru/LC_MESSAGES/katello.mo +0 -0
- data/locale/ru/katello.po +274 -22
- data/locale/sl/katello.po +274 -22
- data/locale/sv_SE/katello.po +274 -22
- data/locale/ta/LC_MESSAGES/katello.mo +0 -0
- data/locale/ta/katello.po +274 -22
- data/locale/ta_IN/katello.po +274 -22
- data/locale/te/katello.po +274 -22
- data/locale/tr/katello.po +274 -22
- data/locale/vi/katello.po +274 -22
- data/locale/vi_VN/katello.po +274 -22
- data/locale/zh/katello.po +274 -22
- data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_CN/katello.po +283 -31
- data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_TW/katello.po +274 -22
- data/webpack/ForemanColumnExtensions/index.js +44 -1
- data/webpack/components/Table/TableWrapper.js +6 -0
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +24 -3
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ContentViewDetailsCard.js +124 -56
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/HostContentViewActions.js +2 -3
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/__tests__/contentViewDetailsCard.test.js +44 -10
- data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +75 -31
- data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
- data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionHooks.js +1 -1
- data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +22 -7
- data/webpack/components/extensions/Hosts/ActionsBar/ActionsBar.scss +14 -0
- data/webpack/components/extensions/Hosts/ActionsBar/index.js +82 -23
- data/webpack/components/extensions/Hosts/BulkActions/BulkChangeHostCVModal/index.js +5 -2
- data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/02_BulkErrataTable.js +171 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/04_Review.js +160 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/04_ReviewFooter.js +99 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/BulkErrataWizard.js +157 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/index.js +24 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/02_BulkPackagesTable.js +157 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/04_Review.js +168 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/04_ReviewFooter.js +141 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/BulkPackagesWizard.js +252 -0
- data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/index.js +24 -0
- data/webpack/components/extensions/Hosts/BulkActions/HostReview.js +176 -0
- data/webpack/components/extensions/Hosts/TableRowActions/index.js +17 -0
- data/webpack/global_index.js +11 -3
- data/webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js +5 -6
- data/webpack/redux/reducers/RedHatRepositories/__tests__/repositorySetRepositories.test.js +1 -1
- data/webpack/redux/reducers/RedHatRepositories/repositorySetRepositories.js +1 -1
- data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +2 -1
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +2 -1
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +2 -1
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -2
- data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +2 -1
- data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +3 -2
- data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +2 -1
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +2 -1
- data/webpack/scenes/ContentViews/components/CVBreadCrumb.js +2 -1
- data/webpack/scenes/ContentViews/components/ContentViewSelect/ContentViewSelectOption.js +2 -2
- data/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +1 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap +10 -0
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +6 -0
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -0
- data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +14 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +1 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +10 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.fixtures.js +1 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +10 -0
- data/webpack/scenes/Tasks/helpers.js +1 -1
- metadata +49 -29
- data/app/assets/javascripts/katello/containers/container.js +0 -304
- data/db/migrate/20240531193030_remove_sha1_repository_checksum_type.rb +0 -10
- data/lib/monkeys/anemone.rb +0 -33
- data/webpack/utils/useKatelloDocUrl.js +0 -18
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spidr'
|
2
|
+
|
3
|
+
module Katello
|
4
|
+
module Resources
|
5
|
+
module Discovery
|
6
|
+
class Yum < RepoDiscovery
|
7
|
+
attr_reader :found, :crawled, :to_follow
|
8
|
+
def initialize(url, crawled = [], found = [], to_follow = [],
|
9
|
+
upstream_credentials_and_search = {
|
10
|
+
upstream_username: nil,
|
11
|
+
upstream_password: nil
|
12
|
+
})
|
13
|
+
@uri = uri(url)
|
14
|
+
@upstream_username = upstream_credentials_and_search[:upstream_username].presence
|
15
|
+
@upstream_password = upstream_credentials_and_search[:upstream_password].presence
|
16
|
+
@found = found
|
17
|
+
@crawled = crawled
|
18
|
+
@to_follow = to_follow
|
19
|
+
end
|
20
|
+
|
21
|
+
def run(resume_point)
|
22
|
+
if @uri.scheme == 'file'
|
23
|
+
crawl_file_path(uri(resume_point))
|
24
|
+
elsif %w(http https).include?(@uri.scheme)
|
25
|
+
spidr_crawl_pages(uri(resume_point))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def crawl_file_path(url)
|
32
|
+
if url.path.ends_with?('/repodata/')
|
33
|
+
found_path = Pathname(url.path).parent.to_s
|
34
|
+
@found << "file://#{found_path}"
|
35
|
+
end
|
36
|
+
if url.path == @uri.path
|
37
|
+
Dir.glob("#{@uri.path}**/").each { |path| @to_follow << path }
|
38
|
+
@to_follow.shift
|
39
|
+
end
|
40
|
+
@crawled << url.path
|
41
|
+
end
|
42
|
+
|
43
|
+
def spidr_proxy_details
|
44
|
+
details = {}
|
45
|
+
|
46
|
+
if proxy
|
47
|
+
details[:host] = proxy_host
|
48
|
+
details[:port] = proxy_port
|
49
|
+
details[:user] = proxy.username
|
50
|
+
details[:password] = proxy.password
|
51
|
+
end
|
52
|
+
|
53
|
+
details
|
54
|
+
end
|
55
|
+
|
56
|
+
def spidr_crawl_pages(url)
|
57
|
+
url = url.to_s
|
58
|
+
user, password = @upstream_username, @upstream_password
|
59
|
+
Spidr.site(url, proxy: spidr_proxy_details) do |spider|
|
60
|
+
spider.authorized.add(url, user, password) if user && password
|
61
|
+
spider.every_page do |page|
|
62
|
+
page.url.query = nil
|
63
|
+
@crawled << page.url.to_s
|
64
|
+
process_page_urls(page.urls)
|
65
|
+
spider.skip_page!
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def process_page_urls(urls)
|
71
|
+
urls.each do |url|
|
72
|
+
# Remove query parameters to avoid duplicate processing of URLs with sorting parameters etc
|
73
|
+
url.query = nil
|
74
|
+
if url.path.ends_with? 'repodata/'
|
75
|
+
@found << url.to_s.split('repodata/').first
|
76
|
+
else
|
77
|
+
@to_follow << url.to_s if should_follow?(url)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def should_follow?(url)
|
83
|
+
#Verify:
|
84
|
+
# * link's path includes the base url
|
85
|
+
# * link hasn't already been crawled
|
86
|
+
# * link ends with '/' so it should be a directory
|
87
|
+
# * link doesn't end with '/Packages/', as this increases
|
88
|
+
# processing time and memory usage considerably
|
89
|
+
return url.path.starts_with?(@uri.path) && url.hostname == @uri.hostname && !@crawled.include?(url.to_s) &&
|
90
|
+
url.path.ends_with?('/') && !url.path.ends_with?('/Packages/')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Katello
|
2
2
|
module Util
|
3
3
|
class CdnVarSubstitutor
|
4
|
-
attr_reader :good_listings
|
5
|
-
|
4
|
+
attr_reader :good_listings, :bad_listings
|
5
|
+
|
6
6
|
# cdn_resource - an object providing access to CDN. It has to
|
7
7
|
# provide a get method that takes a path (e.g.
|
8
8
|
# /content/rhel/6.2/listing) and returns the body response)
|
@@ -68,7 +68,9 @@ module Katello
|
|
68
68
|
|
69
69
|
futures.each do |future|
|
70
70
|
resolved << future.value
|
71
|
-
|
71
|
+
if future.rejected?
|
72
|
+
fail Errors::CdnSubstitutionError, "Failed at scanning for repository: #{future.reason}"
|
73
|
+
end
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -13,7 +13,8 @@ module Katello
|
|
13
13
|
options[:prefix_keys] ||= []
|
14
14
|
options[:prefix] ||= '_'
|
15
15
|
|
16
|
-
|
16
|
+
case obj
|
17
|
+
when Hash
|
17
18
|
|
18
19
|
ostructized_hash = {}
|
19
20
|
obj.each do |key, value|
|
@@ -31,7 +32,7 @@ module Katello
|
|
31
32
|
end
|
32
33
|
return OpenStruct.new ostructized_hash
|
33
34
|
|
34
|
-
|
35
|
+
when Array
|
35
36
|
|
36
37
|
return obj.map { |r| ostructize(r, options) }
|
37
38
|
|
@@ -29,11 +29,12 @@ module Katello
|
|
29
29
|
|
30
30
|
def get_pulp_filter_type(type)
|
31
31
|
filter_type = type.downcase
|
32
|
-
|
32
|
+
case filter_type
|
33
|
+
when "bugfix"
|
33
34
|
return ::Katello::Erratum::BUGZILLA
|
34
|
-
|
35
|
+
when "enhancement"
|
35
36
|
return ::Katello::Erratum::ENHANCEMENT
|
36
|
-
|
37
|
+
when "security"
|
37
38
|
return ::Katello::Erratum::SECURITY
|
38
39
|
end
|
39
40
|
end
|
@@ -75,8 +75,8 @@ module Katello
|
|
75
75
|
vrea = [package[:version], package[:release]].compact.join('-')
|
76
76
|
vrea = vrea + '.' + package[:arch] unless package[:arch].nil?
|
77
77
|
vrea = vrea + '.' + package[:suffix] unless package[:suffix].nil?
|
78
|
-
|
79
|
-
vrea = package[:epoch] + ':' + vrea
|
78
|
+
if !package[:epoch].nil? && (package[:epoch].to_i != 0 || include_zero_epoch)
|
79
|
+
vrea = package[:epoch] + ':' + vrea
|
80
80
|
end
|
81
81
|
vrea
|
82
82
|
end
|
@@ -135,7 +135,7 @@ module Katello
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def self.valid_package_characters
|
138
|
-
/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
138
|
+
/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-._+,]+/
|
139
139
|
end
|
140
140
|
|
141
141
|
def self.setup_shared_unique_filter(repoids, search_mode, search_results)
|
@@ -25,7 +25,7 @@ module Katello
|
|
25
25
|
def substitutions_needed
|
26
26
|
# e.g. if content_url = "/content/dist/rhel/server/7/$releasever/$basearch/kickstart"
|
27
27
|
# return ['releasever', 'basearch']
|
28
|
-
split_path.map { |word| word.start_with?('$') ? word[1
|
28
|
+
split_path.map { |word| word.start_with?('$') ? word[1..] : nil }.compact
|
29
29
|
end
|
30
30
|
|
31
31
|
def substitutable?
|
@@ -3,11 +3,12 @@ module Katello
|
|
3
3
|
class AlternateContentSourcePathValidator < ActiveModel::EachValidator
|
4
4
|
def validate_each(record, attribute, value)
|
5
5
|
if value
|
6
|
-
|
6
|
+
case attribute
|
7
|
+
when :base_url
|
7
8
|
unless AlternateContentSourcePathValidator.validate_base_url(value)
|
8
9
|
record.errors[attribute] << N_("%s is not a valid path") % value
|
9
10
|
end
|
10
|
-
|
11
|
+
when :subpaths
|
11
12
|
unless AlternateContentSourcePathValidator.validate_subpaths(value)
|
12
13
|
record.errors[attribute] << N_('All subpaths must have a slash at the end and none at the front')
|
13
14
|
end
|
@@ -16,7 +17,7 @@ module Katello
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def self.validate_base_url(base_url)
|
19
|
-
base_url =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
|
20
|
+
base_url =~ /\A(?!uln:\/\/)(#{URI::DEFAULT_PARSER.make_regexp})\z/
|
20
21
|
end
|
21
22
|
|
22
23
|
# Subpaths must have a slash at the end and none at the front: 'path/'
|
@@ -2,13 +2,11 @@ module Katello
|
|
2
2
|
module Validators
|
3
3
|
class AlternateContentSourceProductsValidator < ActiveModel::EachValidator
|
4
4
|
def validate_each(record, attribute, value)
|
5
|
-
if value
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
record.errors.add(attribute, _("%{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type })
|
11
|
-
end
|
5
|
+
if value && (attribute == :product_id)
|
6
|
+
product = ::Katello::Product.find(value)
|
7
|
+
content_type = record.alternate_content_source.content_type
|
8
|
+
if product.acs_compatible_repositories.with_type(content_type).empty?
|
9
|
+
record.errors.add(attribute, _("%{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type })
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -8,7 +8,7 @@ module Katello
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.validate_name(name)
|
11
|
-
if name.empty? || name.length > 255 || !/\A([a-z0-9]+[a-z0-9
|
11
|
+
if name.empty? || name.length > 255 || !/\A([a-z0-9]+[a-z0-9\-_.]*)+(\/[a-z0-9]+[a-z0-9\-_.]*)*\z/.match?(name)
|
12
12
|
return false
|
13
13
|
end
|
14
14
|
true
|
@@ -13,8 +13,8 @@ module Katello
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.validate_length(record, attribute, value, min_length = 1)
|
16
|
-
if value
|
17
|
-
record.errors[attribute] << _("must contain at least %s character") % min_length
|
16
|
+
if value && !(value.length >= min_length)
|
17
|
+
record.errors[attribute] << _("must contain at least %s character") % min_length
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -6,8 +6,8 @@ module Katello
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.validate_trailing_space(record, attribute, value)
|
9
|
-
if value
|
10
|
-
record.errors[attribute] << _("must not contain leading or trailing white spaces.")
|
9
|
+
if value && !(value.strip == value)
|
10
|
+
record.errors[attribute] << _("must not contain leading or trailing white spaces.")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -7,8 +7,8 @@ module Katello
|
|
7
7
|
# this is because in v1.0 we want
|
8
8
|
# prior to have only one child (unless its the Library)
|
9
9
|
ancestor = record.prior
|
10
|
-
if ancestor && !ancestor.library?
|
11
|
-
record.errors[:prior] << _("prior environment can only have one child")
|
10
|
+
if ancestor && !ancestor.library? && (ancestor.successors.count == 1 && !ancestor.successors.include?(record))
|
11
|
+
record.errors[:prior] << _("prior environment can only have one child")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -12,10 +12,8 @@ module Katello
|
|
12
12
|
def unique_attribute?(record, attribute, value)
|
13
13
|
unique = true
|
14
14
|
|
15
|
-
if record.provider && !record.provider.redhat_provider? && record.send("#{attribute}_changed?")
|
16
|
-
|
17
|
-
unique = false
|
18
|
-
end
|
15
|
+
if record.provider && !record.provider.redhat_provider? && record.send("#{attribute}_changed?") && Product.in_org(record.provider.organization).where(attribute => value).exists?
|
16
|
+
unique = false
|
19
17
|
end
|
20
18
|
|
21
19
|
unique
|
@@ -182,12 +182,10 @@ module Katello
|
|
182
182
|
end
|
183
183
|
|
184
184
|
def validate_destroyable!
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
"before deleting." % {name: name})
|
190
|
-
end
|
185
|
+
if !organization.being_deleted? && Parameter.where(name: 'kt_activation_keys').pluck(:value).any? { |value| value.split(",").include?(name) }
|
186
|
+
fail _("This activation key is associated to one or more Hosts/Hostgroups. "\
|
187
|
+
"Search and unassociate Hosts/Hostgroups using params.kt_activation_keys ~ \"%{name}\" "\
|
188
|
+
"before deleting." % {name: name})
|
191
189
|
end
|
192
190
|
true
|
193
191
|
end
|
@@ -54,7 +54,7 @@ module Katello
|
|
54
54
|
validates :content_type, inclusion: {
|
55
55
|
in: ->(_) { RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES },
|
56
56
|
allow_blank: false,
|
57
|
-
message: ->(_, _) { _("is not allowed for ACS. Must be one of the following: %s") % (RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES).join(',') }
|
57
|
+
message: ->(_, _) { _("is not allowed for ACS. Must be one of the following: %s") % (RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES).sort.join(',') }
|
58
58
|
}
|
59
59
|
validates :content_type, if: -> { rhui? }, inclusion: {
|
60
60
|
in: [::Katello::Repository::YUM_TYPE],
|
@@ -64,7 +64,7 @@ module Katello
|
|
64
64
|
sorted_substitutions = substitutions.sort_by { |k, _| k.to_s }.map(&:last)
|
65
65
|
repo_name_parts = [content.name,
|
66
66
|
sorted_substitutions].flatten.compact
|
67
|
-
repo_name_parts.join(" ").gsub(/[^a-z0-9
|
67
|
+
repo_name_parts.join(" ").gsub(/[^a-z0-9\-._ ]/i, "")
|
68
68
|
end
|
69
69
|
|
70
70
|
def path
|
@@ -83,7 +83,7 @@ module Katello
|
|
83
83
|
|
84
84
|
def feed_url
|
85
85
|
return if product.organization.cdn_configuration.export_sync?
|
86
|
-
@feed_url ||= if product.cdn_resource
|
86
|
+
@feed_url ||= if product.cdn_resource.respond_to?(:repository_url)
|
87
87
|
product.cdn_resource.repository_url(content_label: content.label, arch: arch, major: version[:major], minor: version[:minor])
|
88
88
|
else
|
89
89
|
product.repo_url(path)
|
@@ -85,7 +85,7 @@ module Katello
|
|
85
85
|
end
|
86
86
|
|
87
87
|
included do
|
88
|
-
prepend ::ForemanRemoteExecution::HostExtensions
|
88
|
+
prepend ::ForemanRemoteExecution::HostExtensions
|
89
89
|
prepend Overrides
|
90
90
|
|
91
91
|
delegate :content_source_id, :single_content_view, :single_lifecycle_environment, :default_environment?, :single_content_view_environment?, :multi_content_view_environment?, :kickstart_repository_id, :bound_repositories,
|
@@ -480,8 +480,10 @@ module Katello
|
|
480
480
|
|
481
481
|
def rhel_eos_schedule_index
|
482
482
|
return nil unless probably_rhel?
|
483
|
-
major = operatingsystem
|
483
|
+
major = operatingsystem&.major
|
484
|
+
return nil unless major
|
484
485
|
return "RHEL#{major}" unless major == "7"
|
486
|
+
|
485
487
|
arch_name = architecture&.name
|
486
488
|
case arch_name
|
487
489
|
when "ppc64le"
|
@@ -503,53 +505,82 @@ module Katello
|
|
503
505
|
end
|
504
506
|
end
|
505
507
|
|
508
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
509
|
+
# rubocop:disable Metrics/MethodLength
|
506
510
|
def yum_names_for_job_template(action:, search:, versions: nil)
|
507
511
|
actions = %w(install remove update).freeze
|
508
512
|
case action
|
509
513
|
when 'install'
|
510
|
-
::Katello::Rpm.yum_installable_for_host(self).search_for(search).distinct.pluck(:name)
|
514
|
+
yum_installable = ::Katello::Rpm.yum_installable_for_host(self).search_for(search).distinct.pluck(:name)
|
515
|
+
if yum_installable.empty?
|
516
|
+
fail N_("No available packages found for search term '%s'. Check the host's content view environments and already-installed packages.") % search
|
517
|
+
end
|
518
|
+
yum_installable
|
511
519
|
when 'remove'
|
512
520
|
return [] if search.empty?
|
513
521
|
|
514
|
-
installed_packages.search_for(search).distinct.pluck(:name)
|
522
|
+
yum_removable = installed_packages.search_for(search).distinct.pluck(:name)
|
523
|
+
if yum_removable.empty?
|
524
|
+
fail N_("Cannot remove package(s): This host does not have any installed packages matching the search term '%s'.") % search
|
525
|
+
end
|
526
|
+
yum_removable
|
515
527
|
when 'update'
|
516
528
|
return [] if search.empty?
|
517
529
|
|
518
530
|
versions_by_name_arch = {}
|
519
531
|
if versions.present?
|
520
532
|
JSON.parse(versions).each do |nvra|
|
521
|
-
nvra =~ /([
|
533
|
+
nvra =~ /([^.]*)-[-.\w]*\.(\w+)/
|
522
534
|
versions_by_name_arch[[Regexp.last_match(1), Regexp.last_match(2)]] = nvra
|
523
535
|
end
|
524
536
|
end
|
525
537
|
pkg_name_archs = installed_packages.search_for(search).distinct.pluck(:name, :arch)
|
538
|
+
if pkg_name_archs.empty?
|
539
|
+
fail _("Cannot upgrade packages: No installed packages found for search term '%s'") % search
|
540
|
+
end
|
526
541
|
upgrades = ::Katello::Rpm.installable_for_hosts([self]).select(:id, :name, :arch, :nvra, :evr).order(evr: :desc).group_by { |i| [i.name, i.arch] }
|
527
|
-
pkg_name_archs.map { |name, arch| versions_by_name_arch[[name, arch]] || upgrades[[name, arch]]&.first&.nvra }.compact
|
542
|
+
result = pkg_name_archs.map { |name, arch| versions_by_name_arch[[name, arch]] || upgrades[[name, arch]]&.first&.nvra }.compact
|
543
|
+
if result.empty?
|
544
|
+
fail _("No upgradable packages found for search term '%s'. The host may already have the latest version(s) installed.") % search
|
545
|
+
end
|
546
|
+
result
|
528
547
|
else
|
529
548
|
fail ::Foreman::Exception.new(N_("package_names_for_job_template: Action must be one of %s"), actions.join(', '))
|
530
549
|
end
|
531
550
|
end
|
551
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
532
552
|
|
533
553
|
def deb_names_for_job_template(action:, search:)
|
534
554
|
actions = %w(install remove update).freeze
|
535
555
|
case action
|
536
556
|
when 'install'
|
537
|
-
::Katello::Deb.apt_installable_for_host(self).search_for(search).distinct.pluck(:name)
|
557
|
+
deb_installable = ::Katello::Deb.apt_installable_for_host(self).search_for(search).distinct.pluck(:name)
|
558
|
+
if deb_installable.empty?
|
559
|
+
fail _("No available debs found for search term '%s'. Check the host's content view environments and already-installed debs.") % search
|
560
|
+
end
|
561
|
+
deb_installable
|
538
562
|
when 'remove'
|
539
563
|
return [] if search.empty?
|
540
564
|
|
541
565
|
installed_debs.search_for(search).distinct.pluck(:name)
|
542
566
|
when 'update'
|
543
567
|
return [] if search.empty?
|
544
|
-
|
545
|
-
|
568
|
+
deb_results = installed_debs.search_for(search).distinct.pluck(:name)
|
569
|
+
if deb_results.empty?
|
570
|
+
fail _("No installed debs found for search term '%s'") % search
|
571
|
+
end
|
572
|
+
deb_results
|
546
573
|
else
|
547
574
|
fail ::Foreman::Exception.new(N_("deb_names_for_job_template: Action must be one of %s"), actions.join(', '))
|
548
575
|
end
|
549
576
|
end
|
550
577
|
|
551
578
|
def advisory_ids(search:)
|
552
|
-
::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
|
579
|
+
ids = ::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
|
580
|
+
if ids.empty?
|
581
|
+
fail _("Cannot install errata: No installable errata found for search term '%s'") % search
|
582
|
+
end
|
583
|
+
ids
|
553
584
|
end
|
554
585
|
|
555
586
|
def filtered_entitlement_quantity_consumed(pool)
|
@@ -39,10 +39,8 @@ module Katello
|
|
39
39
|
self.medium = nil
|
40
40
|
end
|
41
41
|
|
42
|
-
if content_facet&.kickstart_repository_id && !matching_kickstart_repository?(content_facet)
|
43
|
-
|
44
|
-
self.content_facet.kickstart_repository_id = equivalent[:id]
|
45
|
-
end
|
42
|
+
if content_facet&.kickstart_repository_id && !matching_kickstart_repository?(content_facet) && (equivalent = equivalent_kickstart_repository)
|
43
|
+
self.content_facet.kickstart_repository_id = equivalent[:id]
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
@@ -16,10 +16,8 @@ module Katello
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def reset_settings
|
19
|
-
if saved_change_to_attribute?(:title)
|
20
|
-
|
21
|
-
::Setting[:default_location_subscribed_hosts] = self.title
|
22
|
-
end
|
19
|
+
if saved_change_to_attribute?(:title) && (::Setting[:default_location_subscribed_hosts] == self.title_before_last_save)
|
20
|
+
::Setting[:default_location_subscribed_hosts] = self.title
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -6,33 +6,101 @@ module Katello
|
|
6
6
|
REDHAT_ATOMIC_HOST_DISTRO_NAME = "Red Hat Enterprise Linux Atomic Host".freeze
|
7
7
|
REDHAT_ATOMIC_HOST_OS = "RedHat_Enterprise_Linux_Atomic_Host".freeze
|
8
8
|
|
9
|
+
DEBIAN_DEFAULT_PROVISIONING_TEMPLATE = "Preseed default %{template_kind_name}".freeze
|
10
|
+
DEBIAN_DEFAULT_PTABLE = "Preseed default".freeze
|
11
|
+
|
12
|
+
SUSE_DEFAULT_PROVISIONING_TEMPLATE = "AutoYaST default %{template_kind_name}".freeze
|
13
|
+
SUSE_DEFAULT_PTABLE = "AutoYaST entire SCSI disk".freeze
|
14
|
+
|
9
15
|
included do
|
10
16
|
after_create :assign_templates!
|
11
17
|
before_create :set_atomic_attributes, :if => proc { |os| os.name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS }
|
12
18
|
end
|
13
19
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def find_related_os
|
21
|
+
Operatingsystem.unscoped.where(name: self.name).order(major: :desc, minor: :desc).where.not(id: self.id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def assign_related_os_templates
|
25
|
+
all_related_os = find_related_os
|
26
|
+
return false if all_related_os.nil?
|
27
|
+
|
28
|
+
boot_loader_template_kinds = TemplateKind.where(name: ["PXELinux", "PXEGrub", "PXEGrub2", "iPXE"]).pluck(:id)
|
29
|
+
provision_template_kinds = TemplateKind.where(name: ["provision", "finish"]).pluck(:id)
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
all_related_os.each do |related_os|
|
32
|
+
next if related_os.provisioning_templates.empty? || related_os.ptables.empty?
|
33
|
+
next if related_os.provisioning_templates.where(template_kind_id: boot_loader_template_kinds).size == 0
|
34
|
+
next if related_os.provisioning_templates.where(template_kind_id: provision_template_kinds).size == 0
|
35
|
+
|
36
|
+
Rails.logger.info "Using operating system #{related_os.name} (major: #{related_os.major}, minor: #{related_os.minor}) " \
|
37
|
+
"as a template source for the new OS #{name} (major: #{major}, minor: #{minor})."
|
38
|
+
|
39
|
+
related_os.ptables.each do |ptable|
|
40
|
+
ptables << ptable unless ptables.include?(ptable)
|
41
|
+
end
|
42
|
+
|
43
|
+
related_os.provisioning_templates.each do |template|
|
44
|
+
provisioning_templates << template unless provisioning_templates.include?(template)
|
45
|
+
OsDefaultTemplate.where(:operatingsystem_id => related_os.id, :provisioning_template_id => template.id).each do |os_default_temp|
|
46
|
+
OsDefaultTemplate.create(:template_kind_id => os_default_temp.template_kind_id,
|
47
|
+
:provisioning_template_id => os_default_temp.provisioning_template_id,
|
48
|
+
:operatingsystem_id => id)
|
29
49
|
end
|
30
50
|
end
|
51
|
+
return true
|
52
|
+
end
|
53
|
+
false
|
54
|
+
end
|
55
|
+
|
56
|
+
def provisioning_template_name_for_os(template_kind_name)
|
57
|
+
case self.family
|
58
|
+
when 'Redhat'
|
59
|
+
if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS && template_kind_name == "provision"
|
60
|
+
Setting["katello_default_atomic_provision"]
|
61
|
+
else
|
62
|
+
Setting["katello_default_#{template_kind_name}"]
|
63
|
+
end
|
64
|
+
when 'Debian'
|
65
|
+
format(DEBIAN_DEFAULT_PROVISIONING_TEMPLATE, template_kind_name: template_kind_name)
|
66
|
+
when 'Suse'
|
67
|
+
format(SUSE_DEFAULT_PROVISIONING_TEMPLATE, template_kind_name: template_kind_name)
|
68
|
+
end
|
69
|
+
end
|
31
70
|
|
32
|
-
|
33
|
-
|
71
|
+
def partition_table_name_for_os
|
72
|
+
case self.family
|
73
|
+
when 'Redhat'
|
74
|
+
Setting["katello_default_ptable"]
|
75
|
+
when 'Debian'
|
76
|
+
DEBIAN_DEFAULT_PTABLE
|
77
|
+
when 'Suse'
|
78
|
+
SUSE_DEFAULT_PTABLE
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def assign_templates!
|
83
|
+
if [ 'Suse', 'Debian' ].include?(self.family) && assign_related_os_templates
|
84
|
+
return
|
85
|
+
end
|
86
|
+
|
87
|
+
# Automatically assign default templates
|
88
|
+
TemplateKind.all.each do |kind|
|
89
|
+
provisioning_template_name = provisioning_template_name_for_os(kind.name)
|
90
|
+
next if provisioning_template_name.nil?
|
91
|
+
if (template = ProvisioningTemplate.unscoped.find_by_name(provisioning_template_name))
|
92
|
+
provisioning_templates << template unless provisioning_templates.include?(template)
|
93
|
+
if OsDefaultTemplate.where(:template_kind_id => kind.id, :operatingsystem_id => id).empty?
|
94
|
+
OsDefaultTemplate.create(:template_kind_id => kind.id, :provisioning_template_id => template.id, :operatingsystem_id => id)
|
95
|
+
end
|
34
96
|
end
|
35
97
|
end
|
98
|
+
|
99
|
+
partition_table_name = partition_table_name_for_os
|
100
|
+
return if partition_table_name.nil?
|
101
|
+
if (ptable = Ptable.unscoped.find_by_name(partition_table_name)) && !ptables.include?(ptable)
|
102
|
+
ptables << ptable
|
103
|
+
end
|
36
104
|
end
|
37
105
|
|
38
106
|
def set_atomic_attributes
|