katello 4.7.4 → 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 (334) 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/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb +1 -1
  113. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  114. data/engines/bastion/app/assets/stylesheets/bastion/bastion.scss +4 -0
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -4
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +0 -1
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -4
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -1
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +11 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -1
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +8 -4
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +5485 -0
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +5397 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +5658 -0
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +5284 -0
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ka.po +5231 -0
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +5275 -0
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +5389 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +5212 -0
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +5145 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +2 -2
  133. data/lib/katello/engine.rb +2 -1
  134. data/lib/katello/permission_creator.rb +2 -4
  135. data/lib/katello/permissions/registry_permissions.rb +5 -5
  136. data/lib/katello/plugin.rb +22 -14
  137. data/lib/katello/repository_types/README.md +136 -19
  138. data/lib/katello/repository_types/deb.rb +0 -1
  139. data/lib/katello/repository_types/docker.rb +0 -1
  140. data/lib/katello/repository_types/file.rb +0 -1
  141. data/lib/katello/repository_types/yum.rb +0 -4
  142. data/lib/katello/tasks/clean_candlepin_orphaned_products.rake +38 -0
  143. data/lib/katello/tasks/clean_orphaned_facets.rb +20 -0
  144. data/lib/katello/tasks/reimport.rake +1 -2
  145. data/lib/katello/tasks/repository.rake +1 -22
  146. data/lib/katello/tasks/reset.rake +1 -0
  147. data/lib/katello/tasks/upgrades/4.8/fix_incorrect_providers.rake +29 -0
  148. data/lib/katello/version.rb +1 -1
  149. data/lib/katello.rb +0 -5
  150. data/locale/bn/katello.po +69 -27
  151. data/locale/cs/katello.po +69 -27
  152. data/locale/de/katello.po +78 -36
  153. data/locale/en/katello.po +69 -27
  154. data/locale/es/katello.po +70 -28
  155. data/locale/fr/katello.po +73 -31
  156. data/locale/gu/katello.po +69 -27
  157. data/locale/hi/katello.po +69 -27
  158. data/locale/it/katello.po +69 -27
  159. data/locale/ja/katello.po +73 -31
  160. data/locale/ka/katello.po +73 -31
  161. data/locale/katello.pot +335 -262
  162. data/locale/kn/katello.po +69 -27
  163. data/locale/ko/katello.po +69 -27
  164. data/locale/mr/katello.po +69 -27
  165. data/locale/or/katello.po +69 -27
  166. data/locale/pa/katello.po +69 -27
  167. data/locale/pt/katello.po +69 -27
  168. data/locale/pt_BR/katello.po +70 -28
  169. data/locale/ru/katello.po +70 -28
  170. data/locale/ta/katello.po +69 -27
  171. data/locale/te/katello.po +69 -27
  172. data/locale/zh_CN/katello.po +73 -31
  173. data/locale/zh_TW/katello.po +70 -28
  174. data/webpack/components/Content/ContentPage.js +51 -35
  175. data/webpack/components/Content/__tests__/ContentPage.test.js +2 -4
  176. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +22 -3
  177. data/webpack/components/Table/EmptyStateMessage.js +14 -11
  178. data/webpack/components/Table/MainTable.js +36 -15
  179. data/webpack/components/Table/TableWrapper.js +25 -25
  180. data/webpack/components/Table/__test__/emptyStateMessage.test.js +51 -0
  181. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +5 -4
  182. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +1 -1
  183. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsModal.test.js +1 -17
  184. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +18 -9
  185. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -2
  186. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +1 -2
  187. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +1 -2
  188. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +47 -27
  189. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +1 -2
  190. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -21
  191. data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +1 -28
  192. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +1 -10
  193. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +1 -18
  194. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +1 -17
  195. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -15
  196. data/webpack/global_test_setup.js +1 -1
  197. data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +12 -10
  198. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +6 -0
  199. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +1 -0
  200. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +3 -10
  201. data/webpack/scenes/AlternateContentSources/Create/Steps/NameACS.js +1 -0
  202. data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +3 -3
  203. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +1 -0
  204. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +12 -4
  205. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +7 -4
  206. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +4 -8
  207. data/webpack/scenes/AlternateContentSources/helpers.js +1 -1
  208. data/webpack/scenes/Content/Details/ContentRepositories.js +5 -4
  209. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +1 -12
  210. data/webpack/scenes/Content/Table/ContentTable.js +2 -1
  211. data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -14
  212. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -25
  213. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  214. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +44 -31
  215. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -0
  216. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +6 -1
  217. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +2 -1
  218. data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +2 -1
  219. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +3 -1
  220. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -1
  221. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
  222. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -1
  223. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +2 -0
  224. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
  225. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +1 -1
  226. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +1 -1
  227. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +35 -33
  228. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +48 -45
  229. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +58 -24
  230. data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +64 -0
  231. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +36 -20
  232. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +40 -23
  233. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +0 -13
  234. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +0 -13
  235. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -1
  236. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -10
  237. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
  238. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -10
  239. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +21 -9
  240. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +4 -0
  241. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +1 -32
  242. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +3 -1
  243. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -15
  244. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +1 -1
  245. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +1 -2
  246. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -9
  247. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +4 -0
  248. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +30 -14
  249. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
  250. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +55 -120
  251. data/webpack/scenes/ContentViews/components/WizardHeader.js +1 -1
  252. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +1 -1
  253. data/webpack/scenes/ContentViews/expansions/__tests__/contentViewComponentsModal.test.js +8 -1
  254. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +3 -9
  255. data/webpack/scenes/ModuleStreams/__tests__/__snapshots__/ModuleStreamPage.test.js.snap +7 -1
  256. data/webpack/scenes/RedHatRepositories/components/Search.js +22 -16
  257. data/webpack/scenes/RedHatRepositories/index.scss +20 -1
  258. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +12 -1
  259. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +1 -1
  260. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +1 -1
  261. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +21 -19
  262. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +34 -1
  263. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +20 -7
  264. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +0 -1
  265. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +65 -15
  266. metadata +50 -116
  267. data/app/lib/actions/katello/pulp_selector.rb +0 -24
  268. data/app/lib/actions/katello/repository/correct_checksum.rb +0 -24
  269. data/app/lib/actions/katello/repository/destroy_package_group.rb +0 -26
  270. data/app/lib/actions/katello/repository/upload_package_group.rb +0 -24
  271. data/app/lib/actions/pulp/abstract.rb +0 -37
  272. data/app/lib/actions/pulp/abstract_async_task.rb +0 -154
  273. data/app/lib/actions/pulp/abstract_async_task_group.rb +0 -94
  274. data/app/lib/actions/pulp/consumer/sync_capsule.rb +0 -45
  275. data/app/lib/actions/pulp/consumer/unassociate_units.rb +0 -20
  276. data/app/lib/actions/pulp/expect_one_task.rb +0 -11
  277. data/app/lib/actions/pulp/orchestration/orphan_cleanup/remove_orphans.rb +0 -16
  278. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +0 -19
  279. data/app/lib/actions/pulp/orchestration/repository/delete.rb +0 -15
  280. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +0 -14
  281. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +0 -13
  282. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -19
  283. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +0 -14
  284. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +0 -34
  285. data/app/lib/actions/pulp/orchestration/repository/sync.rb +0 -18
  286. data/app/lib/actions/pulp/orchestration/repository/upload_content.rb +0 -37
  287. data/app/lib/actions/pulp/orphan_cleanup/remove_orphans.rb +0 -15
  288. data/app/lib/actions/pulp/orphan_cleanup/remove_unneeded_repos.rb +0 -16
  289. data/app/lib/actions/pulp/repository/abstract_copy_content.rb +0 -45
  290. data/app/lib/actions/pulp/repository/abstract_remove_content.rb +0 -32
  291. data/app/lib/actions/pulp/repository/clear.rb +0 -18
  292. data/app/lib/actions/pulp/repository/copy_all_units.rb +0 -30
  293. data/app/lib/actions/pulp/repository/copy_units.rb +0 -25
  294. data/app/lib/actions/pulp/repository/create.rb +0 -28
  295. data/app/lib/actions/pulp/repository/create_in_plan.rb +0 -15
  296. data/app/lib/actions/pulp/repository/create_upload_request.rb +0 -20
  297. data/app/lib/actions/pulp/repository/delete_upload_request.rb +0 -19
  298. data/app/lib/actions/pulp/repository/destroy.rb +0 -28
  299. data/app/lib/actions/pulp/repository/distributor_publish.rb +0 -25
  300. data/app/lib/actions/pulp/repository/download.rb +0 -16
  301. data/app/lib/actions/pulp/repository/import_upload.rb +0 -19
  302. data/app/lib/actions/pulp/repository/presenters/abstract_sync_presenter.rb +0 -47
  303. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +0 -95
  304. data/app/lib/actions/pulp/repository/presenters/docker_presenter.rb +0 -103
  305. data/app/lib/actions/pulp/repository/presenters/file_unit_presenter.rb +0 -42
  306. data/app/lib/actions/pulp/repository/presenters/yum_presenter.rb +0 -131
  307. data/app/lib/actions/pulp/repository/refresh.rb +0 -21
  308. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +0 -21
  309. data/app/lib/actions/pulp/repository/remove_distribution.rb +0 -11
  310. data/app/lib/actions/pulp/repository/remove_units.rb +0 -44
  311. data/app/lib/actions/pulp/repository/sync.rb +0 -99
  312. data/app/lib/actions/pulp/repository/upload_file.rb +0 -28
  313. data/app/lib/actions/pulp/repository_group/create.rb +0 -31
  314. data/app/lib/actions/pulp/repository_group/delete.rb +0 -17
  315. data/app/lib/actions/pulp/repository_group/export.rb +0 -51
  316. data/app/lib/katello/util/package_clause_generator.rb +0 -77
  317. data/app/models/katello/glue/pulp/pulp_errors.rb +0 -9
  318. data/app/models/katello/glue/pulp/repo.rb +0 -353
  319. data/app/models/katello/pulp_sync_status.rb +0 -165
  320. data/app/models/katello/pulp_task_status.rb +0 -63
  321. data/app/services/katello/pulp/content.rb +0 -24
  322. data/app/services/katello/pulp/importer_comparison.rb +0 -28
  323. data/app/services/katello/pulp/repository/deb.rb +0 -61
  324. data/app/services/katello/pulp/repository/docker.rb +0 -82
  325. data/app/services/katello/pulp/repository/file.rb +0 -52
  326. data/app/services/katello/pulp/repository/yum.rb +0 -205
  327. data/app/services/katello/pulp/repository.rb +0 -327
  328. data/app/services/katello/pulp/server.rb +0 -35
  329. data/app/services/katello/pulp/simple_package.rb +0 -24
  330. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -52
  331. data/lib/monkeys/fix_deb_optimized_sync.rb +0 -35
  332. data/lib/monkeys/fix_pulp_container_path.rb +0 -35
  333. data/locale/zanata.xml +0 -30
  334. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentSearch.fixtures.json +0 -33
@@ -8,6 +8,7 @@ module Actions
8
8
  param :content_view_version_id, Integer
9
9
  param :export_history_id, Integer
10
10
  param :export_path, String
11
+ param :from_content_view_version_id, Integer
11
12
  end
12
13
 
13
14
  output_format do
@@ -18,12 +19,14 @@ module Actions
18
19
  def plan(content_view_version:,
19
20
  smart_proxy:,
20
21
  fail_on_missing_content: false,
21
- destination_server:)
22
+ destination_server:,
23
+ from_content_view_version:)
22
24
  format = ::Katello::Pulp3::ContentViewVersion::Export::SYNCABLE
23
25
  sequence do
24
26
  export_service = ::Katello::Pulp3::ContentViewVersion::Export.create(
25
27
  smart_proxy: smart_proxy,
26
28
  content_view_version: content_view_version,
29
+ from_content_view_version: from_content_view_version,
27
30
  format: format,
28
31
  destination_server: destination_server)
29
32
  export_service.validate!(fail_on_missing_content: fail_on_missing_content)
@@ -42,7 +45,8 @@ module Actions
42
45
  smart_proxy_id: smart_proxy.id,
43
46
  exporter_data: action_output[:exporter_data],
44
47
  format: format,
45
- repository_id: repository.id)
48
+ repository_id: repository.id,
49
+ from_content_view_version_id: from_content_view_version&.id)
46
50
 
47
51
  plan_action(::Actions::Pulp3::ContentViewVersion::DestroyExporter,
48
52
  smart_proxy_id: smart_proxy.id,
@@ -55,6 +59,7 @@ module Actions
55
59
  ::Actions::Pulp3::ContentViewVersion::CreateSyncableExportHistory,
56
60
  smart_proxy_id: smart_proxy.id,
57
61
  content_view_version_id: content_view_version.id,
62
+ from_content_view_version_id: from_content_view_version&.id,
58
63
  destination_server: destination_server,
59
64
  format: format,
60
65
  base_path: base_path
@@ -23,8 +23,7 @@ module Actions
23
23
 
24
24
  def invoke_external_task
25
25
  repo = ::Katello::Repository.find(input[:repository_id])
26
- #used in switchover, need to assume pulp3
27
- repo.backend_service(smart_proxy, true).with_mirror_adapter.refresh_distributions
26
+ repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions
28
27
  end
29
28
  end
30
29
  end
@@ -12,9 +12,9 @@ module Actions
12
12
  distribution_hrefs.compact!
13
13
  repo = ::Katello::Repository.find(input[:repository_id])
14
14
  if distribution_hrefs.any?
15
- repo.backend_service(smart_proxy, true).save_distribution_references(distribution_hrefs)
15
+ repo.backend_service(smart_proxy).save_distribution_references(distribution_hrefs)
16
16
  else
17
- repo.backend_service(smart_proxy, true).update_distribution
17
+ repo.backend_service(smart_proxy).update_distribution
18
18
  end
19
19
  end
20
20
  end
@@ -8,7 +8,7 @@ module Katello
8
8
  super
9
9
 
10
10
  medium_provider = Katello::ManagedContentMediumProvider.new(host)
11
- content_view = host.try(:content_facet).try(:content_view) || host.try(:content_view)
11
+ content_view = host.try(:content_facet).try(:single_content_view) || host.try(:single_content_view)
12
12
 
13
13
  if content_view && host.operatingsystem.is_a?(Redhat) &&
14
14
  host.operatingsystem.kickstart_repos(host).first.present? &&
@@ -6,10 +6,6 @@ module Katello
6
6
  @cache = ActiveSupport::Cache::MemoryStore.new
7
7
 
8
8
  class << self
9
- def initialize
10
- FileUtils.touch(lock_file)
11
- end
12
-
13
9
  def settings
14
10
  SETTINGS[:katello][:event_daemon]
15
11
  end
@@ -24,12 +20,16 @@ module Katello
24
20
  pid_dir.join('katello_event_daemon.pid')
25
21
  end
26
22
 
23
+ def tmp_dir
24
+ Rails.root.join('tmp')
25
+ end
26
+
27
27
  def pid_dir
28
- Rails.root.join('tmp', 'pids')
28
+ tmp_dir.join('pids')
29
29
  end
30
30
 
31
31
  def lock_file
32
- Rails.root.join('tmp', 'katello_event_daemon.lock')
32
+ tmp_dir.join('katello_event_daemon.lock')
33
33
  end
34
34
 
35
35
  def write_pid_file
@@ -49,10 +49,13 @@ module Katello
49
49
 
50
50
  def start
51
51
  return unless runnable?
52
- lockfile = File.open(lock_file, 'r')
53
- begin
52
+
53
+ FileUtils.mkdir_p(tmp_dir)
54
+ FileUtils.touch(lock_file)
55
+
56
+ File.open(lock_file, 'r') do |lockfile|
54
57
  lockfile.flock(File::LOCK_EX)
55
- return if started? # ensure it wasn't started while we waited for the lock
58
+ return nil if started? # ensure it wasn't started while we waited for the lock
56
59
  start_monitor_thread
57
60
  write_pid_file
58
61
 
@@ -34,10 +34,11 @@ module Katello
34
34
  consumers
35
35
  end
36
36
 
37
- def create(env_id, parameters, activation_key_cp_ids)
37
+ def create(env_ids, parameters, activation_key_cp_ids, org)
38
38
  parameters['installedProducts'] ||= [] #if installed products is nil, candlepin won't attach custom products
39
- url = "/candlepin/environments/#{env_id}/consumers/"
40
- url += "?activation_keys=" + activation_key_cp_ids.join(",") if activation_key_cp_ids.length > 0
39
+ parameters['environments'] = env_ids.map { |cp_id| { id: cp_id } }
40
+ url = "/candlepin/consumers/?owner=#{org.label}"
41
+ url += "&activation_keys=" + activation_key_cp_ids.join(",") if activation_key_cp_ids.length > 0
41
42
 
42
43
  response = self.post(url, parameters.to_json, self.default_headers).body
43
44
  JSON.parse(response).with_indifferent_access
@@ -92,7 +93,7 @@ module Katello
92
93
  self.put(path(uuid), {:lastCheckin => checkin_date}.to_json, self.default_headers).body
93
94
  end
94
95
 
95
- def available_pools(owner_label, uuid, listall = false)
96
+ def available_pools(owner_label, uuid, listall: false)
96
97
  url = Resources::Candlepin::Pool.path(nil, owner_label) + "?consumer=#{uuid}&listall=#{listall}&add_future=true"
97
98
  response = Candlepin::CandlepinResource.get(url, self.default_headers).body
98
99
  JSON.parse(response)
@@ -107,8 +108,7 @@ module Katello
107
108
  # Export is a zip file
108
109
  headers = self.default_headers
109
110
  headers['accept'] = 'application/zip'
110
- response = Candlepin::CandlepinResource.get(join_path(path(uuid), 'export'), headers)
111
- response
111
+ Candlepin::CandlepinResource.get(join_path(path(uuid), 'export'), headers)
112
112
  end
113
113
 
114
114
  def entitlements(uuid)
@@ -60,7 +60,7 @@ module Katello
60
60
  Product.all(organization_name, [:id, :productContent])
61
61
  end
62
62
 
63
- def destroy_imports(organization_name, wait_until_complete = false)
63
+ def destroy_imports(organization_name, wait_until_complete: false)
64
64
  response_json = self.delete(join_path(path(organization_name), 'imports'), self.default_headers)
65
65
  response = JSON.parse(response_json).with_indifferent_access
66
66
  if wait_until_complete && response['state'] == 'CREATED'
@@ -42,15 +42,14 @@ module Katello
42
42
 
43
43
  def get_export(url, client_cert, client_key, ca_file)
44
44
  logger.debug "Sending GET request to upstream Candlepin: #{url}"
45
- return resource(url, client_cert, client_key, ca_file).get
45
+ return resource(url: url, client_cert: client_cert, client_key: client_key, ca_file: ca_file).get
46
46
  rescue RestClient::Exception => e
47
47
  raise e
48
48
  end
49
49
 
50
50
  def update(url, client_cert, client_key, ca_file, attributes)
51
- logger.debug "Sending POST request to upstream Candlepin: #{url} #{attributes.to_json}"
52
-
53
- return resource(url, client_cert, client_key, ca_file).put(attributes.to_json,
51
+ logger.debug "Sending PUT request to upstream Candlepin: #{url} #{attributes.to_json}"
52
+ return resource(url: url, client_cert: client_cert, client_key: client_key, ca_file: ca_file).put(attributes.to_json,
54
53
  'accept' => 'application/json',
55
54
  'accept-language' => I18n.locale,
56
55
  'content-type' => 'application/json')
@@ -88,7 +88,7 @@ module Katello
88
88
  class << self
89
89
  delegate :[], to: :json_resource
90
90
 
91
- def resource(url = self.site + self.path, client_cert = self.client_cert, client_key = self.client_key, ca_file = nil, options = {})
91
+ def resource(options = {}, url: self.site + self.path, client_cert: self.client_cert, client_key: self.client_key, ca_file: nil)
92
92
  cert_store = OpenSSL::X509::Store.new
93
93
  cert_store.add_file(ca_file) if ca_file
94
94
 
@@ -107,9 +107,9 @@ module Katello
107
107
  )
108
108
  end
109
109
 
110
- def json_resource(url = self.site + self.path, client_cert = self.client_cert, client_key = self.client_key, ca_file = nil, options = {})
110
+ def json_resource(options = {}, url: self.site + self.path, client_cert: self.client_cert, client_key: self.client_key, ca_file: nil)
111
111
  options.deep_merge!(headers: self.default_headers)
112
- resource(url, client_cert, client_key, ca_file, options)
112
+ resource(options, url: url, client_cert: client_cert, client_key: client_key, ca_file: ca_file)
113
113
  end
114
114
 
115
115
  def rest_client(_http_type = nil, method = :get, path = self.path)
@@ -117,7 +117,7 @@ module Katello
117
117
  self.consumer_secret = nil
118
118
  self.consumer_key = nil
119
119
 
120
- resource(self.site + path, client_cert, client_key, nil, http_method: method)
120
+ resource({ http_method: method }, url: self.site + path, client_cert: client_cert, client_key: client_key, ca_file: nil)
121
121
  end
122
122
 
123
123
  def client_cert
@@ -46,19 +46,21 @@ module Katello
46
46
  end
47
47
  end
48
48
 
49
- def filter_errata_by_pulp_href(errata, package_pulp_hrefs, source_repo_rpm_filenames)
50
- return [] if package_pulp_hrefs.empty?
51
- rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
52
- srpms = Katello::Srpm.where(:pulp_id => package_pulp_hrefs)
53
- rpm_filenames = rpms.map { |rpm| File.basename(rpm.filename) }
54
- srpm_filenames = srpms.map { |srpm| File.basename(srpm.filename) }
49
+ def filter_errata_by_pulp_href(errata, content_pulp_hrefs, source_repo_rpm_filenames, source_repo_module_stream_specs)
50
+ return [] if content_pulp_hrefs.empty?
51
+
55
52
  source_repo_rpm_filenames = source_repo_rpm_filenames.map { |rpm| File.basename(rpm) }
53
+ rpm_filenames = Katello::Rpm.where(:pulp_id => content_pulp_hrefs).map { |rpm| File.basename(rpm.filename) }
54
+ srpm_filenames = Katello::Srpm.where(:pulp_id => content_pulp_hrefs).map { |srpm| File.basename(srpm.filename) }
55
+ module_stream_specs = Katello::ModuleStream.where(:pulp_id => content_pulp_hrefs).map(&:module_spec)
56
+
56
57
  matching_errata = []
57
58
  errata.each do |erratum|
58
- # The erratum should be copied if package_pulp_hrefs has all of its packages that are available in the source repo.
59
- rpms_in_erratum_and_source_repo = erratum.packages.pluck(:filename) & source_repo_rpm_filenames
60
- if (rpms_in_erratum_and_source_repo - rpm_filenames - srpm_filenames).empty? ||
61
- erratum.packages.empty? || rpms_in_erratum_and_source_repo.empty?
59
+ # The erratum should be copied if content_pulp_hrefs has all of its packages/modules that are available in the source repo.
60
+ content_in_erratum_and_source_repo =
61
+ (erratum.packages.pluck(:filename) + erratum.module_stream_specs) & (source_repo_rpm_filenames + source_repo_module_stream_specs)
62
+ if (content_in_erratum_and_source_repo - rpm_filenames - srpm_filenames - module_stream_specs).empty? ||
63
+ (erratum.packages.empty? && erratum.module_streams.empty?) || content_in_erratum_and_source_repo.empty?
62
64
  matching_errata << erratum
63
65
  end
64
66
  end
@@ -42,7 +42,6 @@ module Katello
42
42
  classes = get_subclasses(ActiveRecord::Base)
43
43
  classes = classes.select { |c| !ignore_list.include?(c.name) && c.respond_to?(:index) }
44
44
 
45
- #we need index base classes first (TaskStatus) before child classes (PulpTaskStatus)
46
45
  initial_list = classes.select { |c| c.superclass == ActiveRecord::Base }
47
46
  subclass_list = classes - initial_list
48
47
  initial_list + subclass_list
@@ -5,8 +5,11 @@ module Katello
5
5
  environment_id = record.respond_to?(:lifecycle_environment_id) ? record.lifecycle_environment_id : record.environment_id
6
6
  view = ContentView.where(:id => record.content_view_id).first
7
7
  environment = KTEnvironment.where(:id => environment_id).first
8
- unless view.organization == environment.organization
9
- record.errors[:base] << _("%{view_label} could not be promoted to %{environment_label} because the content view and the environment are not in the same organization!") % {:view_label => view.label, :environment_label => environment.label}
8
+ unless view && environment
9
+ record.errors[:base] << _("Content view environments must have both a content view and an environment")
10
+ end
11
+ unless view&.organization == environment&.organization
12
+ record.errors[:base] << _("%{view_label} could not be promoted to %{environment_label} because the content view and the environment are not in the same organization!") % {:view_label => view&.label, :environment_label => environment&.label}
10
13
  end
11
14
  end
12
15
  end
@@ -4,7 +4,6 @@ module Katello
4
4
  def validate(record)
5
5
  #support lifecycle_environment_id for foreman models
6
6
  environment_id = record.respond_to?(:lifecycle_environment_id) ? record.lifecycle_environment_id : record.environment_id
7
-
8
7
  if record.content_view_id
9
8
  view = ContentView.where(:id => record.content_view_id).first
10
9
  if environment_id
@@ -15,7 +14,7 @@ module Katello
15
14
  end
16
15
  end
17
16
  if view&.generated_for_repository?
18
- record.errors[:base] << _("Generated Content views cannot be assigned to Host/Activation Keys")
17
+ record.errors[:base] << _("Generated content views cannot be assigned to hosts or activation keys")
19
18
  end
20
19
  end
21
20
  end
@@ -0,0 +1,16 @@
1
+ module Katello
2
+ module Validators
3
+ class GeneratedContentViewValidator < ActiveModel::Validator
4
+ def validate(record)
5
+ record.content_view_environments.each do |cve|
6
+ if cve.content_view_id
7
+ view = ContentView.where(:id => cve.content_view_id).first
8
+ if view&.generated_for_repository?
9
+ record.errors[:base] << _("Content view '%{cv_name}' is a generated content view, which cannot be assigned to hosts or activation keys.") % { :cv_name => view.name }
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -33,8 +33,10 @@ module Katello
33
33
  ::User.as(user.login) do
34
34
  @content_view = options[:content_view]
35
35
  @environment = options[:environment]
36
- @content_facets = Katello::Host::ContentFacet.where(:lifecycle_environment_id => @environment.id,
37
- :content_view_id => @content_view.id)
36
+ @content_facets = Katello::Host::ContentFacet.in_content_views_and_environments(
37
+ :lifecycle_environments => [@environment],
38
+ :content_views => [@content_view]
39
+ )
38
40
  @hosts = ::Host::Managed.authorized("view_hosts").where(:id => @content_facets.pluck(:host_id))
39
41
  @errata = @content_facets.map(&:installable_errata).flatten.uniq
40
42
 
@@ -34,7 +34,7 @@ module Katello
34
34
  validates :base_url, if: -> { custom? || rhui? }, presence: true
35
35
  validates :products, if: -> { custom? || rhui? }, absence: true
36
36
  validates :label, :uniqueness => true
37
- validates :name, :uniqueness => true
37
+ validates :name, :uniqueness => true, presence: true
38
38
  validates :verify_ssl, if: :custom?, exclusion: [nil]
39
39
  validates :alternate_content_source_type, inclusion: {
40
40
  in: ->(_) { ACS_TYPES },
@@ -46,6 +46,10 @@ module Katello
46
46
  allow_blank: false,
47
47
  message: ->(_, _) { _("is not allowed for ACS. Must be one of the following: %s") % (RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES).join(',') }
48
48
  }
49
+ validates :content_type, if: -> { rhui? }, inclusion: {
50
+ in: [::Katello::Repository::YUM_TYPE],
51
+ message: "'%{value}' is not valid for RHUI ACS"
52
+ }
49
53
  validates_with Validators::AlternateContentSourcePathValidator, :attributes => [:base_url, :subpaths], :if => :custom?
50
54
 
51
55
  scope :uses_http_proxies, -> { where(use_http_proxies: true) }
@@ -25,8 +25,11 @@ module Katello
25
25
  :complete_value => TRACE_STATUS_MAP
26
26
 
27
27
  #associations for simpler scoped searches
28
- has_one :content_view, :through => :content_facet
29
- has_one :lifecycle_environment, :through => :content_facet
28
+ has_many :content_view_environment_content_facets, through: :content_facet, class_name: 'Katello::ContentViewEnvironmentContentFacet'
29
+ has_many :content_view_environments, through: :content_view_environment_content_facets
30
+ has_many :content_views, through: :content_view_environments
31
+ has_many :lifecycle_environments, through: :content_view_environments
32
+
30
33
  has_one :content_source, :through => :content_facet
31
34
  has_many :content_facet_errata, :through => :content_facet, :class_name => 'Katello::ContentFacetErratum'
32
35
  has_many :applicable_errata, :through => :content_facet_errata, :source => :erratum
@@ -37,10 +40,8 @@ module Katello
37
40
  has_many :bound_root_repositories, :through => :content_facet
38
41
  has_many :bound_content, :through => :content_facet
39
42
 
40
- scoped_search :relation => :content_view, :on => :name, :complete_value => true, :rename => :content_view
41
- scoped_search :relation => :content_facet, :on => :content_view_id, :rename => :content_view_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
42
- scoped_search :relation => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment
43
- scoped_search :relation => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
43
+ scoped_search :relation => :content_views, :on => :name, :complete_value => true, :rename => :content_views
44
+ scoped_search :relation => :lifecycle_environments, :on => :name, :complete_value => true, :rename => :lifecycle_environments
44
45
  scoped_search :relation => :applicable_errata, :on => :errata_id, :rename => :applicable_errata, :complete_value => true, :ext_method => :find_by_applicable_errata, :only_explicit => true
45
46
  scoped_search :relation => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata, :only_explicit => true
46
47
  scoped_search :relation => :applicable_errata, :on => :issued, :rename => :applicable_errata_issued, :complete_value => true, :only_explicit => true
@@ -68,8 +69,8 @@ module Katello
68
69
  end
69
70
 
70
71
  apipie :class do
71
- property :content_view, 'ContentView', desc: 'Returns content view associated with the host'
72
- property :lifecycle_environment, 'KTEnvironment', desc: 'Returns lifecycle environment object associated with the host'
72
+ property :content_views, 'ContentView', desc: 'Returns content views associated with the host'
73
+ property :lifecycle_environments, 'KTEnvironment', desc: 'Returns lifecycle environment objects associated with the host'
73
74
  property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source for the host'
74
75
  property :applicable_errata, array_of: 'Erratum', desc: 'Returns errata applicable to the host'
75
76
  end
@@ -154,15 +155,25 @@ module Katello
154
155
  end
155
156
  end
156
157
 
157
- def in_content_view_environment(content_view: nil, lifecycle_environment: nil)
158
- relation = self.joins(:content_facet)
159
- relation = relation.where("#{::Katello::Host::ContentFacet.table_name}.content_view_id" => content_view) if content_view
160
- relation = relation.where("#{::Katello::Host::ContentFacet.table_name}.lifecycle_environment_id" => lifecycle_environment) if lifecycle_environment
158
+ def in_content_view_environments(content_views: nil, lifecycle_environments: nil)
159
+ relation = self.joins(:content_facet => {:content_view_environment_content_facets => :content_view_environment })
160
+ relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.content_view_id" => content_views) if content_views
161
+ relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.environment_id" => lifecycle_environments) if lifecycle_environments
161
162
  relation
162
163
  end
163
164
 
165
+ def in_environments(lifecycle_environments)
166
+ in_content_view_environments(:lifecycle_environments => lifecycle_environments)
167
+ end
168
+
169
+ def in_content_view_environment(content_view: nil, lifecycle_environment: nil)
170
+ Rails.logger.warn "DEPRECATION WARNING: in_content_view_environment is deprecated and will be removed in Katello 4.8. Please use in_content_view_environments instead."
171
+ in_content_view_environments(:content_views => content_view, :lifecycle_environments => lifecycle_environment)
172
+ end
173
+
164
174
  def in_environment(lifecycle_environment)
165
- in_content_view_environment(:lifecycle_environment => lifecycle_environment)
175
+ Rails.logger.warn "DEPRECATION WARNING: in_environment is deprecated and will be removed in Katello 4.9. Please use in_environments instead."
176
+ in_environments(lifecycle_environment)
166
177
  end
167
178
 
168
179
  private
@@ -189,5 +200,5 @@ module Katello
189
200
  end
190
201
 
191
202
  class ::Host::Managed::Jail < Safemode::Jail
192
- allow :content_view, :lifecycle_environment, :content_source, :applicable_errata
203
+ allow :content_source, :applicable_errata
193
204
  end
@@ -51,8 +51,12 @@ module Katello
51
51
  prepend ::ForemanRemoteExecution::HostExtensions if ::Katello.with_remote_execution?
52
52
  prepend Overrides
53
53
 
54
- delegate :content_source_id, :content_view_id, :lifecycle_environment_id, :kickstart_repository_id, :bound_repositories, to: :content_facet, allow_nil: true
54
+ delegate :content_source_id, :single_content_view, :single_lifecycle_environment, :default_environment?, :single_content_view_environment?, :multi_content_view_environment?, :kickstart_repository_id, :bound_repositories, to: :content_facet, allow_nil: true
55
55
 
56
+ has_many :content_view_environment_content_facets, through: :content_facet, class_name: 'Katello::ContentViewEnvironmentContentFacet'
57
+ has_many :content_view_environments, through: :content_view_environment_content_facets
58
+ has_many :content_views, through: :content_view_environments
59
+ has_many :lifecycle_environments, through: :content_view_environments
56
60
  has_many :dispatch_histories, :class_name => "::Katello::Agent::DispatchHistory", :foreign_key => :host_id, :dependent => :delete_all
57
61
 
58
62
  has_many :host_installed_packages, :class_name => "::Katello::HostInstalledPackage", :foreign_key => :host_id, :dependent => :delete_all
@@ -92,6 +96,10 @@ module Katello
92
96
  scoped_search :relation => :host_traces, :on => :application, :complete_value => true, :rename => :trace_app, :only_explicit => true
93
97
  scoped_search :relation => :host_traces, :on => :app_type, :complete_value => true, :rename => :trace_app_type, :only_explicit => true
94
98
  scoped_search :relation => :host_traces, :on => :helper, :complete_value => true, :rename => :trace_helper, :only_explicit => true
99
+ scoped_search :relation => :lifecycle_environments, :on => :name, :complete_value => true, :rename => :lifecycle_environment, :only_explicit => true
100
+ scoped_search :relation => :content_views, :on => :name, :complete_value => true, :rename => :content_view, :only_explicit => true
101
+ scoped_search :relation => :lifecycle_environments, :on => :id, :complete_value => true, :rename => :lifecycle_environment_id, :only_explicit => true
102
+ scoped_search :relation => :content_views, :on => :id, :complete_value => true, :rename => :content_view_id, :only_explicit => true
95
103
 
96
104
  scoped_search relation: :pools, on: :pools_expiring_in_days, ext_method: :find_with_expiring_pools, only_explicit: true
97
105
 
@@ -111,8 +119,8 @@ module Katello
111
119
  property :host_collections, array_of: 'HostCollection', desc: 'Returns list of the host collections the host belongs to'
112
120
  property :pools, array_of: 'Pool', desc: 'Returns subscription pool objects associated with the host'
113
121
  property :hypervisor_host, 'Host', desc: 'Returns hypervisor host object of this host'
114
- property :lifecycle_environment, 'KTEnvironment', desc: 'Returns lifecycle environment object associated with the host'
115
- property :content_view, 'ContentView', desc: 'Returns content view associated with the host'
122
+ property :lifecycle_environments, 'KTEnvironment', desc: 'Returns lifecycle environments associated with the host'
123
+ property :content_views, 'ContentView', desc: 'Returns content views associated with the host'
116
124
  property :installed_packages, array_of: 'InstalledPackage', desc: 'Returns a list of packages installed on the host'
117
125
  end
118
126
  end
@@ -263,9 +271,9 @@ module Katello
263
271
  def import_module_streams(module_streams)
264
272
  streams = {}
265
273
  module_streams.each do |module_stream|
266
- stream = AvailableModuleStream.where(name: module_stream["name"],
274
+ stream = AvailableModuleStream.create_or_find_by!(name: module_stream["name"],
267
275
  context: module_stream["context"],
268
- stream: module_stream["stream"]).first_or_create!
276
+ stream: module_stream["stream"])
269
277
  streams[stream.id] = module_stream
270
278
  end
271
279
  sync_available_module_stream_associations(streams)
@@ -433,7 +441,7 @@ module Katello
433
441
  versions_by_name = {}
434
442
  if versions.present?
435
443
  JSON.parse(versions).each do |nvra|
436
- nvra =~ /([^\.]*)-\d+\.[-\.\w]*/
444
+ nvra =~ /([^.]*)-\d+\.[-.\w]*/
437
445
  versions_by_name[Regexp.last_match(1)] = nvra
438
446
  end
439
447
  end
@@ -471,9 +479,10 @@ end
471
479
 
472
480
  class ::Host::Managed::Jail < Safemode::Jail
473
481
  allow :content_source, :subscription_manager_configuration_url, :rhsm_organization_label,
474
- :host_collections, :pools, :hypervisor_host, :lifecycle_environment, :content_view,
482
+ :host_collections, :pools, :hypervisor_host, :installed_debs,
475
483
  :installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template,
476
- :filtered_entitlement_quantity_consumed, :bound_repositories
484
+ :filtered_entitlement_quantity_consumed, :bound_repositories,
485
+ :single_content_view, :single_lifecycle_environment
477
486
  end
478
487
 
479
488
  class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
@@ -63,20 +63,30 @@ module Katello
63
63
  def variant_repos(host, variant)
64
64
  if variant && host.content_source
65
65
  product_id = host.try(:content_facet).try(:kickstart_repository).try(:product_id) || host.try(:kickstart_repository).try(:product_id)
66
- distros = distribution_repositories(host)
66
+ distribution_repositories(host)
67
67
  .joins(:product)
68
68
  .where("#{Katello::Repository.table_name}.distribution_variant LIKE :variant", { variant: "%#{variant}%" })
69
69
  .where("#{Katello::Product.table_name}.id": product_id).collect { |repo| repo.to_hash(host.content_source, true) }
70
- distros
71
70
  end
72
71
  end
73
72
 
74
73
  def distribution_repositories(host, content_facet: nil)
75
74
  content_facet ||= host.content_facet
76
- content_view = content_facet.try(:content_view) || host.try(:content_view)
77
- lifecycle_environment = content_facet.try(:lifecycle_environment) || host.try(:lifecycle_environment)
78
- if content_view && lifecycle_environment && host.os && host.architecture
79
- Katello::Repository.in_environment(lifecycle_environment).in_content_views([content_view]).
75
+ case content_facet
76
+ when ::Katello::Host::ContentFacet
77
+ if content_facet.new_record?
78
+ content_views = ::Katello::ContentView.where(id: content_facet.content_view_environments.map(&:content_view_id))
79
+ lifecycle_environments = ::Katello::KTEnvironment.where(id: content_facet.content_view_environments.map(&:environment_id))
80
+ else
81
+ content_views = content_facet.try(:content_views) || host.try(:content_views)
82
+ lifecycle_environments = content_facet.try(:lifecycle_environments) || host.try(:lifecycle_environments)
83
+ end
84
+ when ::Katello::Hostgroup::ContentFacet
85
+ content_views = [content_facet.try(:content_view), host.try(:content_views)].flatten.compact
86
+ lifecycle_environments = [content_facet.try(:lifecycle_environment), host.try(:lifecycle_environments)].flatten.compact
87
+ end
88
+ if content_views.present? && lifecycle_environments.present? && host.os && host.architecture
89
+ Katello::Repository.in_environment(lifecycle_environments).in_content_views(content_views).
80
90
  where(:distribution_arch => host.architecture.name).
81
91
  where("#{Katello::Repository.table_name}.distribution_version = :release or #{Katello::Repository.table_name}.distribution_version like :match",
82
92
  release: host.os.release, match: "#{host.os.release}.%")
@@ -235,14 +235,6 @@ module Katello
235
235
  end
236
236
  end
237
237
 
238
- def backend_service_type(repository)
239
- if pulp3_support?(repository)
240
- Actions::Pulp3::Abstract::BACKEND_SERVICE_TYPE
241
- else
242
- Actions::Pulp::Abstract::BACKEND_SERVICE_TYPE
243
- end
244
- end
245
-
246
238
  def pulp3_enabled?
247
239
  self.has_feature? PULP3_FEATURE
248
240
  end
@@ -451,10 +443,6 @@ module Katello
451
443
  repos_in_env_cv(environment, content_view) - repos_in_sync_history
452
444
  end
453
445
 
454
- def smart_proxy_service
455
- @smart_proxy_service ||= Pulp::SmartProxyRepository.new(self)
456
- end
457
-
458
446
  def rhsm_url
459
447
  # Since Foreman 3.1 this setting is set
460
448
  if (rhsm_url = setting(SmartProxy::PULP3_FEATURE, 'rhsm_url'))
@@ -63,6 +63,7 @@ module Katello
63
63
  end
64
64
 
65
65
  def update_candlepin_associations(consumer_params = nil)
66
+ content_facet.cves_changed = false if content_facet
66
67
  content_facet&.save!
67
68
 
68
69
  auto_attach_enabled_via_checkin = consumer_params.try(:[], 'autoheal')
@@ -39,10 +39,13 @@ module Katello
39
39
 
40
40
  has_many :activation_keys, :class_name => "Katello::ActivationKey", :dependent => :restrict_with_exception
41
41
 
42
- has_many :content_facets, :class_name => "Katello::Host::ContentFacet",
43
- :inverse_of => :content_view, :dependent => :restrict_with_exception
42
+ has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet",
43
+ :through => :content_view_environments
44
+ has_many :content_facets, :class_name => "Katello::Host::ContentFacet", :through => :content_view_environment_content_facets,
45
+ :inverse_of => :content_views
44
46
  has_many :hosts, :class_name => "::Host::Managed", :through => :content_facets,
45
- :inverse_of => :content_view
47
+ :inverse_of => :content_views
48
+
46
49
  has_many :hostgroup_content_facets, :class_name => "Katello::Hostgroup::ContentFacet",
47
50
  :inverse_of => :content_view, :dependent => :nullify
48
51
  has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets,
@@ -421,8 +424,10 @@ module Katello
421
424
  # update errata applicability counts for all hosts in the CV & LE
422
425
  Location.no_taxonomy_scope do
423
426
  User.as_anonymous_admin do
424
- ::Katello::Host::ContentFacet.where(:content_view_id => self,
425
- :lifecycle_environment_id => environment).each do |facet|
427
+ ::Katello::Host::ContentFacet.in_content_views_and_environments(
428
+ content_views: [self],
429
+ lifecycle_environments: [environment]
430
+ ).each do |facet|
426
431
  facet.update_applicability_counts
427
432
  facet.update_errata_status
428
433
  end
@@ -599,6 +604,7 @@ module Katello
599
604
  fail _("Import-only content views can not be published directly") if import_only? && !syncable
600
605
  check_composite_action_allowed!(organization.library)
601
606
  check_docker_repository_names!([organization.library])
607
+ check_orphaned_content_facets!(environments: self.environments)
602
608
  end
603
609
 
604
610
  true
@@ -645,6 +651,17 @@ module Katello
645
651
  true
646
652
  end
647
653
 
654
+ def check_orphaned_content_facets!(environments: [])
655
+ ::Katello::Host::ContentFacet.in_content_views_and_environments(
656
+ content_views: [self],
657
+ lifecycle_environments: environments
658
+ ).each do |facet|
659
+ unless facet.host
660
+ fail _("Orphaned content facets for deleted hosts exist for the content view and environment. Please run rake task : katello:clean_orphaned_facets and try again!")
661
+ end
662
+ end
663
+ end
664
+
648
665
  def check_remove_from_environment!(env)
649
666
  errors = []
650
667