katello 4.6.2.1 → 4.7.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.

Files changed (333) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/common/vendor.js +0 -1
  3. data/app/controllers/katello/api/v2/activation_keys_controller.rb +1 -0
  4. data/app/controllers/katello/api/v2/alternate_content_sources_controller.rb +4 -4
  5. data/app/controllers/katello/api/v2/capsule_content_controller.rb +5 -0
  6. data/app/controllers/katello/api/v2/content_imports_controller.rb +1 -0
  7. data/app/controllers/katello/api/v2/content_view_components_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -1
  9. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -1
  10. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -0
  11. data/app/controllers/katello/api/v2/repositories_controller.rb +78 -12
  12. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +1 -1
  13. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +7 -1
  14. data/app/controllers/katello/concerns/api/v2/smart_proxies_controller_extensions.rb +1 -0
  15. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -9
  16. data/app/helpers/katello/content_source_helper.rb +9 -0
  17. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +31 -0
  18. data/app/lib/actions/katello/activation_key/destroy.rb +1 -0
  19. data/app/lib/actions/katello/agent_action.rb +1 -0
  20. data/app/lib/actions/katello/alternate_content_source/create.rb +1 -1
  21. data/app/lib/actions/katello/alternate_content_source/update.rb +2 -2
  22. data/app/lib/actions/katello/capsule_content/sync.rb +10 -2
  23. data/app/lib/actions/katello/cdn_configuration/update.rb +1 -1
  24. data/app/lib/actions/katello/content_view/promote.rb +1 -0
  25. data/app/lib/actions/katello/content_view/publish.rb +5 -2
  26. data/app/lib/actions/katello/content_view_version/auto_create_redhat_repositories.rb +7 -3
  27. data/app/lib/actions/katello/content_view_version/auto_create_repositories.rb +4 -2
  28. data/app/lib/actions/katello/content_view_version/import.rb +22 -10
  29. data/app/lib/actions/katello/product/destroy.rb +1 -1
  30. data/app/lib/actions/katello/repository/destroy.rb +3 -3
  31. data/app/lib/actions/katello/repository/errata_mail.rb +9 -6
  32. data/app/lib/actions/katello/repository/refresh_repository.rb +1 -1
  33. data/app/lib/actions/katello/repository/sync.rb +13 -6
  34. data/app/lib/actions/katello/repository_set/enable_repository.rb +6 -2
  35. data/app/lib/actions/pulp3/alternate_content_source/refresh_remote.rb +16 -0
  36. data/app/lib/actions/pulp3/orchestration/alternate_content_source/refresh.rb +1 -0
  37. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +1 -1
  38. data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +10 -2
  39. data/app/lib/katello/concerns/renderer_extensions.rb +2 -1
  40. data/app/lib/katello/errors.rb +2 -2
  41. data/app/lib/katello/resources/candlepin.rb +7 -1
  42. data/app/lib/katello/resources/cdn/katello_cdn.rb +3 -13
  43. data/app/lib/katello/resources/cdn.rb +14 -9
  44. data/app/lib/katello/util/candlepin_repository_checker.rb +73 -0
  45. data/app/models/katello/activation_key.rb +12 -1
  46. data/app/models/katello/alternate_content_source.rb +15 -4
  47. data/app/models/katello/alternate_content_source_product.rb +1 -1
  48. data/app/models/katello/authorization/repository.rb +2 -2
  49. data/app/models/katello/cdn_configuration.rb +12 -3
  50. data/app/models/katello/concerns/host_managed_extensions.rb +15 -2
  51. data/app/models/katello/concerns/http_proxy_extensions.rb +5 -10
  52. data/app/models/katello/concerns/smart_proxy_extensions.rb +30 -15
  53. data/app/models/katello/content.rb +15 -0
  54. data/app/models/katello/content_credential.rb +8 -9
  55. data/app/models/katello/content_view.rb +7 -3
  56. data/app/models/katello/content_view_component.rb +4 -0
  57. data/app/models/katello/content_view_version.rb +1 -1
  58. data/app/models/katello/erratum.rb +6 -2
  59. data/app/models/katello/host/content_facet.rb +13 -3
  60. data/app/models/katello/repository.rb +15 -1
  61. data/app/models/katello/root_repository.rb +0 -2
  62. data/app/overrides/add_smart_proxy_form.rb +5 -0
  63. data/app/presenters/katello/content_view_version_compare_presenter.rb +5 -0
  64. data/app/presenters/katello/host_package_presenter.rb +4 -4
  65. data/app/services/katello/pulp3/alternate_content_source.rb +23 -15
  66. data/app/services/katello/pulp3/ansible_collection.rb +7 -10
  67. data/app/services/katello/pulp3/content_view_version/export.rb +19 -6
  68. data/app/services/katello/pulp3/content_view_version/import.rb +2 -0
  69. data/app/services/katello/pulp3/content_view_version/import_validator.rb +21 -5
  70. data/app/services/katello/pulp3/content_view_version/importable_products.rb +11 -1
  71. data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +38 -9
  72. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +12 -5
  73. data/app/services/katello/pulp3/content_view_version/metadata_map.rb +13 -2
  74. data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +5 -1
  75. data/app/services/katello/pulp3/pulp_content_unit.rb +3 -0
  76. data/app/services/katello/pulp3/repository.rb +18 -6
  77. data/app/services/katello/pulp3/repository_mirror.rb +0 -1
  78. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +2 -2
  79. data/app/services/katello/pulp3/task_group.rb +18 -1
  80. data/app/services/katello/repository_type.rb +5 -2
  81. data/app/services/katello/repository_type_manager.rb +4 -3
  82. data/app/views/dashboard/_content_views_widget.html.erb +1 -1
  83. data/app/views/foreman/job_templates/change_content_source.erb +6 -0
  84. data/app/views/foreman/job_templates/update_packages_by_search_query.erb +7 -1
  85. data/app/views/katello/api/v2/alternate_content_sources/base.json.rabl +4 -4
  86. data/app/views/katello/api/v2/alternate_content_sources/index.json.rabl +1 -0
  87. data/app/views/katello/api/v2/alternate_content_sources/permissions.rabl +11 -0
  88. data/app/views/katello/api/v2/content_credentials/show.json.rabl +12 -0
  89. data/app/views/katello/api/v2/content_views/permissions.rabl +1 -0
  90. data/app/views/katello/api/v2/host_packages/base.json.rabl +1 -1
  91. data/app/views/katello/api/v2/module_streams/show.json.rabl +7 -0
  92. data/app/views/katello/api/v2/repositories/compare.json.rabl +10 -0
  93. data/app/views/katello/api/v2/smart_proxies/pulp_info.json.rabl +1 -0
  94. data/app/views/katello/hosts/_errata_counts.html.erb +46 -0
  95. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +1 -0
  96. data/app/views/overrides/smart_proxies/_acs_http_proxy.html.erb +6 -0
  97. data/config/initializers/monkeys.rb +1 -0
  98. data/config/routes/api/v2.rb +2 -0
  99. data/config/routes.rb +3 -0
  100. data/db/migrate/20220730033504_update_custom_cdn.rb +13 -0
  101. data/db/migrate/20220920173656_add_http_proxy_to_smart_proxy.rb +7 -0
  102. data/db/migrate/20220920180858_remove_http_proxy_from_katello_alternate_content_sources.rb +6 -0
  103. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  104. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +5 -5
  105. data/engines/bastion/vendor/assets/javascripts/bastion/angular/angular.js +1 -1
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/content-credential.factory.js +17 -0
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/content-credentials.routes.js +10 -0
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-acs.controller.js +36 -0
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-details.controller.js +7 -1
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/views/content-credential-acs.html +38 -0
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/views/content-credential-details.html +3 -0
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/views/content-credentials.html +7 -2
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +4 -2
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +1 -1
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -3
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +14 -1392
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/katello-features.run.js +1 -0
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +7 -0
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +1 -1
  120. data/lib/katello/permission_creator.rb +1 -0
  121. data/lib/katello/plugin.rb +34 -11
  122. data/lib/katello/repository_types/deb.rb +1 -1
  123. data/lib/katello/repository_types/docker.rb +1 -1
  124. data/lib/katello/repository_types/python.rb +3 -3
  125. data/lib/katello/tasks/check_candlepin_content.rake +16 -0
  126. data/lib/katello/tasks/reset.rake +1 -1
  127. data/lib/katello/version.rb +1 -1
  128. data/lib/monkeys/try_pulp_container_path.rb +35 -0
  129. data/locale/action_names.rb +7 -7
  130. data/locale/bn/katello.po +395 -63
  131. data/locale/cs/katello.po +396 -64
  132. data/locale/de/katello.po +399 -67
  133. data/locale/en/katello.po +395 -63
  134. data/locale/es/katello.po +399 -67
  135. data/locale/fr/katello.po +400 -68
  136. data/locale/gu/katello.po +395 -63
  137. data/locale/hi/katello.po +395 -63
  138. data/locale/it/katello.po +396 -64
  139. data/locale/ja/katello.po +400 -68
  140. data/locale/katello.pot +1916 -1213
  141. data/locale/kn/katello.po +395 -63
  142. data/locale/ko/katello.po +396 -64
  143. data/locale/mr/katello.po +395 -63
  144. data/locale/or/katello.po +395 -63
  145. data/locale/pa/katello.po +395 -63
  146. data/locale/pt/katello.po +395 -63
  147. data/locale/pt_BR/katello.po +399 -67
  148. data/locale/ru/katello.po +396 -64
  149. data/locale/ta/katello.po +395 -63
  150. data/locale/te/katello.po +395 -63
  151. data/locale/zh_CN/katello.po +400 -68
  152. data/locale/zh_TW/katello.po +396 -64
  153. data/webpack/components/Bookmark/index.js +5 -1
  154. data/webpack/components/Content/Details/ContentDetails.js +1 -1
  155. data/webpack/components/Content/Details/__tests__/__snapshots__/ContentDetails.test.js.snap +6 -0
  156. data/webpack/components/EditableSwitch.js +1 -0
  157. data/webpack/components/EditableTextInput/EditableTextInput.js +3 -3
  158. data/webpack/components/Errata/errataHelpers.js +33 -0
  159. data/webpack/components/Errata/index.js +45 -12
  160. data/webpack/components/Loading.js +18 -8
  161. data/webpack/components/Packages/index.js +8 -24
  162. data/webpack/components/RoutedTabs/index.js +1 -0
  163. data/webpack/components/Search/Search.js +20 -2
  164. data/webpack/components/Search/__tests__/search.test.js +3 -3
  165. data/webpack/components/Table/EmptyStateMessage.js +1 -1
  166. data/webpack/components/Table/PageControls.js +1 -0
  167. data/webpack/components/Table/TableHooks.js +4 -0
  168. data/webpack/components/Table/TableWrapper.js +7 -7
  169. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +1 -0
  170. data/webpack/components/TypeAhead/pf4Search/TypeAheadItems.js +2 -0
  171. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +1 -1
  172. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +3 -1
  173. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ContentViewDetailsCard.js +2 -1
  174. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +124 -68
  175. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.scss +5 -0
  176. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsCard.js +30 -4
  177. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsCard.scss +23 -0
  178. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +5 -4
  179. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsCard.test.js +25 -10
  180. data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js +3 -3
  181. data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js +6 -0
  182. data/webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js +145 -32
  183. data/webpack/components/extensions/HostDetails/DetailsTabCards/RegistrationCard.js +3 -1
  184. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/constants.js +2 -1
  185. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/index.js +1 -0
  186. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +78 -26
  187. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +23 -10
  188. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/HostPackagesConstants.js +1 -0
  189. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +9 -4
  190. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +141 -23
  191. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.scss +6 -1
  192. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +9 -8
  193. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +24 -3
  194. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/EnableTracerModal.js +7 -2
  195. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesEnabler.js +2 -1
  196. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +20 -4
  197. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +56 -38
  198. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +3 -3
  199. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +5 -4
  200. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +3 -3
  201. data/webpack/containers/Application/config.js +2 -2
  202. data/webpack/containers/Application/overrides.scss +12 -0
  203. data/webpack/global_test_setup.js +19 -1
  204. data/webpack/ouia_id_check.js +0 -2
  205. data/webpack/redux/actions/RedHatRepositories/helpers.js +4 -8
  206. data/webpack/scenes/AlternateContentSources/ACSActions.js +37 -6
  207. data/webpack/scenes/AlternateContentSources/ACSConstants.js +2 -0
  208. data/webpack/scenes/AlternateContentSources/ACSIndexPage.js +1 -1
  209. data/webpack/scenes/AlternateContentSources/ACSSelectors.js +6 -6
  210. data/webpack/scenes/AlternateContentSources/Acs.scss +3 -0
  211. data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +24 -3
  212. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCreateFinish.js +10 -8
  213. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +25 -4
  214. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSReview.js +22 -11
  215. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +27 -2
  216. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +49 -17
  217. data/webpack/scenes/AlternateContentSources/Create/Steps/SelectSource.js +76 -23
  218. data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +159 -11
  219. data/webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js +83 -29
  220. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditCredentials.js +9 -8
  221. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +2 -2
  222. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditProducts.js +2 -2
  223. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditSmartProxies.js +39 -7
  224. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +27 -11
  225. data/webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js +58 -55
  226. data/webpack/scenes/AlternateContentSources/Details/__tests__/ACSExpandableDetails.test.js +35 -32
  227. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +323 -150
  228. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsIndex.fixtures.json +5 -1
  229. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +10 -11
  230. data/webpack/scenes/AlternateContentSources/helpers.js +26 -0
  231. data/webpack/scenes/ContentViews/ContentViewsConstants.js +1 -0
  232. data/webpack/scenes/ContentViews/ContentViewsPage.js +1 -1
  233. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +1 -0
  234. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +1 -0
  235. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +10 -5
  236. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +30 -7
  237. data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +1 -0
  238. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +21 -6
  239. data/webpack/scenes/ContentViews/Delete/Steps/CVDeleteEnvironmentsSelection.js +3 -3
  240. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js +1 -0
  241. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js +1 -0
  242. data/webpack/scenes/ContentViews/Delete/__tests__/CvData.fixtures.json +2 -0
  243. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +3 -0
  244. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +4 -1
  245. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentVersion.js +1 -1
  246. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  247. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +14 -0
  248. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +11 -1
  249. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +1 -1
  250. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +2 -0
  251. data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +5 -0
  252. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositorySelection.js +1 -0
  253. data/webpack/scenes/ContentViews/Details/Filters/ArtifactsWithNoErrata.js +1 -0
  254. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +8 -2
  255. data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +5 -1
  256. data/webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js +22 -6
  257. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +19 -9
  258. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +9 -2
  259. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +9 -2
  260. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +8 -2
  261. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +1 -1
  262. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
  263. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +3 -2
  264. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +1 -1
  265. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +2 -2
  266. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +1 -1
  267. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +1 -1
  268. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +1 -1
  269. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -2
  270. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +2 -0
  271. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
  272. data/webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReviewEnvironments.js +3 -3
  273. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompare.js +9 -1
  274. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +83 -0
  275. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +32 -8
  276. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +56 -3
  277. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/cvCompareRepositories.fixtures.json +175 -0
  278. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +6 -2
  279. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVEnvironmentSelectionForm.js +3 -3
  280. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js +1 -0
  281. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignHostsForm.js +1 -0
  282. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +2 -2
  283. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +2 -2
  284. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +2 -2
  285. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +1 -0
  286. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +4 -1
  287. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +5 -4
  288. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +5 -1
  289. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +3 -3
  290. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +10 -5
  291. data/webpack/scenes/ContentViews/__tests__/basicContentViews.fixtures.js +2 -0
  292. data/webpack/scenes/ContentViews/__tests__/contentViewList.fixtures.json +1 -0
  293. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +81 -19
  294. data/webpack/scenes/ContentViews/components/CVBreadCrumb.js +1 -1
  295. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +1 -0
  296. data/webpack/scenes/ContentViews/components/InactiveText.js +9 -1
  297. data/webpack/scenes/ContentViews/expansions/RelatedCompositeContentViewsModal.js +4 -2
  298. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +3 -2
  299. data/webpack/scenes/Hosts/ChangeContentSource/actions.js +18 -11
  300. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +15 -8
  301. data/webpack/scenes/Hosts/ChangeContentSource/components/FormField.js +3 -4
  302. data/webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js +55 -0
  303. data/webpack/scenes/Hosts/ChangeContentSource/components/HostsModal.js +59 -0
  304. data/webpack/scenes/Hosts/ChangeContentSource/constants.js +1 -0
  305. data/webpack/scenes/Hosts/ChangeContentSource/helpers.js +2 -5
  306. data/webpack/scenes/Hosts/ChangeContentSource/index.js +46 -41
  307. data/webpack/scenes/Hosts/ChangeContentSource/selectors.js +5 -5
  308. data/webpack/scenes/ModuleStreams/Details/ModuleDetailsSchema.js +10 -1
  309. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetails.js +1 -1
  310. data/webpack/scenes/ModuleStreams/Details/__tests__/__snapshots__/ModuleStreamDetails.test.js.snap +97 -2
  311. data/webpack/scenes/Organizations/OrganizationSelectors.js +1 -0
  312. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnConfigurationConstants.js +2 -1
  313. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +10 -25
  314. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +154 -0
  315. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/ExportSyncForm.js +4 -4
  316. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/NetworkSyncForm.js +59 -44
  317. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/CdnTypeForm.test.js +3 -28
  318. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/CustomCdnTypeForm.test.js +97 -0
  319. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/ExportSyncForm.test.js +1 -1
  320. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/NetworkSyncForm.test.js +4 -4
  321. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/index.js +23 -10
  322. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -1
  323. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +2 -1
  324. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +5 -5
  325. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +3 -3
  326. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +2 -2
  327. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +3 -3
  328. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +3 -3
  329. data/webpack/scenes/Tasks/helpers.js +14 -7
  330. metadata +54 -35
  331. data/app/lib/actions/pulp3/orchestration/alternate_content_source/refresh_remote.rb +0 -18
  332. data/db/migrate/20221206170122_update_ignore_srpm_to_false_for_mirror_complete.rb +0 -5
  333. data/vendor/assets/javascripts/katello/jquery.trunk8.js +0 -203
@@ -21,16 +21,28 @@ module Actions
21
21
 
22
22
  sequence do
23
23
  plan_action(AutoCreateProducts, import: import)
24
- plan_action(AutoCreateRepositories, import: import)
25
- plan_action(AutoCreateRedhatRepositories, import: import)
26
- plan_action(ResetContentViewRepositoriesFromMetadata, import: import)
27
- plan_action(::Actions::Katello::ContentView::Publish, import.content_view, metadata_map.content_view_version.description,
28
- path: path,
29
- metadata: metadata,
30
- importing: true,
31
- major: metadata_map.content_view_version.major,
32
- minor: metadata_map.content_view_version.minor)
33
- plan_self(content_view_id: import.content_view.id)
24
+ plan_action(AutoCreateRepositories, import: import, path: path)
25
+ plan_action(AutoCreateRedhatRepositories, import: import, path: path)
26
+
27
+ if metadata_map.syncable_format?
28
+ plan_action(::Actions::BulkAction,
29
+ ::Actions::Katello::Repository::Sync,
30
+ import.intersecting_repos_library_and_metadata.exportable(format: metadata_map.format),
31
+ skip_candlepin_check: true
32
+ )
33
+ end
34
+
35
+ if import.content_view
36
+ plan_action(ResetContentViewRepositoriesFromMetadata, import: import)
37
+ plan_action(::Actions::Katello::ContentView::Publish, import.content_view, metadata_map.content_view_version.description,
38
+ path: path,
39
+ metadata: metadata,
40
+ importing: !metadata_map.syncable_format?,
41
+ syncable: metadata_map.syncable_format?,
42
+ major: metadata_map.content_view_version.major,
43
+ minor: metadata_map.content_view_version.minor)
44
+ plan_self(content_view_id: import.content_view.id)
45
+ end
34
46
  end
35
47
  end
36
48
 
@@ -11,7 +11,7 @@ module Actions
11
11
  unless organization_destroy || product.user_deletable?
12
12
  if product.redhat?
13
13
  fail _("Cannot delete Red Hat product: %{product}") % { :product => product.name }
14
- elsif !product.published_content_view_versions.empty?
14
+ elsif !product.published_content_view_versions.not_ignorable.empty?
15
15
  fail _("Cannot delete product with repositories published in a content view. Product: %{product}, %{view_versions}") %
16
16
  { :product => product.name, :view_versions => view_versions(product) }
17
17
  end
@@ -23,7 +23,7 @@ module Actions
23
23
  repository,
24
24
  SmartProxy.pulp_primary)
25
25
 
26
- remove_versions(repository, repository.content_views.generated_for_none, affected_cvv_ids) if remove_from_content_view_versions
26
+ remove_versions(repository, repository.content_views_all(include_composite: true)&.generated_for_none, affected_cvv_ids) if remove_from_content_view_versions
27
27
 
28
28
  handle_alternate_content_sources(repository)
29
29
 
@@ -105,12 +105,12 @@ module Actions
105
105
 
106
106
  def remove_versions(repository, content_views, affected_cvv_ids)
107
107
  return if content_views.blank?
108
-
109
108
  interested_inverses = repository.
110
109
  library_instances_inverse.
111
110
  joins(:content_view_version => :content_view).
112
111
  merge(content_views)
113
- affected_cvv_ids.concat(interested_inverses.pluck(:content_view_version_id).uniq)
112
+ return if interested_inverses.blank?
113
+ affected_cvv_ids.concat(interested_inverses.pluck(:content_view_version_id)&.uniq)
114
114
  plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Destroy, interested_inverses)
115
115
  end
116
116
 
@@ -2,18 +2,21 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class ErrataMail < Actions::EntryAction
5
- middleware.use Actions::Middleware::ExecuteIfContentsChanged
6
-
7
- def plan(repo, contents_changed = nil)
8
- last_updated = repo.repository_errata.order('updated_at ASC').last.try(:updated_at) || Time.now
9
- plan_self(:repo => repo.id, :contents_changed => contents_changed, :last_updated => last_updated.to_s)
5
+ def plan(repo)
6
+ plan_self(:repo => repo.id, :associated_errata_before_syncing => repo.repository_errata.pluck(:erratum_id).uniq.sort.reverse, :new_associated_errata => [])
10
7
  end
11
8
 
12
9
  def run
13
10
  ::User.current = ::User.anonymous_admin
14
11
  repo = ::Katello::Repository.find(input[:repo])
12
+ input[:new_associated_errata] = repo.repository_errata.pluck(:erratum_id).uniq.sort.reverse - input[:associated_errata_before_syncing]
13
+
15
14
  users = ::User.select { |user| user.receives?(:sync_errata) && user.organization_ids.include?(repo.organization.id) && user.can?(:view_products, repo.product) }.compact
16
- errata = ::Katello::Erratum.where(:id => repo.repository_errata.where('katello_repository_errata.updated_at > ?', input['last_updated'].to_datetime).pluck(:erratum_id))
15
+ errata = ::Katello::Erratum.where(:id => input[:new_associated_errata])
16
+
17
+ [:associated_errata_before_syncing, :new_associated_errata].each do |key|
18
+ input[key] = "Trimmed list... (#{input[key].length} #{key.to_s.gsub('_', ' ')})" if input[key].length > 3
19
+ end
17
20
 
18
21
  begin
19
22
  MailNotification[:sync_errata].deliver(:users => users, :repo => repo, :errata => errata) unless (users.blank? || errata.blank?)
@@ -8,7 +8,7 @@ module Actions
8
8
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded,
9
9
  repo, SmartProxy.default_capsule!, :dependency => options[:dependency])
10
10
  repo.smart_proxy_alternate_content_sources.each do |smart_proxy_acs|
11
- plan_action(::Actions::Pulp3::Orchestration::AlternateContentSource::RefreshRemote, smart_proxy_acs)
11
+ plan_action(::Actions::Pulp3::AlternateContentSource::RefreshRemote, smart_proxy_acs)
12
12
  end
13
13
  plan_self(:name => repo.name, :dependency => options[:dependency])
14
14
  end
@@ -16,8 +16,6 @@ module Actions
16
16
  # @param repo
17
17
  # @param pulp_sync_task_id in case the sync was triggered outside
18
18
  # of Katello and we just need to finish the rest of the orchestration
19
- # rubocop:disable Metrics/MethodLength
20
- # rubocop:disable Metrics/CyclomaticComplexity
21
19
  def plan(repo, options = {})
22
20
  action_subject(repo)
23
21
 
@@ -26,9 +24,11 @@ module Actions
26
24
  skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && repo.yum?)
27
25
  generate_applicability = options.fetch(:generate_applicability, repo.yum? || repo.deb?)
28
26
 
29
- fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
30
- fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
31
- fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum repositories.") if skip_metadata_check && !repo.yum?
27
+ validate_repo!(repo: repo,
28
+ source_url: source_url,
29
+ validate_contents: validate_contents,
30
+ skip_metadata_check: skip_metadata_check,
31
+ skip_candlepin_check: options.fetch(:skip_candlepin_check, false))
32
32
 
33
33
  pulp_sync_options = {}
34
34
  pulp_sync_options[:download_policy] = ::Katello::RootRepository::DOWNLOAD_ON_DEMAND if validate_contents && repo.yum?
@@ -51,7 +51,7 @@ module Actions
51
51
  plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
52
52
  plan_action(Katello::Repository::CorrectChecksum, repo)
53
53
  concurrence do
54
- plan_action(Katello::Repository::ErrataMail, repo, output[:contents_changed])
54
+ plan_action(Katello::Repository::ErrataMail, repo)
55
55
  plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability
56
56
  end
57
57
  plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
@@ -82,6 +82,13 @@ module Actions
82
82
  end
83
83
  end
84
84
 
85
+ def validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:)
86
+ fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
87
+ fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
88
+ fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum repositories.") if skip_metadata_check && !repo.yum?
89
+ ::Katello::Util::CandlepinRepositoryChecker.check_repository_for_sync!(repo) if repo.yum? && !skip_candlepin_check
90
+ end
91
+
85
92
  def presenter
86
93
  found = all_planned_actions(Pulp3::Repository::Sync) if found.empty?
87
94
  found = all_planned_actions(Pulp3::Repository::Repair) if found.empty?
@@ -6,15 +6,19 @@ module Actions
6
6
  _("Enable")
7
7
  end
8
8
 
9
- def plan(product, content, options)
9
+ def plan(product, content, substitutions, override_url: nil)
10
10
  mapper = ::Katello::Candlepin::RepositoryMapper.new(product,
11
11
  content,
12
- options)
12
+ substitutions)
13
13
  mapper.validate!
14
14
  if mapper.find_repository
15
15
  fail ::Katello::Errors::ConflictException, _("The repository is already enabled")
16
16
  end
17
17
  repository = mapper.build_repository
18
+ if override_url
19
+ repository.root.url = override_url
20
+ repository.root.download_policy = ::Katello::RootRepository::DOWNLOAD_IMMEDIATE if URI(override_url).scheme == 'file'
21
+ end
18
22
  plan_action(Repository::Create, repository, clone: false)
19
23
  action_subject(repository)
20
24
  plan_self
@@ -0,0 +1,16 @@
1
+ module Actions
2
+ module Pulp3
3
+ module AlternateContentSource
4
+ class RefreshRemote < Pulp3::AbstractAsyncTask
5
+ def plan(smart_proxy_acs)
6
+ plan_self(smart_proxy_acs_id: smart_proxy_acs.id, smart_proxy_id: smart_proxy_acs.smart_proxy_id)
7
+ end
8
+
9
+ def invoke_external_task
10
+ smart_proxy_acs = ::Katello::SmartProxyAlternateContentSource.find(input[:smart_proxy_acs_id])
11
+ smart_proxy_acs.backend_service.update_remote
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -5,6 +5,7 @@ module Actions
5
5
  class Refresh < Pulp3::Abstract
6
6
  def plan(smart_proxy_acs)
7
7
  sequence do
8
+ plan_action(Actions::Pulp3::AlternateContentSource::RefreshRemote, smart_proxy_acs)
8
9
  plan_action(Actions::Pulp3::AlternateContentSource::Refresh, smart_proxy_acs)
9
10
  end
10
11
  end
@@ -14,7 +14,7 @@ module Actions
14
14
  organization: organization,
15
15
  create_by_default: true,
16
16
  format: format)
17
- repo_ids_in_library = organization.default_content_view_version.repositories.exportable.immediate_or_none.pluck(:id)
17
+ repo_ids_in_library = organization.default_content_view_version.repositories.exportable(format: format).immediate_or_none.pluck(:id)
18
18
  content_view.update!(repository_ids: repo_ids_in_library)
19
19
 
20
20
  sequence do
@@ -9,7 +9,7 @@ module Actions
9
9
  format: ::Katello::Pulp3::ContentViewVersion::Export::IMPORTABLE)
10
10
  action_subject(repository)
11
11
  validate_repositories_immediate!(repository)
12
-
12
+ validate_export_types!(repository, format)
13
13
  content_view = ::Katello::Pulp3::ContentViewVersion::Export.find_repository_export_view(
14
14
  repository: repository,
15
15
  create_by_default: true,
@@ -40,13 +40,21 @@ module Actions
40
40
  end
41
41
 
42
42
  def validate_repositories_immediate!(repository)
43
- unless repository.immediate?
43
+ unless repository.download_policy.blank? || repository.immediate?
44
44
  fail _("NOTE: Unable to fully export repository '%{repository}' because"\
45
45
  " it does not have the 'immediate' download policy."\
46
46
  " Update the download policy and sync the affected repository to include them in the export."\
47
47
  % { repository: repository.name })
48
48
  end
49
49
  end
50
+
51
+ def validate_export_types!(repository, format)
52
+ unless ::Katello::Repository.exportable(format: format).where(id: repository.id).exists?
53
+ fail _("NOTE: Unable to export repository '%{repository}' because"\
54
+ " it does not have an exportable content type."\
55
+ % { repository: repository.name })
56
+ end
57
+ end
50
58
  end
51
59
  end
52
60
  end
@@ -11,7 +11,8 @@ module Katello
11
11
  content_view = host.try(:content_facet).try(:content_view) || host.try(:content_view)
12
12
 
13
13
  if content_view && host.operatingsystem.is_a?(Redhat) &&
14
- host.operatingsystem.kickstart_repos(host).first.present?
14
+ host.operatingsystem.kickstart_repos(host).first.present? &&
15
+ host&.content_facet&.kickstart_repository.present?
15
16
  @mediapath ||= host.operatingsystem.mediumpath(medium_provider)
16
17
  end
17
18
  end
@@ -130,8 +130,8 @@ module Katello
130
130
 
131
131
  class UpstreamConsumerGone < StandardError
132
132
  def message
133
- _("The Subscription Allocation providing the imported manifest has been removed. " \
134
- "Please create a new Subscription Allocation and import the new manifest.")
133
+ _("The manifest doesn't exist on console.redhat.com. " \
134
+ "Please create and import a new manifest.")
135
135
  end
136
136
  end
137
137
 
@@ -89,10 +89,16 @@ module Katello
89
89
  delegate :[], to: :json_resource
90
90
 
91
91
  def resource(url = self.site + self.path, client_cert = self.client_cert, client_key = self.client_key, ca_file = nil, options = {})
92
+ cert_store = OpenSSL::X509::Store.new
93
+ cert_store.add_file(ca_file) if ca_file
94
+
95
+ if proxy&.cacert
96
+ Foreman::Util.add_ca_bundle_to_store(proxy.cacert, cert_store)
97
+ end
92
98
  RestClient::Resource.new(url,
93
99
  :ssl_client_cert => OpenSSL::X509::Certificate.new(client_cert),
94
100
  :ssl_client_key => OpenSSL::PKey::RSA.new(client_key),
95
- :ssl_ca_file => ca_file,
101
+ :ssl_cert_store => cert_store,
96
102
  :verify_ssl => ca_file ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE,
97
103
  :open_timeout => Setting[:manifest_refresh_timeout],
98
104
  :timeout => Setting[:manifest_refresh_timeout],
@@ -33,19 +33,9 @@ module Katello
33
33
  results = json_body['results']
34
34
 
35
35
  results.map do |repo|
36
- arch = repo['arch']
37
- arch = nil if arch == "noarch"
38
- substitutions = {
39
- :releasever => repo['minor'],
40
- :basearch => arch
41
- }.compact
42
- path = substitutions.inject(content_path) do |path_url, (key, value)|
43
- path_url.gsub("$#{key}", value)
44
- end
45
- {
46
- path: path,
47
- substitutions: substitutions
48
- }
36
+ Katello::Content.substitute_content_path(arch: repo[:arch],
37
+ releasever: repo[:minor],
38
+ content_path: content_path)
49
39
  end
50
40
  end
51
41
 
@@ -38,17 +38,19 @@ module Katello
38
38
  :username,
39
39
  :password,
40
40
  :organization_label,
41
- :ssl_ca_cert)
41
+ :ssl_ca_cert,
42
+ :custom_cdn)
42
43
 
43
44
  if options[:ssl_ca_cert].present?
44
- begin
45
- ca_cert = OpenSSL::X509::Certificate.new(options[:ssl_ca_cert])
46
- rescue
47
- raise _("Invalid SSL CA certificate given for CDN")
48
- end
49
-
50
45
  @cert_store = OpenSSL::X509::Store.new
51
- @cert_store.add_cert(ca_cert)
46
+ Foreman::Util.add_ca_bundle_to_store(options[:ssl_ca_cert], @cert_store)
47
+ elsif options[:ssl_ca_file]
48
+ @cert_store = OpenSSL::X509::Store.new
49
+ @cert_store.add_file(options[:ssl_ca_file])
50
+ end
51
+
52
+ if @cert_store && proxy&.cacert
53
+ Foreman::Util.add_ca_bundle_to_store(proxy.cacert, @cert_store)
52
54
  end
53
55
 
54
56
  @url = url
@@ -63,6 +65,9 @@ module Katello
63
65
  options[:ssl_client_key] = OpenSSL::PKey::RSA.new(product.key)
64
66
  options[:ssl_ca_file] = self.ca_file
65
67
  self.new(cdn_configuration.url, options)
68
+ elsif cdn_configuration.custom_cdn?
69
+ options[:ssl_ca_cert] = cdn_configuration.ssl_ca
70
+ self.new(cdn_configuration.url, options)
66
71
  else
67
72
  options[:username] = cdn_configuration.username
68
73
  options[:password] = cdn_configuration.password
@@ -91,9 +96,9 @@ module Katello
91
96
  net.use_ssl = @uri.is_a?(URI::HTTPS)
92
97
 
93
98
  if @uri.is_a?(URI::HTTPS)
99
+ net.cert_store = @cert_store
94
100
  net.cert = @options[:ssl_client_cert]
95
101
  net.key = @options[:ssl_client_key]
96
- net.ca_file = @options[:ssl_ca_file]
97
102
  net.cert_store = @cert_store
98
103
  end
99
104
 
@@ -0,0 +1,73 @@
1
+ module Katello
2
+ module Util
3
+ module CandlepinRepositoryChecker
4
+ def self.check_repositories_for_promote!(content_view_version)
5
+ bad_repo = content_view_version.repositories.yum_type.find { |repo| !repository_exist_in_backend?(repo) }
6
+ return if bad_repo.blank?
7
+ item = _("Content View Version: '%{cvv}', Product: '%{product}', Repository: '%{repo}' " %
8
+ { repo: bad_repo.name, product: bad_repo.product.name, cvv: content_view_version.name })
9
+
10
+ if bad_repo.redhat?
11
+ fail _("'%{item}' does not exist in the backend system [ Candlepin ]. "\
12
+ " Either remove the invalid repository or try refreshing "\
13
+ "the manifest before promoting. " % { item: item })
14
+ else
15
+ fail _("'%{item}' does not exist in the backend system [ Candlepin ]. "\
16
+ " Remove the invalid repository before promoting. " % { item: item })
17
+ end
18
+ end
19
+
20
+ def self.check_repository_for_sync!(repo)
21
+ return if !repo.yum? || repository_exist_in_backend?(repo)
22
+ item = _("Product: '%{product}', Repository: '%{repo}' " %
23
+ { repo: repo.name, product: repo.product.name })
24
+
25
+ if repo.redhat?
26
+ fail _("'%{item}' does not exist in the backend system [ Candlepin ]. "\
27
+ " Either remove and re-enable the repository or try refreshing "\
28
+ "the manifest before synchronizing. " % { item: item })
29
+ else
30
+ fail _("'%{item}' does not exist in the backend system [ Candlepin ]. "\
31
+ " Remove and recreate the repository before synchronizing. " % { item: item })
32
+ end
33
+ end
34
+
35
+ def self.repository_exist_in_backend?(repository)
36
+ ::Katello::Resources::Candlepin::Content.get(repository.organization.label, repository.root.content_id)
37
+ true
38
+ rescue RestClient::NotFound
39
+ false
40
+ end
41
+
42
+ def self.check_repositories_for_publish!(content_view)
43
+ if content_view.composite?
44
+ content_view.components.each do |cvv|
45
+ check_repositories_for_content_view_publish!(cvv.repositories, component_version: cvv)
46
+ end
47
+ else
48
+ check_repositories_for_content_view_publish!(content_view.repositories)
49
+ end
50
+ end
51
+
52
+ def self.check_repositories_for_content_view_publish!(repositories, component_version: nil)
53
+ bad_repo = repositories.yum_type.find { |repo| !repository_exist_in_backend?(repo) }
54
+ return if bad_repo.blank?
55
+ if component_version
56
+ item = _("Component Version: '%{cvv}', Product: '%{product}', Repository: '%{repo}' " %
57
+ { repo: bad_repo.name, product: bad_repo.product.name, cvv: component_version.name })
58
+ else
59
+ item = _("Product: '%{product}', Repository: '%{repo}' " %
60
+ { repo: bad_repo.name, product: bad_repo.product.name })
61
+ end
62
+ if bad_repo.redhat?
63
+ fail _("'%{item}' in this content view does not exist in the backend system [ Candlepin ]. "\
64
+ " Either remove the invalid repository or try refreshing "\
65
+ "the manifest before publishing again. " % { item: item })
66
+ else
67
+ fail _("'%{item}' in this content view does not exist in the backend system [ Candlepin ]. "\
68
+ " Remove the invalid repository before publishing again. " % { item: item })
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -28,7 +28,7 @@ module Katello
28
28
  alias_method :lifecycle_environment, :environment
29
29
 
30
30
  before_validation :set_default_content_view, :unless => :persisted?
31
-
31
+ before_destroy :validate_destroyable!
32
32
  accepts_nested_attributes_for :purpose_addons
33
33
 
34
34
  validates_lengths_from_database
@@ -177,6 +177,17 @@ module Katello
177
177
  return_activation_keys_by_id(activation_keys.pluck(:id))
178
178
  end
179
179
 
180
+ def validate_destroyable!
181
+ unless organization.being_deleted?
182
+ if Parameter.where(name: 'kt_activation_keys').pluck(:value).any? { |value| value.split(",").include?(name) }
183
+ fail _("This activation key is associated to one or more Hosts/Hostgroups. "\
184
+ "Search and unassociate Hosts/Hostgroups using params.kt_activation_keys ~ \"%{name}\" "\
185
+ "before deleting." % {name: name})
186
+ end
187
+ end
188
+ true
189
+ end
190
+
180
191
  private
181
192
 
182
193
  def set_default_content_view
@@ -10,7 +10,7 @@ module Katello
10
10
 
11
11
  self.table_name = :katello_alternate_content_sources
12
12
 
13
- ACS_TYPES = %w(custom simplified).freeze
13
+ ACS_TYPES = %w(custom simplified rhui).freeze
14
14
  CONTENT_TYPES = [::Katello::Repository::YUM_TYPE, ::Katello::Repository::FILE_TYPE].freeze
15
15
  AUDIT_REFRESH_ACTION = 'refresh'.freeze
16
16
 
@@ -19,7 +19,6 @@ module Katello
19
19
  belongs_to :ssl_ca_cert, inverse_of: :ssl_ca_alternate_content_sources, class_name: "Katello::ContentCredential"
20
20
  belongs_to :ssl_client_cert, inverse_of: :ssl_client_alternate_content_sources, class_name: "Katello::ContentCredential"
21
21
  belongs_to :ssl_client_key, inverse_of: :ssl_key_alternate_content_sources, class_name: "Katello::ContentCredential"
22
- belongs_to :http_proxy, inverse_of: :alternate_content_sources
23
22
 
24
23
  has_many :alternate_content_source_products, dependent: :delete_all, inverse_of: :alternate_content_source,
25
24
  class_name: "Katello::AlternateContentSourceProduct"
@@ -32,8 +31,10 @@ module Katello
32
31
 
33
32
  validates :base_url, :subpaths, :verify_ssl, :upstream_username,
34
33
  :upstream_password, :ssl_ca_cert, :ssl_client_cert, :ssl_client_key, if: :simplified?, absence: true
35
- validates :base_url, if: :custom?, presence: true
36
- validates :products, if: :custom?, absence: true
34
+ validates :base_url, if: -> { custom? || rhui? }, presence: true
35
+ validates :products, if: -> { custom? || rhui? }, absence: true
36
+ validates :label, :uniqueness => true
37
+ validates :name, :uniqueness => true
37
38
  validates :verify_ssl, if: :custom?, exclusion: [nil]
38
39
  validates :alternate_content_source_type, inclusion: {
39
40
  in: ->(_) { ACS_TYPES },
@@ -47,6 +48,8 @@ module Katello
47
48
  }
48
49
  validates_with Validators::AlternateContentSourcePathValidator, :attributes => [:base_url, :subpaths], :if => :custom?
49
50
 
51
+ scope :uses_http_proxies, -> { where(use_http_proxies: true) }
52
+
50
53
  scoped_search on: :name, complete_value: true
51
54
  scoped_search on: :label, complete_value: true
52
55
  scoped_search on: :description, complete_value: true
@@ -72,6 +75,10 @@ module Katello
72
75
  alternate_content_source_type == 'simplified'
73
76
  end
74
77
 
78
+ def rhui?
79
+ alternate_content_source_type == 'rhui'
80
+ end
81
+
75
82
  def self.with_products(products)
76
83
  products = [products] unless products.is_a?(Array)
77
84
  joins(:alternate_content_source_products).where('katello_alternate_content_source_products.product_id in (:product_ids)', product_ids: products.pluck(:id))
@@ -98,5 +105,9 @@ module Katello
98
105
  def audit_updated_products(old_product_ids)
99
106
  write_audit(action: 'update', comment: _('Products updated.'), audited_changes: { 'product_ids' => [old_product_ids, product_ids] })
100
107
  end
108
+
109
+ def self.humanize_class_name
110
+ "Alternate Content Sources"
111
+ end
101
112
  end
102
113
  end
@@ -5,7 +5,7 @@ module Katello
5
5
  self.table_name = :katello_alternate_content_source_products
6
6
  belongs_to :alternate_content_source, inverse_of: :alternate_content_source_products, class_name: 'Katello::AlternateContentSource'
7
7
  belongs_to :product, inverse_of: :alternate_content_source_products, class_name: 'Katello::Product'
8
- delegate :custom?, to: :alternate_content_source
8
+ delegate :custom?, :rhui?, to: :alternate_content_source
9
9
  delegate :simplified?, to: :alternate_content_source
10
10
 
11
11
  validates_with Validators::AlternateContentSourceProductsValidator, :attributes => [:product_id], if: :simplified?
@@ -6,12 +6,12 @@ module Katello
6
6
 
7
7
  def deletable?(remove_from_content_view_versions = true)
8
8
  return false unless product.editable?
9
- remove_from_content_view_versions || !promoted? || (self.content_views.exists? && !self.content_views.generated_for_none.exists?)
9
+ remove_from_content_view_versions || !promoted? || (self.content_views_all(include_composite: true).exists? && !self.content_views_all(include_composite: true).generated_for_none.exists?)
10
10
  end
11
11
 
12
12
  def redhat_deletable?(remove_from_content_view_versions = false)
13
13
  return false unless product.editable?
14
- remove_from_content_view_versions || !self.promoted? || (self.content_views.exists? && !self.content_views.generated_for_none.exists?)
14
+ remove_from_content_view_versions || !self.promoted? || (self.content_views_all(include_composite: true).exists? && !self.content_views_all(include_composite: true).generated_for_none.exists?)
15
15
  end
16
16
 
17
17
  def readable?
@@ -5,8 +5,9 @@ module Katello
5
5
  CDN_TYPE = 'redhat_cdn'.freeze
6
6
  NETWORK_SYNC = 'network_sync'.freeze
7
7
  EXPORT_SYNC = 'export_sync'.freeze
8
+ CUSTOM_CDN_TYPE = 'custom_cdn'.freeze
8
9
 
9
- TYPES = [CDN_TYPE, NETWORK_SYNC, EXPORT_SYNC].freeze
10
+ TYPES = [CDN_TYPE, NETWORK_SYNC, EXPORT_SYNC, CUSTOM_CDN_TYPE].freeze
10
11
 
11
12
  belongs_to :organization, :inverse_of => :cdn_configuration
12
13
 
@@ -32,6 +33,14 @@ module Katello
32
33
  type == CDN_TYPE
33
34
  end
34
35
 
36
+ def custom_cdn?
37
+ type == CUSTOM_CDN_TYPE
38
+ end
39
+
40
+ def redhat_cdn_url?
41
+ Katello::Resources::CDN::CdnResource.redhat_cdn?(url)
42
+ end
43
+
35
44
  def export_sync?
36
45
  type == EXPORT_SYNC
37
46
  end
@@ -46,11 +55,11 @@ module Katello
46
55
  return if network_sync?
47
56
 
48
57
  self.url = nil if export_sync?
49
- self.url ||= SETTINGS[:katello][:redhat_repository_url] if redhat_cdn?
58
+ self.url = SETTINGS[:katello][:redhat_repository_url] if redhat_cdn?
50
59
  self.username = nil
51
60
  self.password = nil
52
61
  self.upstream_organization_label = nil
53
- self.ssl_ca_credential_id = nil
62
+ self.ssl_ca_credential_id = nil unless custom_cdn?
54
63
  self.upstream_content_view_label = nil
55
64
  self.upstream_lifecycle_environment_label = nil
56
65
  self.ssl_cert = nil
@@ -10,6 +10,12 @@ module Katello
10
10
  (content_source_id.blank? || (content_facet && content_facet.kickstart_repository.blank?)) && super
11
11
  end
12
12
 
13
+ def inherited_attributes
14
+ inherited_attrs = super
15
+ inherited_attrs.delete('medium_id') if content_facet && !content_facet.kickstart_repository.blank?
16
+ inherited_attrs
17
+ end
18
+
13
19
  def smart_proxy_ids
14
20
  ids = super
15
21
  ids << content_source_id
@@ -410,7 +416,7 @@ module Katello
410
416
  ::Katello::HostTracer.helpers_for(traces)
411
417
  end
412
418
 
413
- def package_names_for_job_template(action:, search:)
419
+ def package_names_for_job_template(action:, search:, versions: nil)
414
420
  actions = %w(install remove update).freeze
415
421
  case action
416
422
  when 'install'
@@ -422,9 +428,16 @@ module Katello
422
428
  when 'update'
423
429
  return [] if search.empty?
424
430
 
431
+ versions_by_name = {}
432
+ if versions.present?
433
+ JSON.parse(versions).each do |nvra|
434
+ nvra =~ /([^\.]*)-\d+\.[-\.\w]*/
435
+ versions_by_name[Regexp.last_match(1)] = nvra
436
+ end
437
+ end
425
438
  pkg_names = installed_packages.search_for(search).distinct.pluck(:name)
426
439
  upgrades = ::Katello::Rpm.installable_for_hosts([self]).select(:id, :name, :nvra, :evr).order(evr: :desc).group_by(&:name)
427
- pkg_names.map { |p| upgrades[p]&.first&.nvra }.compact
440
+ pkg_names.map { |p| versions_by_name[p] || upgrades[p]&.first&.nvra }.compact
428
441
  else
429
442
  fail ::Foreman::Exception.new(N_("package_names_for_job_template: Action must be one of %s"), actions.join(', '))
430
443
  end