katello 4.3.1 → 4.4.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 (309) 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/api_controller.rb +13 -4
  4. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
  5. data/app/controllers/katello/api/v2/content_views_controller.rb +46 -0
  6. data/app/controllers/katello/api/v2/host_packages_controller.rb +21 -1
  7. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +30 -1
  8. data/app/controllers/katello/api/v2/organizations_controller.rb +10 -6
  9. data/app/controllers/katello/api/v2/packages_controller.rb +4 -0
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +15 -6
  11. data/app/controllers/katello/api/v2/repository_sets_controller.rb +7 -0
  12. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +3 -0
  13. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +32 -0
  14. data/app/helpers/katello/content_source_helper.rb +43 -0
  15. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +4 -0
  16. data/app/lib/actions/katello/cdn_configuration/update.rb +5 -7
  17. data/app/lib/actions/katello/repository/discover.rb +1 -14
  18. data/app/lib/actions/katello/repository/filtered_index_content.rb +1 -1
  19. data/app/lib/katello/concerns/base_template_scope_extensions.rb +11 -0
  20. data/app/lib/katello/errors.rb +3 -3
  21. data/app/lib/katello/logging.rb +6 -1
  22. data/app/lib/katello/repo_discovery.rb +27 -19
  23. data/app/lib/katello/resources/cdn/katello_cdn.rb +41 -3
  24. data/app/lib/katello/resources/cdn.rb +3 -1
  25. data/app/lib/katello/util/deduplication_migrator.rb +105 -0
  26. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  27. data/app/models/katello/cdn_configuration.rb +38 -6
  28. data/app/models/katello/concerns/host_managed_extensions.rb +23 -1
  29. data/app/models/katello/concerns/organization_extensions.rb +5 -1
  30. data/app/models/katello/concerns/pulp_database_unit.rb +59 -173
  31. data/app/models/katello/concerns/remote_execution_proxy_selector_extensions.rb +11 -0
  32. data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -1
  33. data/app/models/katello/content_view.rb +4 -4
  34. data/app/models/katello/content_view_filter.rb +1 -1
  35. data/app/models/katello/content_view_history.rb +1 -1
  36. data/app/models/katello/content_view_version.rb +6 -2
  37. data/app/models/katello/content_view_version_export_history.rb +1 -1
  38. data/app/models/katello/deb.rb +1 -3
  39. data/app/models/katello/erratum.rb +0 -15
  40. data/app/models/katello/glue/pulp/repos.rb +1 -1
  41. data/app/models/katello/host/content_facet.rb +2 -27
  42. data/app/models/katello/host/info_provider.rb +9 -0
  43. data/app/models/katello/host/subscription_facet.rb +2 -2
  44. data/app/models/katello/hostgroup/content_facet.rb +2 -2
  45. data/app/models/katello/product.rb +1 -1
  46. data/app/models/katello/product_content.rb +2 -2
  47. data/app/models/katello/repository.rb +5 -9
  48. data/app/models/katello/root_repository.rb +24 -13
  49. data/app/models/katello/rpm.rb +8 -2
  50. data/app/models/setting/content.rb +6 -3
  51. data/app/services/katello/content_unit_indexer.rb +166 -0
  52. data/app/services/katello/organization_creator.rb +12 -4
  53. data/app/services/katello/pulp/repository/docker.rb +1 -1
  54. data/app/services/katello/pulp/repository/yum.rb +0 -54
  55. data/app/services/katello/pulp/repository.rb +0 -6
  56. data/app/services/katello/pulp3/ansible_collection.rb +26 -10
  57. data/app/services/katello/pulp3/api/apt.rb +7 -0
  58. data/app/services/katello/pulp3/deb.rb +10 -9
  59. data/app/services/katello/pulp3/docker_manifest.rb +6 -5
  60. data/app/services/katello/pulp3/docker_manifest_list.rb +23 -6
  61. data/app/services/katello/pulp3/docker_tag.rb +16 -7
  62. data/app/services/katello/pulp3/erratum.rb +51 -64
  63. data/app/services/katello/pulp3/file_unit.rb +9 -6
  64. data/app/services/katello/pulp3/generic_content_unit.rb +9 -11
  65. data/app/services/katello/pulp3/module_stream.rb +76 -30
  66. data/app/services/katello/pulp3/package_group.rb +5 -5
  67. data/app/services/katello/pulp3/pulp_content_unit.rb +14 -4
  68. data/app/services/katello/pulp3/repository/apt.rb +5 -3
  69. data/app/services/katello/pulp3/repository/docker.rb +14 -7
  70. data/app/services/katello/pulp3/repository/generic.rb +1 -1
  71. data/app/services/katello/pulp3/repository/yum.rb +0 -10
  72. data/app/services/katello/pulp3/repository.rb +15 -3
  73. data/app/services/katello/pulp3/repository_mirror.rb +18 -5
  74. data/app/services/katello/pulp3/rpm.rb +13 -13
  75. data/app/services/katello/pulp3/srpm.rb +10 -9
  76. data/app/services/katello/repository_type.rb +15 -4
  77. data/app/services/katello/repository_type_manager.rb +1 -1
  78. data/app/services/katello/ui_notifications/subscriptions/manifest_expired_warning.rb +1 -1
  79. data/app/services/katello/upstream_connection_checker.rb +2 -2
  80. data/app/views/foreman/job_templates/change_content_source.erb +1 -31
  81. data/app/views/foreman/job_templates/install_packages_by_search_query.erb +19 -0
  82. data/app/views/katello/api/v2/cdn_configurations/show.json.rabl +1 -1
  83. data/app/views/katello/api/v2/environments/show.json.rabl +9 -0
  84. data/app/views/katello/api/v2/repositories/show.json.rabl +2 -0
  85. data/app/views/katello/layouts/react.html.erb +0 -1
  86. data/app/views/katello/sync_management/_repo.html.erb +36 -25
  87. data/config/initializers/monkeys.rb +0 -1
  88. data/config/routes/api/v2.rb +1 -0
  89. data/config/routes/overrides.rb +3 -0
  90. data/config/routes.rb +2 -0
  91. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  92. data/db/migrate/20180612164926_add_content_org_id.rb +2 -2
  93. data/db/migrate/20211019192121_create_cdn_configuration.katello.rb +2 -11
  94. data/db/migrate/20211201154845_add_unique_indexes.rb +20 -0
  95. data/db/migrate/20211208034230_add_content_view_and_lifecycle_environment.rb +6 -0
  96. data/db/migrate/20211220185935_clean_duplicate_content_units.rb +144 -0
  97. data/db/migrate/20220110223754_update_disconnected_settings.rb +20 -0
  98. data/db/migrate/20220120163252_fix_docker_download_policy.rb +11 -0
  99. data/db/migrate/20220124191056_add_type_to_cdn_configuration.rb +22 -0
  100. data/db/migrate/20220127120843_fix_debian_download_policy.rb +11 -0
  101. data/db/migrate/20220204171908_rename_docker_tags_whitelist_and_add_exclude_tags.rb +8 -0
  102. data/db/migrate/20220207140355_change_deb_attributes_size_limit.rb +7 -0
  103. data/engines/bastion/app/views/bastion/layouts/application.html.erb +0 -1
  104. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +0 -1
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/content-credentials.controller.js +1 -1
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-products.controller.js +1 -1
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/content-credential-repositories.controller.js +1 -1
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-traces-modal.html +1 -1
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment.html +26 -1
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +212 -152
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +20 -8
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +8 -3
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +34 -30
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +16 -2
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +35 -15
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +5 -4
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.routes.js +4 -3
  118. data/lib/katello/engine.rb +4 -0
  119. data/lib/katello/permission_creator.rb +1 -1
  120. data/lib/katello/permissions/host_permissions.rb +3 -1
  121. data/lib/katello/plugin.rb +3 -1
  122. data/lib/katello/repository_types/deb.rb +0 -1
  123. data/lib/katello/repository_types/docker.rb +4 -4
  124. data/lib/katello/repository_types/file.rb +0 -1
  125. data/lib/katello/repository_types/ostree.rb +2 -0
  126. data/lib/katello/repository_types/python.rb +5 -1
  127. data/lib/katello/repository_types/yum.rb +2 -9
  128. data/lib/katello/tasks/import_applicability.rake +1 -1
  129. data/lib/katello/tasks/jenkins.rake +0 -2
  130. data/lib/katello/tasks/repository.rake +4 -1
  131. data/lib/katello/version.rb +1 -1
  132. data/locale/action_names.rb +8 -7
  133. data/locale/bn/katello.po +1402 -650
  134. data/locale/cs/katello.po +1217 -96
  135. data/locale/de/katello.po +2359 -1347
  136. data/locale/en/katello.po +1216 -94
  137. data/locale/es/katello.po +2201 -1172
  138. data/locale/fr/katello.po +2601 -1615
  139. data/locale/gu/katello.po +1564 -814
  140. data/locale/hi/katello.po +1563 -810
  141. data/locale/it/katello.po +1311 -282
  142. data/locale/ja/katello.po +2534 -1518
  143. data/locale/katello.pot +3430 -1326
  144. data/locale/kn/katello.po +1564 -812
  145. data/locale/ko/katello.po +1441 -409
  146. data/locale/mr/katello.po +1564 -776
  147. data/locale/or/katello.po +1565 -813
  148. data/locale/pa/katello.po +1559 -792
  149. data/locale/pt/katello.po +1314 -277
  150. data/locale/pt_BR/katello.po +2226 -1181
  151. data/locale/ru/katello.po +1587 -563
  152. data/locale/ta/katello.po +1373 -619
  153. data/locale/te/katello.po +1564 -810
  154. data/locale/zh_CN/katello.po +2936 -1890
  155. data/locale/zh_TW/katello.po +1508 -606
  156. data/webpack/__mocks__/foremanReact/{redux/actions/toasts.js → components/ToastsList/index.js} +3 -2
  157. data/webpack/components/ActionableDetail.js +35 -21
  158. data/webpack/components/Content/Details/__tests__/ContentDetailInfo.test.js +0 -2
  159. data/webpack/components/Content/Details/__tests__/ContentDetailRepositories.test.js +0 -2
  160. data/webpack/components/Content/Details/__tests__/ContentDetails.test.js +0 -2
  161. data/webpack/components/Content/__tests__/ContentPage.test.js +0 -2
  162. data/webpack/components/Content/__tests__/ContentTable.test.js +0 -2
  163. data/webpack/components/EditableSwitch.js +8 -2
  164. data/webpack/components/EditableTextInput/EditableTextInput.js +44 -86
  165. data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +3 -3
  166. data/webpack/components/Errata/index.js +19 -11
  167. data/webpack/components/Packages/index.js +1 -1
  168. data/webpack/components/Search/Search.js +5 -2
  169. data/webpack/components/Search/__tests__/search.test.js +2 -3
  170. data/webpack/components/SelectOrg/SetOrganization.js +1 -1
  171. data/webpack/components/Table/PageControls.js +3 -6
  172. data/webpack/components/Table/TableHooks.js +46 -7
  173. data/webpack/components/Table/TableWrapper.js +14 -3
  174. data/webpack/components/TypeAhead/TypeAhead.js +5 -1
  175. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +4 -1
  176. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +2 -1
  177. data/webpack/components/WithOrganization/withOrganization.js +0 -1
  178. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard.js +1 -1
  179. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +3 -4
  180. data/webpack/components/extensions/HostDetails/HostDetailsActions.js +2 -0
  181. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesActions.js +18 -2
  182. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesConstants.js +12 -0
  183. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +1 -1
  184. data/webpack/components/extensions/HostDetails/Tabs/{ErrataTab.js → ErrataTab/ErrataTab.js} +30 -21
  185. data/webpack/components/extensions/HostDetails/Tabs/{ErrataTab.scss → ErrataTab/ErrataTab.scss} +0 -0
  186. data/webpack/components/extensions/HostDetails/Tabs/{ErratumExpansionContents.js → ErrataTab/ErratumExpansionContents.js} +0 -0
  187. data/webpack/components/extensions/HostDetails/Tabs/{ErratumExpansionDetail.js → ErrataTab/ErratumExpansionDetail.js} +0 -0
  188. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataActions.js +3 -3
  189. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataConstants.js +11 -0
  190. data/webpack/components/extensions/HostDetails/{HostErrata → Tabs/ErrataTab}/HostErrataSelectors.js +0 -0
  191. data/webpack/components/extensions/HostDetails/Tabs/PackageInstallModal.js +279 -0
  192. data/webpack/components/extensions/HostDetails/Tabs/PackageInstallModal.scss +3 -0
  193. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +125 -8
  194. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +25 -2
  195. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
  196. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +6 -3
  197. data/webpack/components/extensions/HostDetails/Tabs/{EnableTracerEmptyState.js → TracesTab/EnableTracerEmptyState.js} +0 -0
  198. data/webpack/components/extensions/HostDetails/Tabs/{EnableTracerModal.js → TracesTab/EnableTracerModal.js} +3 -2
  199. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesActions.js → TracesTab/HostTracesActions.js} +2 -2
  200. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesConstants.js → TracesTab/HostTracesConstants.js} +0 -0
  201. data/webpack/components/extensions/HostDetails/Tabs/{HostTracesSelectors.js → TracesTab/HostTracesSelectors.js} +0 -0
  202. data/webpack/components/extensions/HostDetails/Tabs/{TracesTab.js → TracesTab/TracesTab.js} +8 -5
  203. data/webpack/components/extensions/HostDetails/Tabs/{TracesTab.scss → TracesTab/TracesTab.scss} +0 -0
  204. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +12 -13
  205. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +385 -0
  206. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +1 -1
  207. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +58 -7
  208. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +2 -2
  209. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +4 -4
  210. data/webpack/components/extensions/HostDetails/Tabs/__tests__/yumInstallablePackages.fixtures.json +72 -0
  211. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +11 -4
  212. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesActions.js +18 -0
  213. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesConstants.js +3 -0
  214. data/webpack/components/extensions/HostDetails/YumInstallablePackages/YumInstallablePackagesSelectors.js +16 -0
  215. data/webpack/components/extensions/HostDetails/hostDetailsHelpers.js +19 -0
  216. data/webpack/components/pf3Table/components/Table.js +2 -3
  217. data/webpack/components/pf3Table/components/Table.test.js +0 -3
  218. data/webpack/components/pf3Table/components/__snapshots__/Table.test.js.snap +9 -8
  219. data/webpack/containers/Application/config.js +5 -0
  220. data/webpack/global_index.js +1 -1
  221. data/webpack/global_test_setup.js +1 -1
  222. data/webpack/index.js +7 -0
  223. data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetails.test.js +0 -2
  224. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionPage.test.js +0 -2
  225. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsTable.test.js +0 -2
  226. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +4 -4
  227. data/webpack/scenes/Content/__tests__/contentTable.test.js +3 -3
  228. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +6 -6
  229. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +2 -2
  230. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +11 -18
  231. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +8 -3
  232. data/webpack/scenes/ContentViews/Details/DetailsContainer.js +11 -16
  233. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetails.js +2 -2
  234. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +14 -8
  235. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +2 -2
  236. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +2 -3
  237. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +2 -9
  238. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +3 -5
  239. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +2 -10
  240. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +2 -3
  241. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +2 -3
  242. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +2 -2
  243. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +23 -2
  244. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +11 -5
  245. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +6 -6
  246. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +1 -0
  247. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +13 -15
  248. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +4 -4
  249. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +2 -2
  250. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +5 -3
  251. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  252. data/webpack/scenes/Hosts/ChangeContentSource/actions.js +43 -0
  253. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +87 -0
  254. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js +90 -0
  255. data/webpack/scenes/Hosts/ChangeContentSource/components/FormField.js +43 -0
  256. data/webpack/scenes/Hosts/ChangeContentSource/constants.js +3 -0
  257. data/webpack/scenes/Hosts/ChangeContentSource/helpers.js +27 -0
  258. data/webpack/scenes/Hosts/ChangeContentSource/index.js +126 -0
  259. data/webpack/scenes/Hosts/ChangeContentSource/selectors.js +42 -0
  260. data/webpack/scenes/Hosts/ChangeContentSource/styles.scss +11 -0
  261. data/webpack/scenes/ModuleStreams/Details/Profiles/__tests__/ModuleStreamDetailProfiles.test.js +0 -1
  262. data/webpack/scenes/ModuleStreams/Details/__tests__/ModuleStreamDetails.test.js +0 -2
  263. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamPage.test.js +0 -2
  264. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +0 -2
  265. data/webpack/scenes/Organizations/OrganizationActions.js +5 -1
  266. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +31 -1
  267. data/webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js +16 -0
  268. data/webpack/scenes/RedHatRepositories/__tests__/__snapshots__/RedHatRepositoriesPage.test.js.snap +11 -2
  269. data/webpack/scenes/RedHatRepositories/helpers.js +5 -5
  270. data/webpack/scenes/RedHatRepositories/index.js +11 -3
  271. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/AirGappedTypeForm.js +81 -0
  272. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnConfigurationConstants.js +13 -0
  273. data/webpack/scenes/Subscriptions/Manifest/{CdnConfigurationForm.scss → CdnConfigurationTab/CdnConfigurationForm.scss} +0 -0
  274. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +106 -0
  275. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/UpstreamServerTypeForm.js +259 -0
  276. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/AirGappedTypeForm.test.js +44 -0
  277. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/CdnTypeForm.test.js +67 -0
  278. data/webpack/scenes/Subscriptions/Manifest/{__tests__/CdnConfigurationForm.test.js → CdnConfigurationTab/__tests__/UpstreamServerTypeForm.test.js} +46 -17
  279. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/index.js +97 -0
  280. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +6 -1
  281. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +0 -1
  282. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -1
  283. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +3 -2
  284. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +4 -0
  285. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +9 -0
  286. data/webpack/scenes/Tasks/TaskActions.js +1 -1
  287. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +3 -2
  288. data/webpack/services/api/testHelpers.js +5 -3
  289. data/webpack/utils/helpers.js +6 -3
  290. metadata +78 -64
  291. data/app/services/katello/pulp/deb.rb +0 -55
  292. data/app/services/katello/pulp/distribution.rb +0 -7
  293. data/app/services/katello/pulp/docker_blob.rb +0 -7
  294. data/app/services/katello/pulp/docker_manifest.rb +0 -13
  295. data/app/services/katello/pulp/docker_manifest_list.rb +0 -14
  296. data/app/services/katello/pulp/docker_tag.rb +0 -14
  297. data/app/services/katello/pulp/erratum.rb +0 -129
  298. data/app/services/katello/pulp/file_unit.rb +0 -21
  299. data/app/services/katello/pulp/module_stream.rb +0 -39
  300. data/app/services/katello/pulp/package_category.rb +0 -7
  301. data/app/services/katello/pulp/package_group.rb +0 -20
  302. data/app/services/katello/pulp/pulp_content_unit.rb +0 -156
  303. data/app/services/katello/pulp/rpm.rb +0 -57
  304. data/app/services/katello/pulp/srpm.rb +0 -29
  305. data/app/services/katello/pulp/yum_metadata_file.rb +0 -30
  306. data/lib/monkeys/pulp3_13_checksumfix.rb +0 -17
  307. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +0 -2
  308. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
  309. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.js +0 -185
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1a33ac3431921424a7d17bcd6f90afbb0f0ed372e6c7873ea1b2afa35cde5d2
4
- data.tar.gz: 864c45929eea0df21199da1bafc4598f504887578c8c7fa860e3d03729fcf0aa
3
+ metadata.gz: 2cffead633d7427ab354f070ad520ef1436914690ae62a83707bd51f0ff94156
4
+ data.tar.gz: 759afa6d6768f23db062327899cd38db646b99c59d5068027dcf4bdc74f47896
5
5
  SHA512:
6
- metadata.gz: 938cb19362f4c5add3bd334c4889a95462a2c3f071a2d3764a43c59bfeac6bef1bb036f99b0d168dbf10953664e7fc5f8623f6b4a0a09021be7e9f1931b8be64
7
- data.tar.gz: bb12015598a2ac15cfbd0aad5f9a18d7c86142c8157e73cf134a22b93470d0da64c977c59fb74fb2819ad5e2c15b8f77f0b1283d0b9a674205bd1e0f6ac9dc89
6
+ metadata.gz: f4d6669e6c29532fe48cb70fd014bc0fb0fd9e7ddfb29a3832e175134be2ecb40b2dbcedd458cef5303805680e28ec3d17a3ea9f250a3482403490c7dd22b3d1
7
+ data.tar.gz: 458b225423b94a7cfb95034ee9bbff4d0fceca0effcf2dfd2651bb98bf535cadc681791ccbbaca19175cd17446fffab9b1190140f07973e8b220c28239aaf398
@@ -1,5 +1,4 @@
1
1
  //= require "jquery-ui/widgets/dialog"
2
- //= require "jquery-ui/widgets/sortable"
3
2
  //= require "jquery-ui/widgets/progressbar"
4
3
  //= require "jquery-ui/effect"
5
4
  //= require "jquery-ui/effect.all"
@@ -126,7 +126,7 @@ module Katello
126
126
  end
127
127
  rescue ScopedSearch::QueryNotSupported, ActiveRecord::StatementInvalid => error
128
128
  message = error.message
129
- if error.class == ActiveRecord::StatementInvalid
129
+ if error.instance_of? ActiveRecord::StatementInvalid
130
130
  Rails.logger.error("Invalid search: #{error.message}")
131
131
  message = _('Your search query was invalid. Please revise it and try again. The full error has been sent to the application logs.')
132
132
  end
@@ -141,7 +141,7 @@ module Katello
141
141
  protected
142
142
 
143
143
  def scoped_search_query(query, group)
144
- if group
144
+ if group && !query_has_group_by?(query)
145
145
  query.select(group).group(group)
146
146
  else
147
147
  query
@@ -149,7 +149,12 @@ module Katello
149
149
  end
150
150
 
151
151
  def scoped_search_total(query, group)
152
- scoped_search_query(query, group).length
152
+ count_query = scoped_search_query(query, group)
153
+ if query_has_group_by?(count_query)
154
+ count_query.length
155
+ else
156
+ count_query.count
157
+ end
153
158
  end
154
159
 
155
160
  def scoped_search_total_selectable(query, group)
@@ -157,10 +162,14 @@ module Katello
157
162
  if self.respond_to?(:total_selectable, true)
158
163
  total_selectable(q)
159
164
  else
160
- q.length
165
+ group ? q.length : q.count
161
166
  end
162
167
  end
163
168
 
169
+ def query_has_group_by?(query)
170
+ query.to_sql.include?('GROUP BY')
171
+ end
172
+
164
173
  def scoped_search_results(query:, subtotal: 0, total: 0, page: 0, per_page: 0, error: nil, selectable: nil)
165
174
  {
166
175
  :results => query,
@@ -163,6 +163,9 @@ module Katello
163
163
 
164
164
  def find_optional_readable_content_view
165
165
  @view = ContentView.readable.find_by(:id => params[:content_view_id])
166
+ if params[:content_view_id] && !@view
167
+ fail HttpErrors::NotFound, _("Couldn't find content view with id: '%s'") % params[:content_view_id]
168
+ end
166
169
  end
167
170
 
168
171
  def find_publishable_content_view
@@ -2,6 +2,7 @@ module Katello
2
2
  class Api::V2::ContentViewsController < Api::V2::ApiController
3
3
  include Concerns::Authorization::Api::V2::ContentViewsController
4
4
  include Katello::Concerns::FilteredAutoCompleteSearch
5
+ include Katello::Concerns::Api::V2::BulkExtensions
5
6
 
6
7
  before_action :find_authorized_katello_resource, :except => [:index, :create, :copy, :auto_complete_search]
7
8
  before_action :ensure_non_default, :except => [:index, :create, :copy, :auto_complete_search]
@@ -24,6 +25,18 @@ module Katello
24
25
  param :import_only, :bool, :desc => N_("Designate this Content View for importing from upstream servers only. Defaults to false")
25
26
  end
26
27
 
28
+ def_param_group :bulk_content_view_version_ids do
29
+ param :included, Hash, :desc => N_("Versions to exclusively include in the action"), :required => true, :action_aware => true do
30
+ param :search, String, :required => false, :desc => N_("Search string for versions to perform an action on")
31
+ param :ids, Array, :required => false, :desc => N_("List of versions to perform an action on")
32
+ end
33
+ param :excluded, Hash, :desc => N_("Versions to explicitly exclude in the action."\
34
+ " All other versions will be included in the action,"\
35
+ " unless an included parameter is passed as well."), :required => true, :action_aware => true do
36
+ param :ids, Array, :required => false, :desc => N_("List of versions to exclude and not run an action on")
37
+ end
38
+ end
39
+
27
40
  def filtered_associations
28
41
  {
29
42
  :component_ids => Katello::ContentViewVersion,
@@ -175,6 +188,39 @@ module Katello
175
188
  respond_for_async :resource => task
176
189
  end
177
190
 
191
+ api :PUT, "/content_views/:id/bulk_delete_versions", N_("Bulk remove versions from a content view and reassign systems and keys")
192
+ param_group :bulk_content_view_version_ids
193
+ param :id, :number, :desc => N_("content view numeric identifier"), :required => true
194
+ param :system_content_view_id, :number, :desc => N_("content view to reassign orphaned systems to")
195
+ param :system_environment_id, :number, :desc => N_("environment to reassign orphaned systems to")
196
+ param :key_content_view_id, :number, :desc => N_("content view to reassign orphaned activation keys to")
197
+ param :key_environment_id, :number, :desc => N_("environment to reassign orphaned activation keys to")
198
+ def bulk_delete_versions
199
+ params[:bulk_content_view_version_ids] ||= {}
200
+
201
+ versions = find_bulk_items(bulk_params: params[:bulk_content_view_version_ids],
202
+ model_scope: ::Katello::ContentViewVersion.where(content_view_id: @content_view.id),
203
+ key: :id)
204
+ cv_envs = ContentViewEnvironment.where(:content_view_version_id => versions.pluck(:id),
205
+ :content_view_id => @content_view.id
206
+ )
207
+
208
+ if !params[:destroy_content_view] && cv_envs.empty? && versions.empty?
209
+ fail _("There either were no environments nor versions specified or there were invalid environments/versions specified. "\
210
+ "Please check environment_ids and content_view_version_ids parameters.")
211
+ end
212
+
213
+ options = params.slice(:system_content_view_id,
214
+ :system_environment_id,
215
+ :key_content_view_id,
216
+ :key_environment_id
217
+ ).reject { |_k, v| v.nil? }.to_unsafe_h
218
+ options[:content_view_versions] = versions
219
+ options[:content_view_environments] = cv_envs
220
+ task = async_task(::Actions::Katello::ContentView::Remove, @content_view, options)
221
+ respond_for_async :resource => task
222
+ end
223
+
178
224
  api :PUT, "/content_views/:id/remove_filters", N_("Delete multiple filters from a content view")
179
225
  param :id, :number, :desc => N_("content view numeric identifier"), :required => true
180
226
  param :filter_ids, Array, of: :number, :desc => N_("filter identifiers"), :required => true
@@ -2,6 +2,10 @@ module Katello
2
2
  class Api::V2::HostPackagesController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
4
 
5
+ UPGRADABLE = "upgradable".freeze
6
+ UP_TO_DATE = "up-to-date".freeze
7
+ VERSION_STATUSES = [UPGRADABLE, UP_TO_DATE].freeze
8
+
5
9
  before_action :require_packages_or_groups, :only => [:install, :remove]
6
10
  before_action :require_packages_only, :only => [:upgrade]
7
11
  before_action :find_editable_host_with_facet, :except => :index
@@ -21,9 +25,11 @@ module Katello
21
25
  api :GET, "/hosts/:host_id/packages", N_("List packages installed on the host")
22
26
  param :host_id, :number, :required => true, :desc => N_("ID of the host")
23
27
  param :include_latest_upgradable, :boolean, :desc => N_("Also include the latest upgradable package version for each host package")
28
+ param :status, String, :desc => N_("Return only packages of a particular status (upgradable or up-to-date)"), :required => false
24
29
  param_group :search, Api::V2::ApiController
25
30
  add_scoped_search_description_for(Katello::InstalledPackage)
26
31
  def index
32
+ validate_index_params!
27
33
  collection = scoped_search(index_relation, :name, :asc, :resource_class => ::Katello::InstalledPackage)
28
34
  collection[:results] = HostPackagePresenter.with_latest(collection[:results], @host) if ::Foreman::Cast.to_bool(params[:include_latest_upgradable])
29
35
  respond_for_index(:collection => collection)
@@ -84,7 +90,15 @@ module Katello
84
90
  end
85
91
 
86
92
  def index_relation
87
- @host.installed_packages
93
+ packages = @host.installed_packages
94
+ upgradable_packages = ::Katello::Rpm.installable_for_hosts([@host]).select(:name)
95
+ if params[:status].present?
96
+ packages = case params[:status]
97
+ when 'up-to-date' then packages.where.not(name: upgradable_packages)
98
+ when 'upgradable' then packages.where(name: upgradable_packages)
99
+ end
100
+ end
101
+ packages
88
102
  end
89
103
 
90
104
  def resource_class
@@ -137,5 +151,11 @@ module Katello
137
151
  group.gsub(/^@/, "")
138
152
  end
139
153
  end
154
+
155
+ def validate_index_params!
156
+ if params[:status].present?
157
+ fail _("Status must be one of: %s" % VERSION_STATUSES.join(', ')) unless VERSION_STATUSES.include?(params[:status])
158
+ end
159
+ end
140
160
  end
141
161
  end
@@ -3,11 +3,13 @@ module Katello
3
3
  class Api::V2::HostsBulkActionsController < Api::V2::ApiController
4
4
  include Concerns::Api::V2::BulkHostsExtensions
5
5
  include Katello::Concerns::Api::V2::ContentOverridesController
6
+ include Katello::ContentSourceHelper
7
+ include ::Foreman::Renderer::Scope::Macros::Base
6
8
 
7
9
  before_action :find_host_collections, only: [:bulk_add_host_collections, :bulk_remove_host_collections]
8
10
  before_action :find_environment, only: [:environment_content_view]
9
11
  before_action :find_content_view, only: [:environment_content_view]
10
- before_action :find_editable_hosts, except: [:destroy_hosts, :resolve_traces]
12
+ before_action :find_editable_hosts, except: [:destroy_hosts, :resolve_traces, :change_content_source]
11
13
  before_action :find_deletable_hosts, only: [:destroy_hosts]
12
14
  before_action :find_readable_hosts, only: [:applicable_errata, :installable_errata, :available_incremental_updates]
13
15
  before_action :find_errata, only: [:available_incremental_updates]
@@ -305,6 +307,33 @@ module Katello
305
307
  template: '../../../api/v2/module_streams/name_streams')
306
308
  end
307
309
 
310
+ api :PUT, "/hosts/bulk/change_content_source", N_("Update the content source for specified hosts and generate the reconfiguration script")
311
+ param :host_ids, Array, required: true, desc: N_("The ids of the hosts to alter. Hosts not managed by Katello are ignored")
312
+ param :environment_id, :number, required: true, desc: N_("The id of the lifecycle environment")
313
+ param :content_view_id, :number, required: true, desc: N_("The id of the content view")
314
+ param :content_source_id, :number, required: true, desc: N_("The id of the content source")
315
+ def change_content_source
316
+ hosts = ::Host.where(id: params[:host_ids])
317
+ throw_resource_not_found(name: 'host', id: params[:host_ids]) unless hosts.any?
318
+
319
+ lifecycle_environment = KTEnvironment.readable.find(params[:environment_id])
320
+ content_view = Katello::ContentView.readable.find(params[:content_view_id])
321
+ content_source = SmartProxy.authorized(:view_smart_proxies).find(params[:content_source_id])
322
+ template = prepare_ssl_cert(foreman_server_ca_cert) + configure_subman(content_source)
323
+
324
+ hosts.each do |host|
325
+ next unless host.content_facet
326
+
327
+ host.content_facet.lifecycle_environment = lifecycle_environment
328
+ host.content_facet.content_view = content_view
329
+ host.content_facet.content_source = content_source
330
+
331
+ host.update_candlepin_associations
332
+ end
333
+
334
+ render plain: template
335
+ end
336
+
308
337
  private
309
338
 
310
339
  def find_errata
@@ -134,13 +134,17 @@ module Katello
134
134
 
135
135
  api :PUT, "/organizations/:id/cdn_configuration", N_("Update the CDN configuration")
136
136
  param :id, String, :desc => N_("ID of the Organization"), :required => true
137
- param :ssl_ca_credential_id, Integer, :desc => N_("Content Credential to use for SSL CA")
138
- param :username, String, :desc => N_("Username for authentication")
139
- param :password, String, :desc => N_("Password for authentication")
140
- param :upstream_organization_label, String, :desc => N_("Upstream organization to sync CDN content from")
141
- param :url, String, :desc => N_("Upstream server to sync CDN content from")
137
+ param :type, String, :desc => N_("CDN configuration type. One of %s.") % CdnConfiguration::TYPES, :required => true
138
+ param :url, String, :desc => N_("Upstream foreman server to sync CDN content from. Relevant only for 'upstream_server' type.")
139
+ param :username, String, :desc => N_("Username for authentication. Relevant only for 'upstream_server' type.")
140
+ param :password, String, :desc => N_("Password for authentication. Relevant only for 'upstream_server' type.")
141
+ param :upstream_organization_label, String, :desc => N_("Upstream organization to sync CDN content from. Relevant only for 'upstream_server' type.")
142
+ param :upstream_content_view_label, String, :desc => N_("Upstream Content View Label, default: Default_Organization_View. Relevant only for 'upstream_server' type.")
143
+ param :upstream_lifecycle_environment_label, String, :desc => N_("Upstream Lifecycle Environment, default: Library. Relevant only for 'upstream_server' type.")
144
+ param :ssl_ca_credential_id, Integer, :desc => N_("Content Credential to use for SSL CA. Relevant only for 'upstream_server' type.")
142
145
  def cdn_configuration
143
- config_keys = [:url, :username, :password, :upstream_organization_label, :ssl_ca_credential_id]
146
+ config_keys = [:url, :username, :password, :upstream_organization_label, :ssl_ca_credential_id, :type,
147
+ :upstream_lifecycle_environment_label, :upstream_content_view_label]
144
148
  config_params = params.slice(*config_keys).permit!.to_h
145
149
 
146
150
  task = sync_task(::Actions::Katello::CdnConfiguration::Update, @organization.cdn_configuration, config_params)
@@ -53,9 +53,13 @@ module Katello
53
53
  def custom_index_relation(collection)
54
54
  applicable = ::Foreman::Cast.to_bool(params[:packages_restrict_applicable]) || params[:host_id]
55
55
  upgradable = ::Foreman::Cast.to_bool(params[:packages_restrict_upgradable])
56
+ not_installed = ::Foreman::Cast.to_bool(params[:packages_restrict_not_installed])
56
57
 
57
58
  if upgradable
58
59
  collection = collection.installable_for_hosts(@hosts)
60
+ elsif not_installed && params[:host_id]
61
+ host = @hosts.first
62
+ collection = Katello::Rpm.yum_installable_for_host(host)
59
63
  elsif applicable
60
64
  collection = collection.applicable_to_hosts(@hosts)
61
65
  end
@@ -50,8 +50,10 @@ module Katello
50
50
  param :unprotected, :bool, :desc => N_("true if this repository can be published via HTTP")
51
51
  param :checksum_type, String, :desc => N_("Checksum of the repository, currently 'sha1' & 'sha256' are supported")
52
52
  param :docker_upstream_name, String, :desc => N_("Name of the upstream docker repository")
53
- param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository")
54
- param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum repos (either 'immediate' or 'on_demand')")
53
+ param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository (Deprecated)"), :deprecated => true
54
+ param :include_tags, Array, :desc => N_("Comma-separated list of tags to sync for a container image repository")
55
+ param :exclude_tags, Array, :desc => N_("Comma-separated list of tags to exclude when syncing a container image repository. Default: any tag ending in \"-source\"")
56
+ param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum, deb, and docker repos (either 'immediate' or 'on_demand')")
55
57
  param :download_concurrency, :number, :desc => N_("Used to determine download concurrency of the repository in pulp3. Use value less than 20. Defaults to 10")
56
58
  param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed (Deprecated)")
57
59
  param :mirroring_policy, Katello::RootRepository::MIRRORING_POLICIES, :desc => N_("Policy to set for mirroring content. Must be one of %s.") % RootRepository::MIRRORING_POLICIES
@@ -507,7 +509,7 @@ module Katello
507
509
  {:os_versions => []}, :deb_releases, :deb_components, :deb_architectures, :description,
508
510
  :http_proxy_policy, :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
509
511
  ]
510
- keys += [{:docker_tags_whitelist => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker?
512
+ keys += [{:docker_tags_whitelist => []}, {:include_tags => []}, {:exclude_tags => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker?
511
513
  keys += [:ansible_collection_requirements, :ansible_collection_auth_url, :ansible_collection_auth_token] if params[:action] == 'create' || @repository&.ansible_collection?
512
514
  keys += [:label, :content_type] if params[:action] == "create"
513
515
 
@@ -540,13 +542,20 @@ module Katello
540
542
  credential_value
541
543
  end
542
544
 
543
- # rubocop:disable Metrics/PerceivedComplexity
545
+ # rubocop:disable Metrics/PerceivedComplexity,Metrics/MethodLength
544
546
  def construct_repo_from_params(repo_params) # rubocop:disable Metrics/AbcSize
545
547
  root = @product.add_repo(repo_params.slice(:label, :name, :description, :url, :content_type, :arch, :unprotected,
546
548
  :gpg_key, :ssl_ca_cert, :ssl_client_cert, :ssl_client_key,
547
549
  :checksum_type, :download_policy, :http_proxy_policy).to_h.with_indifferent_access)
548
550
  root.docker_upstream_name = repo_params[:docker_upstream_name] if repo_params[:docker_upstream_name]
549
- root.docker_tags_whitelist = repo_params.fetch(:docker_tags_whitelist, []) if root.docker?
551
+ if root.docker?
552
+ if repo_params[:docker_tags_whitelist].present?
553
+ root.include_tags = repo_params.fetch(:docker_tags_whitelist, [])
554
+ else
555
+ root.include_tags = repo_params.fetch(:include_tags, [])
556
+ end
557
+ end
558
+ root.exclude_tags = repo_params.fetch(:exclude_tags, ['*-source']) if root.docker?
550
559
  root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
551
560
  root.mirroring_policy = repo_params[:mirroring_policy] || Katello::RootRepository::MIRRORING_POLICY_CONTENT
552
561
  root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
@@ -577,7 +586,7 @@ module Katello
577
586
 
578
587
  root
579
588
  end
580
- # rubocop:enable Metrics/CyclomaticComplexity
589
+ # rubocop:enable Metrics/CyclomaticComplexity,Metrics/MethodLength
581
590
 
582
591
  def handle_mirror_on_sync(repo_params)
583
592
  if !repo_params.key?(:mirroring_policy) && repo_params.key?(:mirror_on_sync)
@@ -13,6 +13,7 @@ module Katello
13
13
  before_action :find_authorized_host, :only => [:index, :auto_complete_search]
14
14
  before_action :find_organization
15
15
  before_action :find_product_content, :except => [:index, :auto_complete_search]
16
+ before_action :check_airgapped, :only => [:index]
16
17
 
17
18
  resource_description do
18
19
  api_version "v2"
@@ -209,5 +210,11 @@ module Katello
209
210
  params[:host_id] ||= params[:id]
210
211
  end
211
212
  end
213
+
214
+ def check_airgapped
215
+ if @organization.cdn_configuration.airgapped?
216
+ respond_for_index(:collection => { :error => _("Repositories are not available for enablement while CDN configuration is set to Air-gapped (disconnected).") }, :status => :forbidden)
217
+ end
218
+ end
212
219
  end
213
220
  end
@@ -130,6 +130,9 @@ module Katello
130
130
  end
131
131
 
132
132
  def filter_by_content_view_version(version, collection)
133
+ if params[:content_type]
134
+ return collection.where(:id => version.send(controller_name, params[:content_type]))
135
+ end
133
136
  collection.where(:id => version.send(controller_name))
134
137
  end
135
138
 
@@ -9,6 +9,8 @@ module Katello
9
9
  case params[:action]
10
10
  when 'content_hosts'
11
11
  'view'
12
+ when 'change_content_source'
13
+ 'edit'
12
14
  else
13
15
  super
14
16
  end
@@ -68,6 +70,36 @@ module Katello
68
70
  end
69
71
  end
70
72
  end
73
+
74
+ def change_content_source_data
75
+ hosts = ::Host.where(id: params[:host_ids])
76
+ content_hosts_ids = []
77
+ hosts_without_content = []
78
+
79
+ hosts.each do |host|
80
+ if host.content_facet
81
+ content_hosts_ids << host.id
82
+ else
83
+ hosts_without_content << host.name
84
+ end
85
+ end
86
+
87
+ environments = KTEnvironment.readable.where(organization: Organization.current).includes([:organization, :env_priors, :priors]).order(:name)
88
+ content_sources = SmartProxy.authorized(:view_smart_proxies).with_content.includes([:smart_proxy_features])
89
+
90
+ if Katello.with_remote_execution?
91
+ template_id = JobTemplate.find_by(name: 'Change content source')&.id
92
+ job_invocation_path = new_job_invocation_path(template_id: template_id, host_ids: content_hosts_ids) if template_id
93
+ end
94
+
95
+ render json: {
96
+ content_hosts_ids: content_hosts_ids,
97
+ hosts_without_content: hosts_without_content,
98
+ environments: environments,
99
+ content_sources: content_sources,
100
+ job_invocation_path: job_invocation_path
101
+ }
102
+ end
71
103
  end
72
104
  end
73
105
  end
@@ -0,0 +1,43 @@
1
+ module Katello
2
+ module ContentSourceHelper
3
+ def missing_content_source(host)
4
+ <<~CMD
5
+ echo "Host [#{host.name}] doesn't have an assigned content source!"
6
+ exit 1
7
+ CMD
8
+ end
9
+
10
+ def prepare_ssl_cert(ca_cert)
11
+ <<~CMD
12
+ # Prepare SSL certificate
13
+
14
+ KATELLO_SERVER_CA_CERT=/etc/rhsm/ca/katello-server-ca.pem
15
+ SSL_CA_CERT=$(mktemp)
16
+ cat << EOF > $SSL_CA_CERT
17
+ #{ca_cert}
18
+ EOF
19
+
20
+ mkdir -p /etc/rhsm/ca
21
+ cp -f $SSL_CA_CERT $KATELLO_SERVER_CA_CERT
22
+ chmod 644 $KATELLO_SERVER_CA_CERT
23
+
24
+ CMD
25
+ end
26
+
27
+ def configure_subman(content_source)
28
+ <<~CMD
29
+ # Configure subscription-manager
30
+ RHSM_CFG=/etc/rhsm/rhsm.conf
31
+
32
+ test -f $RHSM_CFG.bak || cp $RHSM_CFG $RHSM_CFG.bak
33
+
34
+ subscription-manager config \
35
+ --server.hostname="#{content_source.rhsm_url.host}" \
36
+ --server.port="#{content_source.rhsm_url.port}" \
37
+ --server.prefix="#{content_source.rhsm_url.path}" \
38
+ --rhsm.repo_ca_cert="$KATELLO_SERVER_CA_CERT" \
39
+ --rhsm.baseurl="#{content_source.pulp_content_url}"
40
+ CMD
41
+ end
42
+ end
43
+ end
@@ -266,5 +266,9 @@ module Katello
266
266
  :priority => 900
267
267
  }]
268
268
  end
269
+
270
+ def hosts_change_content_source
271
+ [{ action: [_('Change Content Source'), '/change_host_content_source', false], priority: 100 }]
272
+ end
269
273
  end
270
274
  end
@@ -4,23 +4,21 @@ module Actions
4
4
  class Update < Actions::EntryAction
5
5
  def plan(cdn_configuration, options)
6
6
  cdn_configuration.update!(options)
7
+ return if cdn_configuration.airgapped?
7
8
 
8
- if cdn_configuration.redhat?
9
- cdn_configuration.ssl_cert = nil
10
- cdn_configuration.ssl_key = nil
11
- else
9
+ if cdn_configuration.upstream_server?
12
10
  resource = ::Katello::Resources::CDN::CdnResource.create(cdn_configuration: cdn_configuration)
13
11
  keypair = resource.debug_certificate
14
12
  cdn_configuration.ssl_cert = OpenSSL::X509::Certificate.new(keypair)
15
13
  cdn_configuration.ssl_key = OpenSSL::PKey::RSA.new(keypair)
16
- end
17
14
 
18
- cdn_configuration.save!
15
+ cdn_configuration.save!
16
+ end
19
17
 
20
18
  org = cdn_configuration.organization
21
19
  roots = ::Katello::RootRepository.redhat.in_organization(org)
22
20
  roots.each do |root|
23
- full_path = if cdn_configuration.redhat?
21
+ full_path = if cdn_configuration.redhat_cdn?
24
22
  root.product.repo_url(root.library_instance.generate_content_path)
25
23
  else
26
24
  resource.repository_url(content_label: root.content.label)
@@ -33,7 +33,7 @@ module Actions
33
33
  password = decrypt_field(input[:upstream_password])
34
34
  repo_discovery = ::Katello::RepoDiscovery.new(input[:url], input[:content_type],
35
35
  input[:upstream_username], password,
36
- input[:search], proxy,
36
+ input[:search],
37
37
  output[:crawled], output[:repo_urls], output[:to_follow])
38
38
 
39
39
  repo_discovery.run(output[:to_follow].shift)
@@ -49,19 +49,6 @@ module Actions
49
49
  def task_output
50
50
  output[:repo_urls] || []
51
51
  end
52
-
53
- def proxy
54
- proxy_details = {}
55
- if (proxy = ::HttpProxy.default_global_content_proxy)
56
- uri = URI(proxy.url)
57
- proxy_details[:proxy_host] = "#{uri.scheme}://#{uri.host}#{uri.path}"
58
- proxy_details[:proxy_port] = uri.port
59
- proxy_details[:proxy_user] = proxy.username
60
- proxy_details[:proxy_password] = proxy.password
61
- end
62
-
63
- proxy_details
64
- end
65
52
  end
66
53
  end
67
54
  end
@@ -24,7 +24,7 @@ module Actions
24
24
  ::Katello::FileUnit.import_for_repository(repo)
25
25
  elsif repo.generic?
26
26
  repo.repository_type.content_types_to_index.each do |type|
27
- type.model_class.import_for_repository(repo, generic_content_type: type.content_type)
27
+ type.model_class.import_for_repository(repo, content_type: type.content_type)
28
28
  end
29
29
  elsif repo.deb?
30
30
  if input[:import_upload_task] && input[:import_upload_task][:content_unit_href]
@@ -288,6 +288,17 @@ module Katello
288
288
  Katello.with_katello_agent?
289
289
  end
290
290
 
291
+ include Katello::ContentSourceHelper
292
+
293
+ apipie :method, "Generate script to change a host's content source" do
294
+ returns String
295
+ end
296
+ def change_content_source(host, ca_cert)
297
+ return missing_content_source(host) unless host.content_source
298
+
299
+ prepare_ssl_cert(ca_cert) + configure_subman(host.content_source)
300
+ end
301
+
291
302
  private
292
303
 
293
304
  def host_subscription_facet(host)
@@ -145,10 +145,10 @@ module Katello
145
145
  end
146
146
  end
147
147
 
148
- class DisconnectedMode < StandardError
148
+ class SubscriptionConnectionNotEnabled < StandardError
149
149
  def message
150
- _("You are currently operating in disconnected mode where access to Red Hat Subcription Management " \
151
- "is prohibited. If you would like to change this, please update the content setting 'Disconnected mode'.")
150
+ _("Access to Red Hat Subscription Management " \
151
+ "is prohibited. If you would like to change this, please update the content setting 'Subscription connection enabled'.")
152
152
  end
153
153
  end
154
154
 
@@ -19,9 +19,9 @@ module Katello
19
19
  class Timer
20
20
  def initialize(key = "default")
21
21
  @key = key
22
- @start_time = Time.now
23
22
  Thread.current[:timers] ||= {}
24
23
  Thread.current[:timers][key] = self
24
+ self.start
25
25
  end
26
26
 
27
27
  def start
@@ -38,6 +38,11 @@ module Katello
38
38
  Rails.logger.info "Timer #{@key} stopping at #{Time.now}: #{duration} sec"
39
39
  end
40
40
 
41
+ def log(msg = nil)
42
+ duration = (Time.now - @start_time).truncate(2)
43
+ Rails.logger.info ["Timer #{@key} running at #{Time.now}", msg, "#{duration} sec"].compact.join(': ')
44
+ end
45
+
41
46
  def self.find_by_key(key)
42
47
  if Thread.current&.[](:timers)&.[](key)
43
48
  Thread.current[:timers][key]