katello 4.7.3 → 4.8.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (333) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +6 -4
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -12
  4. data/app/controllers/katello/api/v2/capsule_content_controller.rb +0 -4
  5. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +22 -81
  6. data/app/controllers/katello/api/v2/content_exports_controller.rb +11 -80
  7. data/app/controllers/katello/api/v2/content_imports_controller.rb +1 -0
  8. data/app/controllers/katello/api/v2/exports_controller.rb +130 -0
  9. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +7 -8
  10. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +8 -4
  11. data/app/controllers/katello/api/v2/organizations_controller.rb +3 -0
  12. data/app/controllers/katello/api/v2/package_groups_controller.rb +0 -52
  13. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -6
  14. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -2
  15. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +4 -1
  16. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +24 -0
  17. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +3 -3
  18. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +55 -24
  19. data/app/helpers/katello/katello_urls_helper.rb +0 -15
  20. data/app/helpers/katello/sync_management_helper.rb +0 -4
  21. data/app/lib/actions/candlepin/owner/destroy_imports.rb +1 -1
  22. data/app/lib/actions/katello/capsule_content/sync.rb +0 -4
  23. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +1 -2
  24. data/app/lib/actions/katello/content_view/publish.rb +6 -2
  25. data/app/lib/actions/katello/content_view/remove.rb +8 -2
  26. data/app/lib/actions/katello/content_view_version/destroy.rb +1 -1
  27. data/app/lib/actions/katello/environment/destroy.rb +8 -2
  28. data/app/lib/actions/katello/host/reassign.rb +4 -2
  29. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +0 -1
  30. data/app/lib/actions/katello/product/destroy.rb +2 -1
  31. data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -10
  32. data/app/lib/actions/katello/repository/import_upload.rb +0 -1
  33. data/app/lib/actions/katello/repository/sync.rb +0 -1
  34. data/app/lib/actions/katello/repository/update.rb +5 -3
  35. data/app/lib/actions/katello/repository/upload_files.rb +0 -1
  36. data/app/lib/actions/pulp3/abstract.rb +0 -6
  37. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -2
  38. data/app/lib/actions/pulp3/content_view_version/create_syncable_export_history.rb +4 -0
  39. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +1 -0
  40. data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +7 -2
  41. data/app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb +7 -2
  42. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -2
  43. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +2 -2
  44. data/app/lib/katello/concerns/renderer_extensions.rb +1 -1
  45. data/app/lib/katello/event_daemon/runner.rb +12 -9
  46. data/app/lib/katello/resources/candlepin/consumer.rb +6 -6
  47. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  48. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +3 -4
  49. data/app/lib/katello/resources/candlepin.rb +4 -4
  50. data/app/lib/katello/util/errata.rb +12 -10
  51. data/app/lib/katello/util/search.rb +0 -1
  52. data/app/lib/katello/validators/content_view_environment_org_validator.rb +5 -2
  53. data/app/lib/katello/validators/content_view_environment_validator.rb +1 -2
  54. data/app/lib/katello/validators/generated_content_view_validator.rb +16 -0
  55. data/app/mailers/katello/errata_mailer.rb +4 -2
  56. data/app/models/katello/alternate_content_source.rb +5 -1
  57. data/app/models/katello/concerns/content_facet_host_extensions.rb +25 -14
  58. data/app/models/katello/concerns/host_managed_extensions.rb +17 -8
  59. data/app/models/katello/concerns/redhat_extensions.rb +16 -6
  60. data/app/models/katello/concerns/smart_proxy_extensions.rb +0 -12
  61. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -0
  62. data/app/models/katello/content_view.rb +22 -5
  63. data/app/models/katello/content_view_environment.rb +11 -2
  64. data/app/models/katello/content_view_environment_content_facet.rb +9 -0
  65. data/app/models/katello/content_view_version.rb +10 -5
  66. data/app/models/katello/erratum.rb +6 -1
  67. data/app/models/katello/glue/candlepin/pool.rb +6 -0
  68. data/app/models/katello/glue/candlepin/product.rb +7 -1
  69. data/app/models/katello/glue/candlepin/subscription.rb +5 -0
  70. data/app/models/katello/glue/provider.rb +26 -26
  71. data/app/models/katello/host/content_facet.rb +106 -18
  72. data/app/models/katello/host/info_provider.rb +25 -21
  73. data/app/models/katello/host/subscription_facet.rb +18 -14
  74. data/app/models/katello/kt_environment.rb +12 -7
  75. data/app/models/katello/package_group.rb +0 -12
  76. data/app/models/katello/pool.rb +4 -1
  77. data/app/models/katello/product.rb +11 -1
  78. data/app/models/katello/repository.rb +11 -11
  79. data/app/models/katello/root_repository.rb +5 -4
  80. data/app/models/katello/task_status.rb +0 -18
  81. data/app/services/katello/candlepin/consumer.rb +2 -2
  82. data/app/services/katello/host/package_profile_uploader.rb +1 -1
  83. data/app/services/katello/product_content_finder.rb +11 -8
  84. data/app/services/katello/pulp3/content_view_version/export.rb +8 -65
  85. data/app/services/katello/pulp3/content_view_version/export_validation_error.rb +7 -0
  86. data/app/services/katello/pulp3/content_view_version/export_validator.rb +105 -0
  87. data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -1
  88. data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +7 -1
  89. data/app/services/katello/pulp3/erratum.rb +1 -0
  90. data/app/services/katello/pulp3/module_stream.rb +26 -11
  91. data/app/services/katello/pulp3/repository/yum.rb +2 -1
  92. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +2 -1
  93. data/app/services/katello/registration_manager.rb +46 -26
  94. data/app/services/katello/repository_type.rb +3 -9
  95. data/app/services/katello/simple_package.rb +22 -0
  96. data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -0
  97. data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +1 -0
  98. data/app/views/katello/api/v2/content_facet/base.json.rabl +23 -2
  99. data/app/views/katello/api/v2/content_facet/show.json.rabl +11 -8
  100. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  101. data/app/views/katello/api/v2/hosts/base.json.rabl +22 -2
  102. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +2 -2
  103. data/config/initializers/monkeys.rb +0 -2
  104. data/config/routes/api/registry.rb +8 -7
  105. data/config/routes/api/v2.rb +0 -2
  106. data/config/routes.rb +3 -0
  107. data/db/migrate/20200429153103_installed_package_bad_nvrea.rb +1 -1
  108. data/db/migrate/20220228173251_remove_drpm_from_ignorable_content.rb +7 -3
  109. data/db/migrate/20220419193414_content_settings_to_dsl_category.rb +1 -1
  110. data/db/migrate/20220929204746_add_content_view_environment_content_facet.rb +52 -0
  111. data/db/migrate/20221123212341_remove_pulp_docker_registry_port_setting.rb +5 -0
  112. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  113. data/engines/bastion/app/assets/stylesheets/bastion/bastion.scss +4 -0
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -4
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +0 -1
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -4
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -1
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +11 -3
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -1
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +8 -4
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +5485 -0
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +5397 -0
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +5658 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +5284 -0
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ka.po +5231 -0
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +5275 -0
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +5389 -0
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +5212 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +5145 -0
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +2 -2
  132. data/lib/katello/engine.rb +2 -1
  133. data/lib/katello/permission_creator.rb +2 -4
  134. data/lib/katello/permissions/registry_permissions.rb +5 -5
  135. data/lib/katello/plugin.rb +22 -14
  136. data/lib/katello/repository_types/README.md +136 -19
  137. data/lib/katello/repository_types/deb.rb +0 -1
  138. data/lib/katello/repository_types/docker.rb +0 -1
  139. data/lib/katello/repository_types/file.rb +0 -1
  140. data/lib/katello/repository_types/yum.rb +0 -4
  141. data/lib/katello/tasks/clean_candlepin_orphaned_products.rake +38 -0
  142. data/lib/katello/tasks/clean_orphaned_facets.rb +20 -0
  143. data/lib/katello/tasks/reimport.rake +1 -2
  144. data/lib/katello/tasks/repository.rake +1 -22
  145. data/lib/katello/tasks/reset.rake +1 -0
  146. data/lib/katello/tasks/upgrades/4.8/fix_incorrect_providers.rake +29 -0
  147. data/lib/katello/version.rb +1 -1
  148. data/lib/katello.rb +0 -5
  149. data/locale/bn/katello.po +69 -27
  150. data/locale/cs/katello.po +69 -27
  151. data/locale/de/katello.po +78 -36
  152. data/locale/en/katello.po +69 -27
  153. data/locale/es/katello.po +70 -28
  154. data/locale/fr/katello.po +73 -31
  155. data/locale/gu/katello.po +69 -27
  156. data/locale/hi/katello.po +69 -27
  157. data/locale/it/katello.po +69 -27
  158. data/locale/ja/katello.po +73 -31
  159. data/locale/ka/katello.po +73 -31
  160. data/locale/katello.pot +335 -262
  161. data/locale/kn/katello.po +69 -27
  162. data/locale/ko/katello.po +69 -27
  163. data/locale/mr/katello.po +69 -27
  164. data/locale/or/katello.po +69 -27
  165. data/locale/pa/katello.po +69 -27
  166. data/locale/pt/katello.po +69 -27
  167. data/locale/pt_BR/katello.po +70 -28
  168. data/locale/ru/katello.po +70 -28
  169. data/locale/ta/katello.po +69 -27
  170. data/locale/te/katello.po +69 -27
  171. data/locale/zh_CN/katello.po +73 -31
  172. data/locale/zh_TW/katello.po +70 -28
  173. data/webpack/components/Content/ContentPage.js +51 -35
  174. data/webpack/components/Content/__tests__/ContentPage.test.js +2 -4
  175. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +22 -3
  176. data/webpack/components/Table/EmptyStateMessage.js +14 -11
  177. data/webpack/components/Table/MainTable.js +36 -15
  178. data/webpack/components/Table/TableWrapper.js +25 -25
  179. data/webpack/components/Table/__test__/emptyStateMessage.test.js +51 -0
  180. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +5 -4
  181. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +1 -1
  182. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsModal.test.js +1 -17
  183. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +18 -9
  184. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -2
  185. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +1 -2
  186. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +1 -2
  187. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +47 -27
  188. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +1 -2
  189. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -21
  190. data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +1 -28
  191. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +1 -10
  192. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +1 -18
  193. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +1 -17
  194. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -15
  195. data/webpack/global_test_setup.js +1 -1
  196. data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +12 -10
  197. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +6 -0
  198. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +1 -0
  199. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +3 -10
  200. data/webpack/scenes/AlternateContentSources/Create/Steps/NameACS.js +1 -0
  201. data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +3 -3
  202. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +1 -0
  203. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +12 -4
  204. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +7 -4
  205. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +4 -8
  206. data/webpack/scenes/AlternateContentSources/helpers.js +1 -1
  207. data/webpack/scenes/Content/Details/ContentRepositories.js +5 -4
  208. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +1 -12
  209. data/webpack/scenes/Content/Table/ContentTable.js +2 -1
  210. data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -14
  211. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -25
  212. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  213. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +44 -31
  214. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -0
  215. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +6 -1
  216. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +2 -1
  217. data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +2 -1
  218. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +3 -1
  219. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -1
  220. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
  221. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -1
  222. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +2 -0
  223. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
  224. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +1 -1
  225. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +1 -1
  226. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +35 -33
  227. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +48 -45
  228. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +58 -24
  229. data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +64 -0
  230. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +36 -20
  231. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +40 -23
  232. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +0 -13
  233. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +0 -13
  234. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -1
  235. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -10
  236. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
  237. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -10
  238. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +21 -9
  239. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +4 -0
  240. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +1 -32
  241. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +3 -1
  242. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -15
  243. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +1 -1
  244. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +1 -2
  245. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -9
  246. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +4 -0
  247. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +30 -14
  248. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
  249. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +55 -120
  250. data/webpack/scenes/ContentViews/components/WizardHeader.js +1 -1
  251. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +1 -1
  252. data/webpack/scenes/ContentViews/expansions/__tests__/contentViewComponentsModal.test.js +8 -1
  253. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +3 -9
  254. data/webpack/scenes/ModuleStreams/__tests__/__snapshots__/ModuleStreamPage.test.js.snap +7 -1
  255. data/webpack/scenes/RedHatRepositories/components/Search.js +22 -16
  256. data/webpack/scenes/RedHatRepositories/index.scss +20 -1
  257. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +12 -1
  258. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +1 -1
  259. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +1 -1
  260. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +21 -19
  261. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +34 -1
  262. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +20 -7
  263. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +0 -1
  264. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +65 -15
  265. metadata +47 -113
  266. data/app/lib/actions/katello/pulp_selector.rb +0 -24
  267. data/app/lib/actions/katello/repository/correct_checksum.rb +0 -24
  268. data/app/lib/actions/katello/repository/destroy_package_group.rb +0 -26
  269. data/app/lib/actions/katello/repository/upload_package_group.rb +0 -24
  270. data/app/lib/actions/pulp/abstract.rb +0 -37
  271. data/app/lib/actions/pulp/abstract_async_task.rb +0 -154
  272. data/app/lib/actions/pulp/abstract_async_task_group.rb +0 -94
  273. data/app/lib/actions/pulp/consumer/sync_capsule.rb +0 -45
  274. data/app/lib/actions/pulp/consumer/unassociate_units.rb +0 -20
  275. data/app/lib/actions/pulp/expect_one_task.rb +0 -11
  276. data/app/lib/actions/pulp/orchestration/orphan_cleanup/remove_orphans.rb +0 -16
  277. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +0 -19
  278. data/app/lib/actions/pulp/orchestration/repository/delete.rb +0 -15
  279. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +0 -14
  280. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +0 -13
  281. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -19
  282. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +0 -14
  283. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +0 -34
  284. data/app/lib/actions/pulp/orchestration/repository/sync.rb +0 -18
  285. data/app/lib/actions/pulp/orchestration/repository/upload_content.rb +0 -37
  286. data/app/lib/actions/pulp/orphan_cleanup/remove_orphans.rb +0 -15
  287. data/app/lib/actions/pulp/orphan_cleanup/remove_unneeded_repos.rb +0 -16
  288. data/app/lib/actions/pulp/repository/abstract_copy_content.rb +0 -45
  289. data/app/lib/actions/pulp/repository/abstract_remove_content.rb +0 -32
  290. data/app/lib/actions/pulp/repository/clear.rb +0 -18
  291. data/app/lib/actions/pulp/repository/copy_all_units.rb +0 -30
  292. data/app/lib/actions/pulp/repository/copy_units.rb +0 -25
  293. data/app/lib/actions/pulp/repository/create.rb +0 -28
  294. data/app/lib/actions/pulp/repository/create_in_plan.rb +0 -15
  295. data/app/lib/actions/pulp/repository/create_upload_request.rb +0 -20
  296. data/app/lib/actions/pulp/repository/delete_upload_request.rb +0 -19
  297. data/app/lib/actions/pulp/repository/destroy.rb +0 -28
  298. data/app/lib/actions/pulp/repository/distributor_publish.rb +0 -25
  299. data/app/lib/actions/pulp/repository/download.rb +0 -16
  300. data/app/lib/actions/pulp/repository/import_upload.rb +0 -19
  301. data/app/lib/actions/pulp/repository/presenters/abstract_sync_presenter.rb +0 -47
  302. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +0 -95
  303. data/app/lib/actions/pulp/repository/presenters/docker_presenter.rb +0 -103
  304. data/app/lib/actions/pulp/repository/presenters/file_unit_presenter.rb +0 -42
  305. data/app/lib/actions/pulp/repository/presenters/yum_presenter.rb +0 -131
  306. data/app/lib/actions/pulp/repository/refresh.rb +0 -21
  307. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +0 -21
  308. data/app/lib/actions/pulp/repository/remove_distribution.rb +0 -11
  309. data/app/lib/actions/pulp/repository/remove_units.rb +0 -44
  310. data/app/lib/actions/pulp/repository/sync.rb +0 -99
  311. data/app/lib/actions/pulp/repository/upload_file.rb +0 -28
  312. data/app/lib/actions/pulp/repository_group/create.rb +0 -31
  313. data/app/lib/actions/pulp/repository_group/delete.rb +0 -17
  314. data/app/lib/actions/pulp/repository_group/export.rb +0 -51
  315. data/app/lib/katello/util/package_clause_generator.rb +0 -77
  316. data/app/models/katello/glue/pulp/pulp_errors.rb +0 -9
  317. data/app/models/katello/glue/pulp/repo.rb +0 -353
  318. data/app/models/katello/pulp_sync_status.rb +0 -165
  319. data/app/models/katello/pulp_task_status.rb +0 -63
  320. data/app/services/katello/pulp/content.rb +0 -24
  321. data/app/services/katello/pulp/importer_comparison.rb +0 -28
  322. data/app/services/katello/pulp/repository/deb.rb +0 -61
  323. data/app/services/katello/pulp/repository/docker.rb +0 -82
  324. data/app/services/katello/pulp/repository/file.rb +0 -52
  325. data/app/services/katello/pulp/repository/yum.rb +0 -205
  326. data/app/services/katello/pulp/repository.rb +0 -327
  327. data/app/services/katello/pulp/server.rb +0 -35
  328. data/app/services/katello/pulp/simple_package.rb +0 -24
  329. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -52
  330. data/lib/monkeys/fix_deb_optimized_sync.rb +0 -35
  331. data/lib/monkeys/fix_pulp_container_path.rb +0 -35
  332. data/locale/zanata.xml +0 -30
  333. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentSearch.fixtures.json +0 -33
@@ -3,58 +3,6 @@ module Katello
3
3
  apipie_concern_subst(:a_resource => N_("a package group"), :resource => "package_groups")
4
4
  include Katello::Concerns::Api::V2::RepositoryContentController
5
5
 
6
- before_action :find_repository
7
-
8
- api :POST, "/package_group", N_("Create a package group")
9
- param :repository_id, String, :required => true, :desc => N_("repository_id")
10
- param :name, String, :required => true, :desc => N_("package group name")
11
- param :description, String, :desc => N_("package group description. Defaults to params[:name]")
12
- param :user_visible, :bool, :desc => N_("set \"user_visible\" flag on package group. Defaults to true")
13
- param :mandatory_package_names, Array, :desc => N_("mandatory package names to include in the package group")
14
- param :optional_package_names, Array, :desc => N_("optional package names to include in the package group")
15
- param :conditional_package_names, Array, :desc => N_("conditional package names to include in the package group")
16
- param :default_package_names, Array, :desc => N_("default package names to include in the package group")
17
-
18
- def create
19
- fail HttpErrors::BadRequest, _("name not defined.") if params[:name].blank?
20
- fail HttpErrors::BadRequest, _("repository_id not defined.") if params[:repository_id].blank?
21
- fail Katello::Errors::InvalidRepositoryContent, _("Can only upload to Yum Repositories.") unless @repo.yum?
22
-
23
- if params[:mandatory_package_names].empty? && params[:optional_package_names].empty? &&
24
- params[:conditional_package_names].empty? && params[:default_package_names].empty?
25
- fail HttpErrors::BadRequest, _("Must supply at least one of mandatory_package_names, " \
26
- "optional_package_names, conditional_package_names, default_package_names parameters")
27
- end
28
-
29
- params.each do |key, value|
30
- if key.to_s.include?('_package_names')
31
- if value.present?
32
- fail HttpErrors::BadRequest, _("%s must be an array.") % key unless value.is_a?(Array)
33
- end
34
- end
35
- end
36
-
37
- params[:description] = params[:name] if params[:description].empty?
38
- params[:user_visible] = ::Foreman::Cast.to_bool(params[:user_visible])
39
- params[:user_visible] ||= true
40
-
41
- create_params = params.slice(:name, :description, :user_visible, :mandatory_package_names, :optional_package_names, :conditional_package_names, :default_package_names).to_unsafe_h
42
- sync_task(::Actions::Katello::Repository::UploadPackageGroup, @repo, create_params)
43
- render :json => {:status => "success"}
44
- end
45
-
46
- api :DELETE, "/package_group", N_("Delete a package group")
47
- param :name, String, :required => true, :desc => N_("package group name")
48
- param :repository_id, String, :required => true, :desc => N_("repository_id")
49
-
50
- def destroy
51
- fail Katello::Errors::InvalidRepositoryContent, _("Can only destroy on Yum Repositories.") unless @repo.yum?
52
- fail _("name not defined.") if params[:name].blank?
53
-
54
- sync_task(::Actions::Katello::Repository::DestroyPackageGroup, @repo, params[:name])
55
- render :json => {:status => "success"}
56
- end
57
-
58
6
  def available_for_content_view_filter(filter, _collection)
59
7
  collection_ids = []
60
8
  current_ids = filter.package_group_rules.map(&:uuid)
@@ -14,7 +14,7 @@ module Katello
14
14
  bulk_params[:included] ||= {}
15
15
  bulk_params[:excluded] ||= {}
16
16
 
17
- if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
17
+ if !params[:install_all] && bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
18
18
  fail HttpErrors::BadRequest, _("No hosts have been specified.")
19
19
  end
20
20
 
@@ -25,9 +25,8 @@ module Katello
25
25
  @hosts = @hosts.where(id: bulk_params[:included][:ids])
26
26
  end
27
27
 
28
- if bulk_params[:included][:search]
29
- search_hosts = bulk_hosts_relation(permission, @organization).search_for(bulk_params[:included][:search])
30
- @hosts = @hosts.merge(search_hosts)
28
+ if bulk_params[:included][:search].present?
29
+ @hosts = @hosts.search_for(bulk_params[:included][:search])
31
30
  end
32
31
 
33
32
  @hosts = restrict_to.call(@hosts) if restrict_to
@@ -35,8 +34,7 @@ module Katello
35
34
  if bulk_params[:excluded][:ids].present?
36
35
  @hosts = @hosts.where.not(id: bulk_params[:excluded][:ids])
37
36
  end
38
-
39
- fail HttpErrors::Forbidden, _("Action unauthorized to be performed on selected hosts.") if @hosts.empty?
37
+ fail HttpErrors::Forbidden, _("No hosts matched search, or action unauthorized for selected hosts.") if @hosts.empty?
40
38
 
41
39
  @hosts
42
40
  end
@@ -19,8 +19,7 @@ module Katello
19
19
 
20
20
  def host_setup_extension
21
21
  if params['host']['lifecycle_environment_id']
22
- new_lce = KTEnvironment.readable.find(params['host']['lifecycle_environment_id'])
23
- @host.content_facet.lifecycle_environment = new_lce
22
+ @host.content_facet.assign_single_environment(content_view_id: @host&.content_views&.first&.id, lifecycle_environment_id: params['host']['lifecycle_environment_id'])
24
23
  @host.update_candlepin_associations
25
24
  end
26
25
 
@@ -118,7 +118,10 @@ module Katello
118
118
  # and also ensure that the environments have the remove permission
119
119
  return deny_access unless KTEnvironment.promotable.where(:id => env_ids).count == env_ids.size && view.promotable_or_removable?
120
120
 
121
- total_count = Katello::Host::ContentFacet.where(:content_view_id => view, :lifecycle_environment_id => env_ids).count
121
+ total_count = Katello::Host::ContentFacet.in_content_views_and_environments(
122
+ :content_views => [view],
123
+ :lifecycle_environments => ::Katello::KTEnvironment.where(id: env_ids)
124
+ ).count
122
125
  if total_count > 0
123
126
  unless options[:system_content_view_id] && options[:system_environment_id]
124
127
  fail _("Unable to reassign content hosts. Please provide system_content_view_id and system_environment_id.")
@@ -0,0 +1,24 @@
1
+ module Katello
2
+ module Concerns
3
+ module ContentFacetHostsControllerExtensions
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ before_action :set_up_content_view_environment, only: [:update]
7
+
8
+ def set_up_content_view_environment
9
+ return unless params[:host] && params[:host][:content_facet_attributes]
10
+ cv_id = params[:host][:content_facet_attributes].delete(:content_view_id)
11
+ env_id = params[:host][:content_facet_attributes].delete(:lifecycle_environment_id)
12
+ Rails.logger.info "set_up_content_view_environment: cv_id=#{cv_id}, env_id=#{env_id}"
13
+ if (cv_id.present? && env_id.present?)
14
+ @host.content_facet.assign_single_environment(
15
+ lifecycle_environment_id: env_id,
16
+ content_view_id: cv_id
17
+ )
18
+ Rails.logger.info "set_up_content_view_environment: done"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -57,15 +57,15 @@ module Katello
57
57
  format.csv do
58
58
  @hosts = resource_base_with_search.where(organization_id: params[:organization_id])
59
59
  .preload(:subscription_facet, :host_statuses, :operatingsystem,
60
- :applicable_rpms, :lifecycle_environment, :content_view)
60
+ :applicable_rpms, :content_view_environments)
61
61
  csv_response(@hosts,
62
62
  [:name, :subscription_status_label, 'content_facet.installable_security_errata_count',
63
63
  'content_facet.installable_bugfix_errata_count', 'content_facet.installable_enhancement_errata_count',
64
- 'content_facet.upgradable_rpm_count', :operatingsystem, :lifecycle_environment, :content_view,
64
+ 'content_facet.upgradable_rpm_count', :operatingsystem, :content_view_environment_names,
65
65
  'subscription_facet.registered_at', 'subscription_facet.last_checkin'],
66
66
  ['Name', 'Subscription Status', 'Installable Updates - Security',
67
67
  'Installable Updates - Bug Fixes', 'Installable Updates - Enhancements',
68
- 'Installable Updates - Package Count', 'OS', 'Environment', 'Content View',
68
+ 'Installable Updates - Package Count', 'OS', 'Content View Environments',
69
69
  'Registered', 'Last Checkin'])
70
70
  end
71
71
  end
@@ -64,7 +64,7 @@ module Katello
64
64
  end
65
65
 
66
66
  def fetch_content_view(host, options = {})
67
- return host.content_view if host.try(:content_view_id)
67
+ return host.single_content_view if host.try(:single_content_view)
68
68
  selected_host_group = options.fetch(:selected_host_group, nil)
69
69
  return selected_host_group.content_view if selected_host_group.present?
70
70
  end
@@ -75,8 +75,12 @@ module Katello
75
75
  return selected_host_group.content_source if selected_host_group.present?
76
76
  end
77
77
 
78
- def accessible_lifecycle_environments(org, host)
79
- selected = host.lifecycle_environment
78
+ def accessible_lifecycle_environments(org, host_or_hostgroup)
79
+ selected = if host_or_hostgroup.is_a?(::Host::Managed)
80
+ host_or_hostgroup.try(:single_lifecycle_environment)
81
+ else
82
+ host_or_hostgroup.lifecycle_environment
83
+ end
80
84
  envs = org.kt_environments.readable.order(:name)
81
85
  envs |= [selected] if selected.present? && org == selected.organization
82
86
  envs
@@ -207,9 +211,11 @@ module Katello
207
211
  if (host.is_a? ::Hostgroup)
208
212
  new_host.content_facet = hostgroup_content_facet(host, param_host)
209
213
  elsif host.content_facet.present?
210
- new_host.content_facet = ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => host.content_facet.lifecycle_environment_id,
211
- :content_view_id => host.content_facet.content_view_id,
212
- :content_source_id => host.content_source_id)
214
+ new_host.content_facet = ::Katello::Host::ContentFacet.new(:content_source_id => host.content_source_id)
215
+ new_host.content_facet.assign_single_environment(
216
+ :lifecycle_environment => host.content_facet.single_lifecycle_environment,
217
+ :content_view => host.content_facet.single_content_view
218
+ )
213
219
  end
214
220
  new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
215
221
  else
@@ -243,9 +249,11 @@ module Katello
243
249
  content_view = fetch_inherited_param(host_params[:content_view_id], ::Katello::ContentView, parent&.content_view)
244
250
  content_source = fetch_inherited_param(host_params[:content_source_id], ::SmartProxy, parent&.content_source)
245
251
 
246
- host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_env.id,
247
- :content_view_id => content_view.id,
248
- :content_source => content_source)
252
+ host.content_facet = Host::ContentFacet.new(:content_source => content_source)
253
+ host.content_facet.assign_single_environment(
254
+ :lifecycle_environment_id => lifecycle_env.id,
255
+ :content_view_id => content_view.id
256
+ )
249
257
  if host.operatingsystem.is_a?(Redhat)
250
258
  view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
251
259
  end
@@ -289,35 +297,58 @@ module Katello
289
297
  end
290
298
 
291
299
  def host_registered_time(host)
292
- return _('Never registered') unless host.subscription_facet_attributes&.registered_at
300
+ return ''.html_safe unless host.subscription_facet_attributes&.registered_at
293
301
 
294
302
  date_time_relative_value(host.subscription_facet_attributes.registered_at)
295
303
  end
296
304
 
297
305
  def host_checkin_time(host)
298
- return _('Never checked in') unless host.subscription_facet_attributes&.last_checkin
306
+ return ''.html_safe unless host.subscription_facet_attributes&.last_checkin
299
307
 
300
308
  date_time_relative_value(host.subscription_facet_attributes.last_checkin)
301
309
  end
302
310
 
303
311
  private
304
312
 
305
- def hostgroup_content_facet(hostgroup, param_host)
306
- lifecycle_environment_id = hostgroup.inherited_lifecycle_environment_id
307
- content_view_id = hostgroup.inherited_content_view_id
313
+ def inherited_or_own_content_source_id(host_or_hostgroup, hostgroup)
308
314
  content_source_id = hostgroup.inherited_content_source_id
309
- if param_host.lifecycle_environment_id && (hostgroup.inherited_lifecycle_environment_id != param_host.lifecycle_environment_id)
310
- lifecycle_environment_id = param_host.lifecycle_environment_id
311
- end
312
- if param_host.content_view_id && (hostgroup.inherited_content_view_id != param_host.content_view_id)
313
- content_view_id = param_host.content_view_id
315
+ if host_or_hostgroup.content_source_id && (hostgroup.inherited_content_source_id != host_or_hostgroup.content_source_id)
316
+ content_source_id = host_or_hostgroup.content_source_id
314
317
  end
315
- if param_host.content_source_id && (hostgroup.inherited_content_source_id != param_host.content_source_id)
316
- content_source_id = param_host.content_source_id
318
+ content_source_id
319
+ end
320
+
321
+ def inherited_or_own_facet_attributes(host_or_hostgroup, hostgroup)
322
+ lifecycle_environment_id = hostgroup.inherited_lifecycle_environment_id
323
+ content_view_id = hostgroup.inherited_content_view_id
324
+ case host_or_hostgroup
325
+ when ::Hostgroup
326
+ if host_or_hostgroup.lifecycle_environment_id && (hostgroup.inherited_lifecycle_environment_id != host_or_hostgroup.lifecycle_environment_id)
327
+ lifecycle_environment_id = host_or_hostgroup.lifecycle_environment_id
328
+ end
329
+ if host_or_hostgroup.content_view_id && (hostgroup.inherited_content_view_id != host_or_hostgroup.content_view_id)
330
+ content_view_id = host_or_hostgroup.content_view_id
331
+ end
332
+ when ::Host::Managed
333
+ if host_or_hostgroup.single_lifecycle_environment && (hostgroup.inherited_lifecycle_environment_id != host_or_hostgroup.single_lifecycle_environment.id)
334
+ lifecycle_environment_id = host_or_hostgroup.single_lifecycle_environment.id
335
+ end
336
+ if host_or_hostgroup.single_content_view && (hostgroup.inherited_content_view_id != host_or_hostgroup.single_content_view.id)
337
+ content_view_id = host_or_hostgroup.single_content_view.id
338
+ end
317
339
  end
318
- ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_environment_id,
319
- :content_view_id => content_view_id,
320
- :content_source_id => content_source_id)
340
+ [lifecycle_environment_id, content_view_id]
341
+ end
342
+
343
+ def hostgroup_content_facet(hostgroup, param_host)
344
+ lifecycle_environment_id, content_view_id = inherited_or_own_facet_attributes(param_host, hostgroup)
345
+ content_source_id = inherited_or_own_content_source_id(param_host, hostgroup)
346
+ facet = ::Katello::Host::ContentFacet.new(:content_source_id => content_source_id)
347
+ facet.assign_single_environment(
348
+ :lifecycle_environment_id => lifecycle_environment_id,
349
+ :content_view_id => content_view_id
350
+ )
351
+ facet
321
352
  end
322
353
  end
323
354
  end
@@ -43,20 +43,5 @@ module Katello
43
43
  optional :content_type, String, desc: 'Content type', default: 'repos'
44
44
  returns String, desc: 'Absolute path to a file'
45
45
  end
46
- def repository_url(content_path, _content_type = nil, schema = 'http')
47
- return content_path if content_path =~ %r|^([\w\-\+]+)://|
48
- url = if @host.content_source
49
- "#{schema}://#{@host.content_source.hostname}"
50
- else
51
- foreman_settings_url(schema)
52
- end
53
- content_path = content_path.sub(%r|^/|, '')
54
- if @host.content_view && !@host.content_view.default?
55
- content_path = [@host.content_view.label, content_path].join('/')
56
- end
57
- path = ::Katello::Glue::Pulp::Repos.repo_path_from_content_path(
58
- @host.lifecycle_environment, content_path)
59
- "#{url}/pulp/content/#{path}"
60
- end
61
46
  end
62
47
  end
@@ -28,10 +28,6 @@ module Katello
28
28
  Product.syncable? && current_organization_object.syncable_content?
29
29
  end
30
30
 
31
- def error_state?(status)
32
- status[:raw_state] == PulpSyncStatus::ERROR && !status[:error_details].blank?
33
- end
34
-
35
31
  module RepoMethods
36
32
  # returns all repos in hash representation with minors and arch children included
37
33
  def collect_repos(products, env, include_feedless = true)
@@ -8,7 +8,7 @@ module Actions
8
8
 
9
9
  def run
10
10
  organization = ::Organization.find_by!(label: input[:label])
11
- output[:response] = ::Katello::Resources::Candlepin::Owner.destroy_imports(organization.label, true)
11
+ output[:response] = ::Katello::Resources::Candlepin::Owner.destroy_imports(organization.label, wait_until_complete: true)
12
12
  organization.redhat_provider.index_subscriptions
13
13
  end
14
14
  end
@@ -34,10 +34,6 @@ module Actions
34
34
  environment: environment,
35
35
  repository: repository)
36
36
  sequence do
37
- if smart_proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE)
38
- plan_action(Actions::Pulp::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
39
- end
40
-
41
37
  if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE)
42
38
  plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
43
39
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
@@ -2,7 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module CapsuleContent
4
4
  class SyncCapsule < ::Actions::EntryAction
5
- include Actions::Katello::PulpSelector
6
5
  # rubocop:disable Metrics/MethodLength
7
6
  def plan(smart_proxy, options = {})
8
7
  plan_self(:smart_proxy_id => smart_proxy.id)
@@ -18,7 +17,7 @@ module Actions
18
17
  repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
19
18
  concurrence do
20
19
  repo_batch.each do |repo|
21
- if smart_proxy.backend_service_type(repo) == Actions::Pulp3::Abstract::BACKEND_SERVICE_TYPE
20
+ if smart_proxy.pulp3_support?(repo)
22
21
  plan_action(Actions::Pulp3::CapsuleContent::Sync,
23
22
  repo, smart_proxy,
24
23
  skip_metadata_check: skip_metadata_check)
@@ -112,8 +112,12 @@ module Actions
112
112
  version.update_content_counts!
113
113
  # update errata applicability counts for all hosts in the CV & Library
114
114
  unless input[:skip_promotion]
115
- ::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
116
- :lifecycle_environment_id => input[:environment_id]).each do |facet|
115
+ content_view = ::Katello::ContentView.find(input[:content_view_id])
116
+ lifecycle_environment = ::Katello::KTEnvironment.find(input[:environment_id])
117
+ ::Katello::Host::ContentFacet.in_content_views_and_environments(
118
+ content_views: [content_view],
119
+ lifecycle_environments: [lifecycle_environment]
120
+ ).each do |facet|
117
121
  facet.update_applicability_counts
118
122
  facet.update_errata_status
119
123
  end
@@ -71,12 +71,18 @@ module Actions
71
71
  content_view_history_ids: cv_histories.map { |history| history.id })
72
72
 
73
73
  if organization_destroy
74
- content_view.hostgroups.destroy_all
75
- content_view.hosts.destroy_all
74
+ destroy_host_and_hostgroup_associations(content_view: content_view)
76
75
  end
77
76
  end
78
77
  end
79
78
 
79
+ def destroy_host_and_hostgroup_associations(content_view:)
80
+ content_view.hostgroups.destroy_all
81
+ host_ids = content_view.hosts.ids
82
+ ::Katello::Host::ContentFacet.where(:host_id => host_ids).destroy_all
83
+ ::Katello::Host::SubscriptionFacet.where(:host_id => host_ids).destroy_all
84
+ end
85
+
80
86
  def check_version_deletion(versions, cv_envs)
81
87
  versions.each do |version|
82
88
  version.environments.each do |env|
@@ -3,7 +3,7 @@ module Actions
3
3
  module ContentViewVersion
4
4
  class Destroy < Actions::Base
5
5
  def plan(version, options = {})
6
- version.validate_destroyable!(options[:skip_environment_check])
6
+ version.validate_destroyable!(skip_environment_check: options[:skip_environment_check])
7
7
 
8
8
  destroy_env_content = !options.fetch(:skip_destroy_env_content, false)
9
9
  repos = destroy_env_content ? version.repositories : version.archived_repos
@@ -24,14 +24,20 @@ module Actions
24
24
  end
25
25
 
26
26
  if organization_destroy
27
- env.hostgroups.clear
28
- env.hosts.clear
27
+ delete_host_and_hostgroup_associations(environment: env)
29
28
  end
30
29
 
31
30
  plan_self
32
31
  end
33
32
  end
34
33
 
34
+ def delete_host_and_hostgroup_associations(environment:)
35
+ environment.hostgroups.delete_all
36
+ host_ids = environment.hosts.ids
37
+ ::Katello::Host::ContentFacet.where(:host_id => host_ids).delete_all
38
+ ::Katello::Host::SubscriptionFacet.where(:host_id => host_ids).delete_all
39
+ end
40
+
35
41
  def humanized_name
36
42
  _("Delete Lifecycle Environment")
37
43
  end
@@ -3,8 +3,10 @@ module Actions
3
3
  module Host
4
4
  class Reassign < Actions::Base
5
5
  def plan(host, content_view_id, environment_id)
6
- host.content_facet.content_view = ::Katello::ContentView.find(content_view_id)
7
- host.content_facet.lifecycle_environment = ::Katello::KTEnvironment.find(environment_id)
6
+ host.content_facet.assign_single_environment(
7
+ content_view: ::Katello::ContentView.find(content_view_id),
8
+ lifecycle_environment: ::Katello::KTEnvironment.find(environment_id)
9
+ )
8
10
  host.update_candlepin_associations
9
11
  end
10
12
  end
@@ -7,7 +7,6 @@ module Actions
7
7
  end
8
8
  def plan(proxy)
9
9
  sequence do
10
- plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy) if (proxy.has_feature?(SmartProxy::PULP_FEATURE) || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE))
11
10
  if proxy.pulp3_enabled?
12
11
  plan_action(
13
12
  Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans,
@@ -46,8 +46,9 @@ module Actions
46
46
  product_id: product.cp_id,
47
47
  content_id: pc.content.cp_content_id)
48
48
  end
49
- plan_action(Candlepin::Product::Destroy, cp_id: product.cp_id, :owner => product.organization.label)
50
49
  end
50
+
51
+ plan_action(Candlepin::Product::Destroy, cp_id: product.cp_id, :owner => product.organization.label)
51
52
  end
52
53
 
53
54
  clear_pool_associations(product)
@@ -34,7 +34,7 @@ module Actions
34
34
  input[:upload_actions].each { |action| uploaded_content_unit_hrefs << action.try(:[], "content_unit_href") }
35
35
  unit_ids = uploaded_content_unit_hrefs.compact
36
36
  else
37
- unit_ids = search_units(repo)
37
+ unit_ids = []
38
38
  end
39
39
  ::Katello::Deb.import_all(unit_ids, repo, {filtered_indexing: true})
40
40
  elsif repo.yum?
@@ -45,7 +45,7 @@ module Actions
45
45
  input[:upload_actions].each { |action| uploaded_content_unit_hrefs << action.try(:[], "content_unit_href") }
46
46
  unit_ids = uploaded_content_unit_hrefs.compact
47
47
  else
48
- unit_ids = search_units(repo)
48
+ unit_ids = []
49
49
  end
50
50
  if input[:content_type] == ::Katello::Srpm::CONTENT_TYPE
51
51
  ::Katello::Srpm.import_all(unit_ids, repo, {filtered_indexing: true})
@@ -54,14 +54,6 @@ module Actions
54
54
  end
55
55
  end
56
56
  end
57
-
58
- private
59
-
60
- def search_units(repo)
61
- found = repo.unit_search(:type_ids => [input[:content_type]],
62
- :filters => input[:filter])
63
- found.map { |result| result.try(:[], :unit_id) }.compact
64
- end
65
57
  end
66
58
  end
67
59
  end
@@ -3,7 +3,6 @@ module Actions
3
3
  module Katello
4
4
  module Repository
5
5
  class ImportUpload < Actions::EntryAction
6
- include Actions::Katello::PulpSelector
7
6
  # rubocop:disable Metrics/MethodLength
8
7
  def plan(repository, uploads, options = {})
9
8
  action_subject(repository)
@@ -49,7 +49,6 @@ module Actions
49
49
  plan_action(Katello::Repository::IndexContent, :id => repo.id, :force_index => skip_metadata_check)
50
50
  plan_action(Katello::Foreman::ContentUpdate, repo.environment, repo.content_view, repo)
51
51
  plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
52
- plan_action(Katello::Repository::CorrectChecksum, repo)
53
52
  concurrence do
54
53
  plan_action(Katello::Repository::ErrataMail, repo)
55
54
  plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability
@@ -2,8 +2,7 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class Update < Actions::EntryAction
5
- include Actions::Katello::PulpSelector
6
-
5
+ # rubocop:disable Metrics/MethodLength
7
6
  def plan(root, repo_params)
8
7
  repository = root.library_instance
9
8
  action_subject root.library_instance
@@ -46,7 +45,10 @@ module Actions
46
45
  SmartProxy.pulp_primary)
47
46
  plan_self(:repository_id => root.library_instance.id)
48
47
  if update_cv_cert_protected
49
- plan_optional_pulp_action([::Actions::Pulp3::Orchestration::Repository::TriggerUpdateRepoCertGuard], repository, ::SmartProxy.pulp_primary)
48
+ smart_proxy = ::SmartProxy.pulp_primary
49
+ if smart_proxy.pulp3_support?(repository)
50
+ plan_action(::Actions::Pulp3::Orchestration::Repository::TriggerUpdateRepoCertGuard, repository, smart_proxy)
51
+ end
50
52
  end
51
53
 
52
54
  handle_alternate_content_sources(repository, create_acs, delete_acs, old_url)
@@ -6,7 +6,6 @@ module Actions
6
6
  module Katello
7
7
  module Repository
8
8
  class UploadFiles < Actions::EntryAction
9
- include Actions::Katello::PulpSelector
10
9
  def plan(repository, files, content_type = nil, options = {})
11
10
  action_subject(repository)
12
11
  repository.clear_smart_proxy_sync_histories
@@ -4,12 +4,6 @@ module Actions
4
4
  middleware.use ::Actions::Middleware::RemoteAction
5
5
  middleware.use Actions::Middleware::Pulp3ServicesCheck
6
6
 
7
- BACKEND_SERVICE_TYPE = 'pulp3'.freeze
8
-
9
- def self.backend_service_type
10
- BACKEND_SERVICE_TYPE
11
- end
12
-
13
7
  def smart_proxy
14
8
  SmartProxy.unscoped.find(input[:smart_proxy_id])
15
9
  end
@@ -14,8 +14,7 @@ module Actions
14
14
  to_delete = content_view.repository_references.select do |repository_reference|
15
15
  repo = repository_reference.root_repository.library_instance
16
16
  if delete_href?(repository_reference.repository_href, content_view)
17
- #force pulp3 in case we've done migrations, but haven't switched over yet
18
- tasks << repo.backend_service(smart_proxy, true).delete_repository(repository_reference)
17
+ tasks << repo.backend_service(smart_proxy).delete_repository(repository_reference)
19
18
  true
20
19
  else
21
20
  false
@@ -6,6 +6,7 @@ module Actions
6
6
  param :smart_proxy_id, Integer
7
7
  param :base_path, String
8
8
  param :content_view_version_id, Integer
9
+ param :from_content_view_version_id, Integer
9
10
  param :destination_server, String
10
11
  end
11
12
 
@@ -18,8 +19,10 @@ module Actions
18
19
  smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
19
20
  output[:path] = input[:base_path]
20
21
  cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
22
+ from_cvv = ::Katello::ContentViewVersion.find(input[:from_content_view_version_id]) unless input[:from_content_view_version_id].blank?
21
23
  export_metadata = ::Katello::Pulp3::ContentViewVersion::Export.create(
22
24
  content_view_version: cvv,
25
+ from_content_view_version: from_cvv,
23
26
  smart_proxy: smart_proxy,
24
27
  format: input[:format]).generate_metadata
25
28
 
@@ -30,6 +33,7 @@ module Actions
30
33
  metadata: export_metadata,
31
34
  audit_comment: ::Katello::ContentViewVersionExportHistory.generate_audit_comment(content_view_version: cvv,
32
35
  user: User.current,
36
+ from_version: from_cvv,
33
37
  metadata: export_metadata)
34
38
  )
35
39
  output[:export_history_id] = history.id
@@ -28,6 +28,7 @@ module Actions
28
28
  sequence do
29
29
  export_output = plan_action(SyncableExport,
30
30
  content_view_version: content_view_version,
31
+ from_content_view_version: from_history&.content_view_version,
31
32
  smart_proxy: smart_proxy,
32
33
  destination_server: destination_server).output
33
34
  plan_self(export_history_id: export_output[:export_history_id],
@@ -49,11 +49,16 @@ module Actions
49
49
  end
50
50
 
51
51
  def validate_export_types!(repository, format)
52
- unless ::Katello::Repository.exportable(format: format).where(id: repository.id).exists?
52
+ return if ::Katello::Repository.exportable(format: format).where(id: repository.id).exists?
53
+ if format == ::Katello::Pulp3::ContentViewVersion::Export::SYNCABLE
53
54
  fail _("NOTE: Unable to export repository '%{repository}' because"\
54
- " it does not have an exportable content type."\
55
+ " it does not have an syncably exportable content type."\
55
56
  % { repository: repository.name })
56
57
  end
58
+
59
+ fail _("NOTE: Unable to export repository '%{repository}' because"\
60
+ " it does not have an exportable content type."\
61
+ % { repository: repository.name })
57
62
  end
58
63
  end
59
64
  end