katello 4.7.4 → 4.8.0.rc2

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 (356) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +8 -22
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -12
  4. data/app/controllers/katello/api/v2/alternate_content_sources_controller.rb +7 -5
  5. data/app/controllers/katello/api/v2/capsule_content_controller.rb +0 -4
  6. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +22 -81
  7. data/app/controllers/katello/api/v2/content_exports_controller.rb +11 -80
  8. data/app/controllers/katello/api/v2/content_imports_controller.rb +1 -0
  9. data/app/controllers/katello/api/v2/exports_controller.rb +130 -0
  10. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +7 -8
  11. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +8 -4
  12. data/app/controllers/katello/api/v2/organizations_controller.rb +3 -0
  13. data/app/controllers/katello/api/v2/package_groups_controller.rb +0 -52
  14. data/app/controllers/katello/api/v2/repositories_controller.rb +3 -18
  15. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -6
  16. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -2
  17. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +4 -1
  18. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +24 -0
  19. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +3 -3
  20. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +59 -23
  21. data/app/helpers/katello/katello_urls_helper.rb +0 -15
  22. data/app/helpers/katello/sync_management_helper.rb +0 -4
  23. data/app/lib/actions/candlepin/owner/destroy_imports.rb +1 -1
  24. data/app/lib/actions/katello/alternate_content_source/create.rb +3 -1
  25. data/app/lib/actions/katello/alternate_content_source/update.rb +3 -1
  26. data/app/lib/actions/katello/capsule_content/sync.rb +0 -4
  27. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +1 -2
  28. data/app/lib/actions/katello/content_view/publish.rb +6 -2
  29. data/app/lib/actions/katello/content_view/remove.rb +8 -2
  30. data/app/lib/actions/katello/content_view_version/destroy.rb +1 -1
  31. data/app/lib/actions/katello/environment/destroy.rb +8 -2
  32. data/app/lib/actions/katello/host/reassign.rb +4 -2
  33. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +0 -1
  34. data/app/lib/actions/katello/product/destroy.rb +2 -1
  35. data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -10
  36. data/app/lib/actions/katello/repository/import_upload.rb +0 -1
  37. data/app/lib/actions/katello/repository/sync.rb +0 -1
  38. data/app/lib/actions/katello/repository/update.rb +5 -3
  39. data/app/lib/actions/katello/repository/upload_files.rb +0 -1
  40. data/app/lib/actions/pulp3/abstract.rb +0 -6
  41. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -2
  42. data/app/lib/actions/pulp3/content_view_version/create_syncable_export_history.rb +4 -0
  43. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +1 -1
  44. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +12 -11
  45. data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +7 -2
  46. data/app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb +7 -4
  47. data/app/lib/actions/pulp3/repository/reclaim_space.rb +1 -1
  48. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -2
  49. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +2 -2
  50. data/app/lib/katello/api/v2/error_handling.rb +12 -2
  51. data/app/lib/katello/concerns/base_template_scope_extensions.rb +7 -3
  52. data/app/lib/katello/concerns/renderer_extensions.rb +1 -1
  53. data/app/lib/katello/event_daemon/runner.rb +12 -9
  54. data/app/lib/katello/resources/candlepin/consumer.rb +6 -6
  55. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  56. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +3 -4
  57. data/app/lib/katello/resources/candlepin.rb +4 -4
  58. data/app/lib/katello/util/errata.rb +12 -10
  59. data/app/lib/katello/util/search.rb +0 -1
  60. data/app/lib/katello/validators/content_view_environment_org_validator.rb +5 -2
  61. data/app/lib/katello/validators/content_view_environment_validator.rb +1 -2
  62. data/app/lib/katello/validators/generated_content_view_validator.rb +16 -0
  63. data/app/mailers/katello/errata_mailer.rb +4 -2
  64. data/app/models/katello/alternate_content_source.rb +59 -5
  65. data/app/models/katello/concerns/content_facet_host_extensions.rb +25 -14
  66. data/app/models/katello/concerns/host_managed_extensions.rb +31 -8
  67. data/app/models/katello/concerns/redhat_extensions.rb +16 -6
  68. data/app/models/katello/concerns/smart_proxy_extensions.rb +0 -12
  69. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -0
  70. data/app/models/katello/content_view.rb +22 -5
  71. data/app/models/katello/content_view_environment.rb +11 -2
  72. data/app/models/katello/content_view_environment_content_facet.rb +9 -0
  73. data/app/models/katello/content_view_version.rb +10 -5
  74. data/app/models/katello/erratum.rb +6 -1
  75. data/app/models/katello/glue/candlepin/pool.rb +6 -0
  76. data/app/models/katello/glue/candlepin/product.rb +7 -1
  77. data/app/models/katello/glue/candlepin/subscription.rb +5 -0
  78. data/app/models/katello/glue/provider.rb +26 -26
  79. data/app/models/katello/host/content_facet.rb +108 -18
  80. data/app/models/katello/host/info_provider.rb +25 -21
  81. data/app/models/katello/host/subscription_facet.rb +18 -14
  82. data/app/models/katello/kt_environment.rb +12 -7
  83. data/app/models/katello/package_group.rb +0 -12
  84. data/app/models/katello/pool.rb +4 -1
  85. data/app/models/katello/product.rb +11 -1
  86. data/app/models/katello/repository.rb +11 -11
  87. data/app/models/katello/root_repository.rb +5 -4
  88. data/app/models/katello/task_status.rb +0 -18
  89. data/app/services/katello/candlepin/consumer.rb +2 -2
  90. data/app/services/katello/host/package_profile_uploader.rb +1 -1
  91. data/app/services/katello/product_content_finder.rb +11 -8
  92. data/app/services/katello/pulp3/content_view_version/export.rb +8 -65
  93. data/app/services/katello/pulp3/content_view_version/export_validation_error.rb +7 -0
  94. data/app/services/katello/pulp3/content_view_version/export_validator.rb +121 -0
  95. data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -1
  96. data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +7 -1
  97. data/app/services/katello/pulp3/erratum.rb +1 -0
  98. data/app/services/katello/pulp3/module_stream.rb +26 -11
  99. data/app/services/katello/pulp3/repository/yum.rb +2 -1
  100. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +2 -1
  101. data/app/services/katello/registration_manager.rb +46 -26
  102. data/app/services/katello/repository_type.rb +3 -9
  103. data/app/services/katello/simple_package.rb +22 -0
  104. data/app/views/foreman/smart_proxies/_content_sync.html.erb +2 -1
  105. data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +1 -0
  106. data/app/views/katello/api/v2/content_facet/base.json.rabl +23 -2
  107. data/app/views/katello/api/v2/content_facet/show.json.rabl +11 -8
  108. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  109. data/app/views/katello/api/v2/hosts/base.json.rabl +22 -2
  110. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +2 -2
  111. data/config/initializers/monkeys.rb +0 -2
  112. data/config/routes/api/registry.rb +8 -7
  113. data/config/routes/api/v2.rb +0 -2
  114. data/config/routes.rb +3 -0
  115. data/db/migrate/20200429153103_installed_package_bad_nvrea.rb +1 -1
  116. data/db/migrate/20220228173251_remove_drpm_from_ignorable_content.rb +7 -3
  117. data/db/migrate/20220419193414_content_settings_to_dsl_category.rb +1 -1
  118. data/db/migrate/20220929204746_add_content_view_environment_content_facet.rb +52 -0
  119. data/db/migrate/20221123212341_remove_pulp_docker_registry_port_setting.rb +5 -0
  120. data/db/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb +1 -1
  121. data/db/migrate/20230203141353_set_new_acs_verify_ssl_default.rb +5 -0
  122. data/db/seeds.d/111-upgrade_tasks.rb +3 -1
  123. data/engines/bastion/app/assets/stylesheets/bastion/bastion.scss +4 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -4
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +0 -1
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -4
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -1
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +11 -3
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +8 -4
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +5485 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +5397 -0
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +5658 -0
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +5284 -0
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ka.po +5231 -0
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +5275 -0
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +5389 -0
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +5212 -0
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +5145 -0
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -0
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +2 -2
  142. data/lib/katello/engine.rb +2 -1
  143. data/lib/katello/permission_creator.rb +2 -4
  144. data/lib/katello/permissions/registry_permissions.rb +5 -5
  145. data/lib/katello/plugin.rb +22 -14
  146. data/lib/katello/repository_types/README.md +136 -19
  147. data/lib/katello/repository_types/deb.rb +0 -1
  148. data/lib/katello/repository_types/docker.rb +0 -1
  149. data/lib/katello/repository_types/file.rb +0 -1
  150. data/lib/katello/repository_types/yum.rb +0 -4
  151. data/lib/katello/tasks/clean_candlepin_orphaned_products.rake +38 -0
  152. data/lib/katello/tasks/clean_orphaned_facets.rb +20 -0
  153. data/lib/katello/tasks/reimport.rake +1 -2
  154. data/lib/katello/tasks/repository.rake +1 -22
  155. data/lib/katello/tasks/reset.rake +1 -0
  156. data/lib/katello/tasks/upgrades/4.8/fix_incorrect_providers.rake +29 -0
  157. data/lib/katello/tasks/upgrades/4.8/regenerate_imported_repository_metadata.rake +33 -0
  158. data/lib/katello/version.rb +1 -1
  159. data/lib/katello.rb +0 -5
  160. data/locale/bn/katello.po +69 -27
  161. data/locale/cs/katello.po +69 -27
  162. data/locale/de/katello.po +78 -36
  163. data/locale/en/katello.po +69 -27
  164. data/locale/es/katello.po +70 -28
  165. data/locale/fr/katello.po +73 -31
  166. data/locale/gu/katello.po +69 -27
  167. data/locale/hi/katello.po +69 -27
  168. data/locale/it/katello.po +69 -27
  169. data/locale/ja/katello.po +73 -31
  170. data/locale/ka/katello.po +73 -31
  171. data/locale/katello.pot +335 -262
  172. data/locale/kn/katello.po +69 -27
  173. data/locale/ko/katello.po +69 -27
  174. data/locale/mr/katello.po +69 -27
  175. data/locale/or/katello.po +69 -27
  176. data/locale/pa/katello.po +69 -27
  177. data/locale/pt/katello.po +69 -27
  178. data/locale/pt_BR/katello.po +70 -28
  179. data/locale/ru/katello.po +70 -28
  180. data/locale/ta/katello.po +69 -27
  181. data/locale/te/katello.po +69 -27
  182. data/locale/zh_CN/katello.po +73 -31
  183. data/locale/zh_TW/katello.po +70 -28
  184. data/webpack/components/Content/ContentPage.js +51 -35
  185. data/webpack/components/Content/__tests__/ContentPage.test.js +2 -4
  186. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +22 -3
  187. data/webpack/components/Table/EmptyStateMessage.js +14 -11
  188. data/webpack/components/Table/MainTable.js +36 -15
  189. data/webpack/components/Table/TableWrapper.js +25 -25
  190. data/webpack/components/Table/__test__/emptyStateMessage.test.js +51 -0
  191. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +10 -72
  192. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +5 -4
  193. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +1 -1
  194. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsModal.test.js +1 -17
  195. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +18 -9
  196. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -2
  197. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +1 -2
  198. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +1 -2
  199. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +47 -27
  200. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +1 -2
  201. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -21
  202. data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +1 -28
  203. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +1 -10
  204. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +1 -18
  205. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +1 -17
  206. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -15
  207. data/webpack/global_test_setup.js +1 -1
  208. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -3
  209. data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +12 -10
  210. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +6 -0
  211. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +1 -0
  212. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +3 -10
  213. data/webpack/scenes/AlternateContentSources/Create/Steps/NameACS.js +1 -0
  214. data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +3 -3
  215. data/webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js +6 -5
  216. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditCredentials.js +1 -0
  217. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +3 -1
  218. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditProducts.js +1 -0
  219. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditSmartProxies.js +2 -0
  220. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +13 -4
  221. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +7 -4
  222. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +4 -8
  223. data/webpack/scenes/AlternateContentSources/helpers.js +1 -1
  224. data/webpack/scenes/Content/Details/ContentRepositories.js +5 -4
  225. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +1 -12
  226. data/webpack/scenes/Content/Table/ContentTable.js +2 -1
  227. data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -14
  228. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -25
  229. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  230. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +44 -31
  231. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +3 -0
  232. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +6 -1
  233. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +2 -1
  234. data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +2 -1
  235. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +3 -1
  236. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -1
  237. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
  238. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -1
  239. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +2 -0
  240. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
  241. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +1 -1
  242. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +1 -1
  243. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +35 -33
  244. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +48 -45
  245. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +58 -24
  246. data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +64 -0
  247. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +36 -20
  248. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +40 -23
  249. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +0 -13
  250. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +0 -13
  251. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -1
  252. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -10
  253. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
  254. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -10
  255. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +21 -9
  256. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +4 -0
  257. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +1 -32
  258. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +3 -1
  259. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -15
  260. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +1 -1
  261. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +1 -2
  262. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -9
  263. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +4 -0
  264. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +30 -14
  265. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
  266. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +55 -120
  267. data/webpack/scenes/ContentViews/components/ContentViewSelect/ContentViewSelectOption.js +87 -0
  268. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +1 -1
  269. data/webpack/scenes/ContentViews/components/WizardHeader.js +1 -1
  270. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +1 -1
  271. data/webpack/scenes/ContentViews/expansions/__tests__/contentViewComponentsModal.test.js +8 -1
  272. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +153 -28
  273. data/webpack/scenes/Hosts/ChangeContentSource/index.js +14 -15
  274. data/webpack/scenes/Hosts/ChangeContentSource/selectors.js +4 -0
  275. data/webpack/scenes/Hosts/ChangeContentSource/styles.scss +4 -0
  276. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +3 -9
  277. data/webpack/scenes/ModuleStreams/__tests__/__snapshots__/ModuleStreamPage.test.js.snap +7 -1
  278. data/webpack/scenes/RedHatRepositories/components/Search.js +22 -16
  279. data/webpack/scenes/RedHatRepositories/index.scss +20 -1
  280. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +12 -1
  281. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +1 -1
  282. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +1 -1
  283. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +21 -19
  284. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +34 -1
  285. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +20 -7
  286. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +0 -1
  287. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +65 -15
  288. metadata +52 -115
  289. data/app/lib/actions/katello/pulp_selector.rb +0 -24
  290. data/app/lib/actions/katello/repository/correct_checksum.rb +0 -24
  291. data/app/lib/actions/katello/repository/destroy_package_group.rb +0 -26
  292. data/app/lib/actions/katello/repository/upload_package_group.rb +0 -24
  293. data/app/lib/actions/pulp/abstract.rb +0 -37
  294. data/app/lib/actions/pulp/abstract_async_task.rb +0 -154
  295. data/app/lib/actions/pulp/abstract_async_task_group.rb +0 -94
  296. data/app/lib/actions/pulp/consumer/sync_capsule.rb +0 -45
  297. data/app/lib/actions/pulp/consumer/unassociate_units.rb +0 -20
  298. data/app/lib/actions/pulp/expect_one_task.rb +0 -11
  299. data/app/lib/actions/pulp/orchestration/orphan_cleanup/remove_orphans.rb +0 -16
  300. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +0 -19
  301. data/app/lib/actions/pulp/orchestration/repository/delete.rb +0 -15
  302. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +0 -14
  303. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +0 -13
  304. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -19
  305. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +0 -14
  306. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +0 -34
  307. data/app/lib/actions/pulp/orchestration/repository/sync.rb +0 -18
  308. data/app/lib/actions/pulp/orchestration/repository/upload_content.rb +0 -37
  309. data/app/lib/actions/pulp/orphan_cleanup/remove_orphans.rb +0 -15
  310. data/app/lib/actions/pulp/orphan_cleanup/remove_unneeded_repos.rb +0 -16
  311. data/app/lib/actions/pulp/repository/abstract_copy_content.rb +0 -45
  312. data/app/lib/actions/pulp/repository/abstract_remove_content.rb +0 -32
  313. data/app/lib/actions/pulp/repository/clear.rb +0 -18
  314. data/app/lib/actions/pulp/repository/copy_all_units.rb +0 -30
  315. data/app/lib/actions/pulp/repository/copy_units.rb +0 -25
  316. data/app/lib/actions/pulp/repository/create.rb +0 -28
  317. data/app/lib/actions/pulp/repository/create_in_plan.rb +0 -15
  318. data/app/lib/actions/pulp/repository/create_upload_request.rb +0 -20
  319. data/app/lib/actions/pulp/repository/delete_upload_request.rb +0 -19
  320. data/app/lib/actions/pulp/repository/destroy.rb +0 -28
  321. data/app/lib/actions/pulp/repository/distributor_publish.rb +0 -25
  322. data/app/lib/actions/pulp/repository/download.rb +0 -16
  323. data/app/lib/actions/pulp/repository/import_upload.rb +0 -19
  324. data/app/lib/actions/pulp/repository/presenters/abstract_sync_presenter.rb +0 -47
  325. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +0 -95
  326. data/app/lib/actions/pulp/repository/presenters/docker_presenter.rb +0 -103
  327. data/app/lib/actions/pulp/repository/presenters/file_unit_presenter.rb +0 -42
  328. data/app/lib/actions/pulp/repository/presenters/yum_presenter.rb +0 -131
  329. data/app/lib/actions/pulp/repository/refresh.rb +0 -21
  330. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +0 -21
  331. data/app/lib/actions/pulp/repository/remove_distribution.rb +0 -11
  332. data/app/lib/actions/pulp/repository/remove_units.rb +0 -44
  333. data/app/lib/actions/pulp/repository/sync.rb +0 -99
  334. data/app/lib/actions/pulp/repository/upload_file.rb +0 -28
  335. data/app/lib/actions/pulp/repository_group/create.rb +0 -31
  336. data/app/lib/actions/pulp/repository_group/delete.rb +0 -17
  337. data/app/lib/actions/pulp/repository_group/export.rb +0 -51
  338. data/app/lib/katello/util/package_clause_generator.rb +0 -77
  339. data/app/models/katello/glue/pulp/pulp_errors.rb +0 -9
  340. data/app/models/katello/glue/pulp/repo.rb +0 -353
  341. data/app/models/katello/pulp_sync_status.rb +0 -165
  342. data/app/models/katello/pulp_task_status.rb +0 -63
  343. data/app/services/katello/pulp/content.rb +0 -24
  344. data/app/services/katello/pulp/importer_comparison.rb +0 -28
  345. data/app/services/katello/pulp/repository/deb.rb +0 -61
  346. data/app/services/katello/pulp/repository/docker.rb +0 -82
  347. data/app/services/katello/pulp/repository/file.rb +0 -52
  348. data/app/services/katello/pulp/repository/yum.rb +0 -205
  349. data/app/services/katello/pulp/repository.rb +0 -327
  350. data/app/services/katello/pulp/server.rb +0 -35
  351. data/app/services/katello/pulp/simple_package.rb +0 -24
  352. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -52
  353. data/lib/monkeys/fix_deb_optimized_sync.rb +0 -35
  354. data/lib/monkeys/fix_pulp_container_path.rb +0 -35
  355. data/locale/zanata.xml +0 -30
  356. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentSearch.fixtures.json +0 -33
@@ -281,7 +281,10 @@ module Katello
281
281
  version_environment[:environments] << cve.environment unless version_environment[:environments].include?(cve.environment)
282
282
  version_environment[:next_version] ||= version.next_incremental_version
283
283
  version_environment[:content_host_count] ||= 0
284
- version_environment[:content_host_count] += content_facets.where(:content_view_id => cve.content_view).where(:lifecycle_environment_id => cve.environment).count
284
+ version_environment[:content_host_count] += content_facets.in_content_views_and_environments(
285
+ content_views: [cve.content_view],
286
+ lifecycle_environments: [cve.environment]
287
+ ).count
285
288
 
286
289
  if version.content_view.composite?
287
290
  version_environment[:components] = version.components_needing_errata(@errata)
@@ -323,9 +326,10 @@ module Katello
323
326
 
324
327
  hosts.each do |host|
325
328
  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.assign_single_environment(
330
+ :content_view_id => content_view.id,
331
+ :environment_id => lifecycle_environment.id
332
+ )
329
333
  host.content_facet.content_source = content_source
330
334
 
331
335
  host.update_candlepin_associations
@@ -82,6 +82,9 @@ module Katello
82
82
  respond_for_create :resource => @organization
83
83
  rescue => e
84
84
  ::Foreman::Logging.exception('Could not create organization', e)
85
+ # Force @organization.errors to be populated
86
+ # Organization.new may raise so @organization may not be set
87
+ @organization&.valid?
85
88
  process_resource_error(message: e.message, resource: @organization)
86
89
  end
87
90
 
@@ -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)
@@ -7,7 +7,7 @@ module Katello
7
7
  generic_repo_wrap_params << option.name
8
8
  end
9
9
 
10
- repo_wrap_params = RootRepository.attribute_names + [:mirror_on_sync] + generic_repo_wrap_params
10
+ repo_wrap_params = RootRepository.attribute_names + generic_repo_wrap_params
11
11
 
12
12
  wrap_parameters :repository, :include => repo_wrap_params
13
13
 
@@ -55,7 +55,6 @@ module Katello
55
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
56
  param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum, deb, and docker repos (either 'immediate' or 'on_demand')")
57
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")
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)")
59
58
  param :mirroring_policy, Katello::RootRepository::MIRRORING_POLICIES, :desc => N_("Policy to set for mirroring content. Must be one of %s.") % RootRepository::MIRRORING_POLICIES
60
59
  param :verify_ssl_on_sync, :bool, :desc => N_("if true, Katello will verify the upstream url's SSL certifcates are signed by a trusted CA")
61
60
  param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
@@ -580,7 +579,7 @@ module Katello
580
579
 
581
580
  # rubocop:disable Metrics/CyclomaticComplexity
582
581
  def repository_params
583
- keys = [:download_policy, :mirror_on_sync, :mirroring_policy, :sync_policy, :arch, :verify_ssl_on_sync, :upstream_password,
582
+ keys = [:download_policy, :mirroring_policy, :sync_policy, :arch, :verify_ssl_on_sync, :upstream_password,
584
583
  :upstream_username, :download_concurrency, :upstream_authentication_token,
585
584
  {:os_versions => []}, :deb_releases, :deb_components, :deb_architectures, :description,
586
585
  :http_proxy_policy, :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
@@ -604,8 +603,7 @@ module Katello
604
603
  keys += [:url, :gpg_key_id, :ssl_ca_cert_id, :ssl_client_cert_id, :ssl_client_key_id, :unprotected, :name,
605
604
  :checksum_type]
606
605
  end
607
- to_return = params.require(:repository).permit(*keys).to_h.with_indifferent_access
608
- handle_mirror_on_sync(to_return)
606
+ params.require(:repository).permit(*keys).to_h.with_indifferent_access
609
607
  end
610
608
 
611
609
  def get_content_credential(repo_params, content_type)
@@ -664,19 +662,6 @@ module Katello
664
662
  end
665
663
  # rubocop:enable Metrics/CyclomaticComplexity,Metrics/MethodLength
666
664
 
667
- def handle_mirror_on_sync(repo_params)
668
- if !repo_params.key?(:mirroring_policy) && repo_params.key?(:mirror_on_sync)
669
- ::Foreman::Deprecation.api_deprecation_warning("mirror_on_sync is deprecated in favor of mirroring_policy. It will be removed in Katello 4.8.")
670
- if ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync])
671
- repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_CONTENT
672
- else
673
- repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_ADDITIVE
674
- end
675
- end
676
- repo_params.delete(:mirror_on_sync)
677
- repo_params
678
- end
679
-
680
665
  def error_on_rh_product
681
666
  fail HttpErrors::BadRequest, _("Red Hat products cannot be manipulated.") if @product.redhat?
682
667
  end
@@ -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,14 @@ 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
+ if host.single_content_view_environment?
216
+ # assign new_host the same CVE as host
217
+ new_host.content_facet.assign_single_environment(
218
+ :lifecycle_environment => host.content_facet.single_lifecycle_environment,
219
+ :content_view => host.content_facet.single_content_view
220
+ )
221
+ end
213
222
  end
214
223
  new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
215
224
  else
@@ -243,9 +252,11 @@ module Katello
243
252
  content_view = fetch_inherited_param(host_params[:content_view_id], ::Katello::ContentView, parent&.content_view)
244
253
  content_source = fetch_inherited_param(host_params[:content_source_id], ::SmartProxy, parent&.content_source)
245
254
 
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)
255
+ host.content_facet = Host::ContentFacet.new(:content_source => content_source)
256
+ host.content_facet.assign_single_environment(
257
+ :lifecycle_environment_id => lifecycle_env.id,
258
+ :content_view_id => content_view.id
259
+ )
249
260
  if host.operatingsystem.is_a?(Redhat)
250
261
  view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
251
262
  end
@@ -289,35 +300,60 @@ module Katello
289
300
  end
290
301
 
291
302
  def host_registered_time(host)
292
- return _('Never registered') unless host.subscription_facet_attributes&.registered_at
303
+ return ''.html_safe unless host.subscription_facet_attributes&.registered_at
293
304
 
294
305
  date_time_relative_value(host.subscription_facet_attributes.registered_at)
295
306
  end
296
307
 
297
308
  def host_checkin_time(host)
298
- return _('Never checked in') unless host.subscription_facet_attributes&.last_checkin
309
+ return ''.html_safe unless host.subscription_facet_attributes&.last_checkin
299
310
 
300
311
  date_time_relative_value(host.subscription_facet_attributes.last_checkin)
301
312
  end
302
313
 
303
314
  private
304
315
 
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
316
+ def inherited_or_own_content_source_id(host_or_hostgroup, hostgroup)
308
317
  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
318
+ if host_or_hostgroup.content_source_id && (hostgroup.inherited_content_source_id != host_or_hostgroup.content_source_id)
319
+ content_source_id = host_or_hostgroup.content_source_id
311
320
  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
321
+ content_source_id
322
+ end
323
+
324
+ def inherited_or_own_facet_attributes(host_or_hostgroup, hostgroup)
325
+ lifecycle_environment_id = hostgroup.inherited_lifecycle_environment_id
326
+ content_view_id = hostgroup.inherited_content_view_id
327
+ case host_or_hostgroup
328
+ when ::Hostgroup
329
+ if host_or_hostgroup.lifecycle_environment_id && (hostgroup.inherited_lifecycle_environment_id != host_or_hostgroup.lifecycle_environment_id)
330
+ lifecycle_environment_id = host_or_hostgroup.lifecycle_environment_id
331
+ end
332
+ if host_or_hostgroup.content_view_id && (hostgroup.inherited_content_view_id != host_or_hostgroup.content_view_id)
333
+ content_view_id = host_or_hostgroup.content_view_id
334
+ end
335
+ when ::Host::Managed
336
+ if host_or_hostgroup.single_lifecycle_environment && (hostgroup.inherited_lifecycle_environment_id != host_or_hostgroup.single_lifecycle_environment.id)
337
+ lifecycle_environment_id = host_or_hostgroup.single_lifecycle_environment.id
338
+ end
339
+ if host_or_hostgroup.single_content_view && (hostgroup.inherited_content_view_id != host_or_hostgroup.single_content_view.id)
340
+ content_view_id = host_or_hostgroup.single_content_view.id
341
+ end
314
342
  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
343
+ [lifecycle_environment_id, content_view_id]
344
+ end
345
+
346
+ def hostgroup_content_facet(hostgroup, param_host)
347
+ lifecycle_environment_id, content_view_id = inherited_or_own_facet_attributes(param_host, hostgroup)
348
+ content_source_id = inherited_or_own_content_source_id(param_host, hostgroup)
349
+ facet = ::Katello::Host::ContentFacet.new(:content_source_id => content_source_id)
350
+ if content_view_id && lifecycle_environment_id
351
+ facet.assign_single_environment(
352
+ :lifecycle_environment_id => lifecycle_environment_id,
353
+ :content_view_id => content_view_id
354
+ )
317
355
  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)
356
+ facet
321
357
  end
322
358
  end
323
359
  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
@@ -7,7 +7,9 @@ module Actions
7
7
  def plan(acs, smart_proxies, products = nil)
8
8
  acs.save!
9
9
  action_subject(acs)
10
- acs.products << products if products.present?
10
+ if products.present?
11
+ acs.update!(products: products)
12
+ end
11
13
  smart_proxies = smart_proxies.present? ? smart_proxies.uniq : []
12
14
  concurrence do
13
15
  smart_proxies.each do |smart_proxy|
@@ -19,7 +19,7 @@ module Actions
19
19
  products_to_associate = []
20
20
  products_to_disassociate = []
21
21
 
22
- if acs.simplified?
22
+ if products.present? || acs.products.present?
23
23
  products = products.uniq
24
24
  products_to_associate = products - acs.products
25
25
  products_to_disassociate = acs.products - products
@@ -28,6 +28,8 @@ module Actions
28
28
  acs.audit_updated_products(old_product_ids) unless products_to_associate.empty? && products_to_disassociate.empty?
29
29
  end
30
30
 
31
+ acs.save!
32
+
31
33
  concurrence do
32
34
  create_acss(acs, smart_proxies_to_associate)
33
35
  delete_acss(acs, smart_proxies_to_disassociate)
@@ -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)