katello 4.9.1 → 4.10.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 (308) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -7
  3. data/app/assets/javascripts/katello/locale/bn/katello.js +8967 -1
  4. data/app/assets/javascripts/katello/locale/bn_IN/katello.js +8967 -0
  5. data/app/assets/javascripts/katello/locale/ca/katello.js +8967 -0
  6. data/app/assets/javascripts/katello/locale/cs/katello.js +8967 -1
  7. data/app/assets/javascripts/katello/locale/cs_CZ/katello.js +8969 -0
  8. data/app/assets/javascripts/katello/locale/de/katello.js +8991 -1
  9. data/app/assets/javascripts/katello/locale/de_AT/katello.js +8966 -0
  10. data/app/assets/javascripts/katello/locale/de_DE/katello.js +8967 -0
  11. data/app/assets/javascripts/katello/locale/el/katello.js +8967 -0
  12. data/app/assets/javascripts/katello/locale/en/katello.js +8967 -1
  13. data/app/assets/javascripts/katello/locale/en_GB/katello.js +8967 -0
  14. data/app/assets/javascripts/katello/locale/en_US/katello.js +8966 -0
  15. data/app/assets/javascripts/katello/locale/es/katello.js +8984 -1
  16. data/app/assets/javascripts/katello/locale/et_EE/katello.js +8966 -0
  17. data/app/assets/javascripts/katello/locale/fr/katello.js +9008 -1
  18. data/app/assets/javascripts/katello/locale/gl/katello.js +8967 -0
  19. data/app/assets/javascripts/katello/locale/gu/katello.js +8967 -1
  20. data/app/assets/javascripts/katello/locale/he_IL/katello.js +8967 -0
  21. data/app/assets/javascripts/katello/locale/hi/katello.js +8967 -1
  22. data/app/assets/javascripts/katello/locale/id/katello.js +8966 -0
  23. data/app/assets/javascripts/katello/locale/it/katello.js +8974 -1
  24. data/app/assets/javascripts/katello/locale/ja/katello.js +9004 -1
  25. data/app/assets/javascripts/katello/locale/ka/katello.js +8976 -1
  26. data/app/assets/javascripts/katello/locale/kn/katello.js +8967 -1
  27. data/app/assets/javascripts/katello/locale/ko/katello.js +8972 -1
  28. data/app/assets/javascripts/katello/locale/locale/katello.js +3070 -1
  29. data/app/assets/javascripts/katello/locale/ml_IN/katello.js +8966 -0
  30. data/app/assets/javascripts/katello/locale/mr/katello.js +8967 -1
  31. data/app/assets/javascripts/katello/locale/nl_NL/katello.js +8967 -0
  32. data/app/assets/javascripts/katello/locale/or/katello.js +8967 -1
  33. data/app/assets/javascripts/katello/locale/pa/katello.js +8967 -1
  34. data/app/assets/javascripts/katello/locale/pl/katello.js +8967 -0
  35. data/app/assets/javascripts/katello/locale/pl_PL/katello.js +8966 -0
  36. data/app/assets/javascripts/katello/locale/pt/katello.js +8967 -1
  37. data/app/assets/javascripts/katello/locale/pt_BR/katello.js +8984 -1
  38. data/app/assets/javascripts/katello/locale/ro/katello.js +8966 -0
  39. data/app/assets/javascripts/katello/locale/ro_RO/katello.js +8966 -0
  40. data/app/assets/javascripts/katello/locale/ru/katello.js +8973 -1
  41. data/app/assets/javascripts/katello/locale/sl/katello.js +8967 -0
  42. data/app/assets/javascripts/katello/locale/sv_SE/katello.js +8967 -0
  43. data/app/assets/javascripts/katello/locale/ta/katello.js +8967 -1
  44. data/app/assets/javascripts/katello/locale/ta_IN/katello.js +8967 -0
  45. data/app/assets/javascripts/katello/locale/te/katello.js +8967 -1
  46. data/app/assets/javascripts/katello/locale/tr/katello.js +8967 -0
  47. data/app/assets/javascripts/katello/locale/vi/katello.js +8966 -0
  48. data/app/assets/javascripts/katello/locale/vi_VN/katello.js +8966 -0
  49. data/app/assets/javascripts/katello/locale/zh/katello.js +8966 -0
  50. data/app/assets/javascripts/katello/locale/zh_CN/katello.js +9004 -1
  51. data/app/assets/javascripts/katello/locale/zh_TW/katello.js +8972 -1
  52. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  53. data/app/controllers/katello/api/v2/alternate_content_sources_bulk_actions_controller.rb +22 -1
  54. data/app/controllers/katello/api/v2/api_controller.rb +0 -15
  55. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +13 -4
  56. data/app/controllers/katello/api/v2/host_errata_controller.rb +0 -12
  57. data/app/controllers/katello/api/v2/host_packages_controller.rb +0 -55
  58. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +1 -1
  59. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +0 -77
  60. data/app/controllers/katello/api/v2/organizations_controller.rb +2 -1
  61. data/app/controllers/katello/api/v2/products_controller.rb +4 -4
  62. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +12 -5
  63. data/app/controllers/katello/api/v2/repositories_controller.rb +16 -17
  64. data/app/controllers/katello/api/v2/sync_controller.rb +0 -1
  65. data/app/controllers/katello/concerns/api/api_controller.rb +0 -10
  66. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +7 -9
  67. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +1 -1
  68. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +14 -2
  69. data/app/lib/actions/katello/alternate_content_source/update.rb +1 -1
  70. data/app/lib/actions/katello/content_view/capsule_sync.rb +1 -1
  71. data/app/lib/actions/katello/content_view/incremental_updates.rb +3 -9
  72. data/app/lib/actions/katello/content_view_environment/destroy.rb +5 -3
  73. data/app/lib/actions/katello/content_view_version/destroy.rb +5 -1
  74. data/app/lib/actions/katello/content_view_version/republish_repositories.rb +8 -2
  75. data/app/lib/actions/katello/host/update_content_view.rb +4 -2
  76. data/app/lib/actions/katello/product/destroy.rb +15 -11
  77. data/app/lib/actions/katello/repository/capsule_sync.rb +1 -1
  78. data/app/lib/actions/katello/repository/destroy.rb +10 -2
  79. data/app/lib/actions/katello/repository/index_content.rb +0 -1
  80. data/app/lib/actions/katello/repository/sync.rb +1 -3
  81. data/app/lib/actions/katello/repository/update_metadata_sync.rb +1 -1
  82. data/app/lib/actions/katello/repository/verify_checksum.rb +2 -10
  83. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +12 -5
  84. data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -9
  85. data/app/lib/katello/resources/cdn.rb +4 -0
  86. data/app/lib/katello/validators/alternate_content_source_products_validator.rb +1 -1
  87. data/app/models/katello/candlepin/repository_mapper.rb +1 -0
  88. data/app/models/katello/cdn_configuration.rb +4 -0
  89. data/app/models/katello/concerns/host_managed_extensions.rb +57 -4
  90. data/app/models/katello/content_view.rb +21 -3
  91. data/app/models/katello/content_view_component.rb +1 -1
  92. data/app/models/katello/content_view_version.rb +4 -0
  93. data/app/models/katello/docker_meta_tag.rb +3 -1
  94. data/app/models/katello/host/content_facet.rb +10 -8
  95. data/app/models/katello/kt_environment.rb +1 -1
  96. data/app/models/katello/ping.rb +1 -12
  97. data/app/models/katello/product_content.rb +14 -1
  98. data/app/models/katello/repository.rb +6 -1
  99. data/app/models/katello/root_repository.rb +2 -8
  100. data/app/services/katello/applicability/applicable_content_helper.rb +2 -2
  101. data/app/services/katello/registration_manager.rb +2 -12
  102. data/app/views/foreman/job_templates/configure_host_for_new_content_source.erb +25 -0
  103. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +1 -1
  104. data/app/views/katello/api/v2/content_facet/show.json.rabl +0 -12
  105. data/app/views/katello/api/v2/content_view_components/show.json.rabl +4 -1
  106. data/app/views/katello/api/v2/content_views/base.json.rabl +6 -2
  107. data/app/views/katello/api/v2/products/show.json.rabl +3 -0
  108. data/app/views/katello/api/v2/repositories/base.json.rabl +18 -0
  109. data/app/views/katello/api/v2/repositories/show.json.rabl +0 -1
  110. data/app/views/katello/api/v2/repository_sets/show.json.rabl +2 -2
  111. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +4 -5
  112. data/app/views/overrides/activation_keys/_host_media_type_select.html.erb +11 -3
  113. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +15 -7
  114. data/config/initializers/monkeys.rb +1 -0
  115. data/config/katello.yaml.example +0 -4
  116. data/config/routes/api/v2.rb +3 -0
  117. data/config/routes/overrides.rb +0 -11
  118. data/db/migrate/20220228173251_remove_drpm_from_ignorable_content.rb +1 -0
  119. data/db/migrate/20230609155411_add_custom_cdn_auth_enabled_to_katello_cdn_configurations.rb +5 -0
  120. data/db/migrate/20230710190626_remove_relative_path_limit.rb +5 -0
  121. data/db/migrate/20230717150442_change_change_content_source_job_template_name.rb +20 -0
  122. data/db/migrate/20230828143236_remove_katello_agent_dispatch_history.rb +15 -0
  123. data/db/seeds.d/111-upgrade_tasks.rb +1 -2
  124. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
  125. data/engines/bastion_katello/README.md +2 -1
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.controller.js +4 -2
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +2 -2
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/views/activation-keys.html +8 -3
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +3 -44
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-module-streams-modal.controller.js +0 -1
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +1 -65
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -3
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -6
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-applicable.controller.js +1 -1
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +1 -16
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +0 -1
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-actions.controller.js +0 -1
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-applicable.controller.js +2 -11
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +0 -2
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -39
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs-applicable.html +2 -2
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +1 -4
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +2 -4
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-applicable.html +4 -6
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-installed.html +1 -3
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +0 -14
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +1 -2
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/files/details/file-content-views.controller.js +2 -1
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/files/details/views/file-content-views.html +1 -1
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +235 -521
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js +2 -0
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +17 -4
  153. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +55 -6
  154. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +2 -2
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-packages.html +13 -2
  156. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
  157. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +4 -1
  158. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +5 -0
  159. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -3
  160. data/lib/katello/engine.rb +0 -18
  161. data/lib/katello/permission_creator.rb +1 -1
  162. data/lib/katello/plugin.rb +0 -25
  163. data/lib/katello/version.rb +1 -1
  164. data/lib/monkeys/remove_hidden_distribution.rb +383 -0
  165. data/locale/action_names.rb +3 -1
  166. data/locale/bn/katello.po +130 -39
  167. data/locale/bn_IN/katello.po +130 -39
  168. data/locale/ca/katello.po +130 -39
  169. data/locale/cs/katello.po +130 -39
  170. data/locale/cs_CZ/katello.po +130 -39
  171. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  172. data/locale/de/katello.po +134 -43
  173. data/locale/de_AT/katello.po +130 -39
  174. data/locale/de_DE/katello.po +130 -39
  175. data/locale/el/katello.po +130 -39
  176. data/locale/en/katello.po +130 -39
  177. data/locale/en_GB/katello.po +130 -39
  178. data/locale/en_US/katello.po +130 -39
  179. data/locale/es/LC_MESSAGES/katello.mo +0 -0
  180. data/locale/es/katello.po +133 -42
  181. data/locale/et_EE/katello.po +130 -39
  182. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  183. data/locale/fr/katello.po +138 -47
  184. data/locale/gl/katello.po +130 -39
  185. data/locale/gu/katello.po +130 -39
  186. data/locale/he_IL/katello.po +130 -39
  187. data/locale/hi/katello.po +130 -39
  188. data/locale/id/katello.po +130 -39
  189. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  190. data/locale/it/katello.po +131 -40
  191. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  192. data/locale/ja/katello.po +138 -47
  193. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  194. data/locale/ka/katello.po +131 -40
  195. data/locale/katello.pot +805 -642
  196. data/locale/kn/katello.po +130 -39
  197. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  198. data/locale/ko/katello.po +131 -40
  199. data/locale/ml_IN/katello.po +130 -39
  200. data/locale/mr/katello.po +130 -39
  201. data/locale/nl_NL/katello.po +130 -39
  202. data/locale/or/katello.po +130 -39
  203. data/locale/pa/katello.po +130 -39
  204. data/locale/pl/katello.po +130 -39
  205. data/locale/pl_PL/katello.po +130 -39
  206. data/locale/pt/katello.po +130 -39
  207. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  208. data/locale/pt_BR/katello.po +133 -42
  209. data/locale/ro/katello.po +130 -39
  210. data/locale/ro_RO/katello.po +130 -39
  211. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  212. data/locale/ru/katello.po +131 -40
  213. data/locale/sl/katello.po +130 -39
  214. data/locale/sv_SE/katello.po +130 -39
  215. data/locale/ta/katello.po +130 -39
  216. data/locale/ta_IN/katello.po +130 -39
  217. data/locale/te/katello.po +130 -39
  218. data/locale/tr/katello.po +130 -39
  219. data/locale/vi/katello.po +130 -39
  220. data/locale/vi_VN/katello.po +130 -39
  221. data/locale/zh/katello.po +130 -39
  222. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  223. data/locale/zh_CN/katello.po +138 -47
  224. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
  225. data/locale/zh_TW/katello.po +131 -40
  226. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +0 -5
  227. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/index.js +9 -3
  228. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +7 -54
  229. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/HostErrataActions.js +2 -11
  230. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/HostPackagesActions.js +1 -40
  231. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/HostPackagesConstants.js +0 -3
  232. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +5 -40
  233. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +6 -61
  234. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +5 -4
  235. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +0 -212
  236. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +2 -157
  237. data/webpack/components/extensions/HostDetails/hostDetailsHelpers.js +0 -20
  238. data/webpack/containers/Application/config.js +5 -0
  239. data/webpack/scenes/ActivationKeys/Details/ActivationKeyActions.js +31 -0
  240. data/webpack/scenes/ActivationKeys/Details/ActivationKeyConstants.js +3 -0
  241. data/webpack/scenes/ActivationKeys/Details/ActivationKeyDetails.js +127 -0
  242. data/webpack/scenes/ActivationKeys/Details/ActivationKeyDetails.scss +37 -0
  243. data/webpack/scenes/ActivationKeys/Details/ActivationKeyDetailsSelectors.js +16 -0
  244. data/webpack/scenes/ActivationKeys/Details/__tests__/activationKeyDetails.test.js +117 -0
  245. data/webpack/scenes/ActivationKeys/Details/components/DeleteMenu.js +77 -0
  246. data/webpack/scenes/ActivationKeys/Details/components/DeleteModal.js +63 -0
  247. data/webpack/scenes/ActivationKeys/Details/components/EditModal.js +199 -0
  248. data/webpack/scenes/ActivationKeys/Details/index.js +3 -0
  249. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +1 -1
  250. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditCredentials.js +10 -5
  251. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditProducts.js +8 -3
  252. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditSmartProxies.js +8 -3
  253. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +1 -1
  254. data/webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js +2 -2
  255. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +1 -1
  256. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +37 -29
  257. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +53 -37
  258. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +7 -0
  259. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.fixtures.json +15 -6
  260. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +6 -5
  261. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/publishedContentViewDetails.fixtures.json +43 -197
  262. data/webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js +1 -1
  263. data/webpack/scenes/ContentViews/Details/Filters/Rules/Package/AddEditPackageRuleModal.js +1 -1
  264. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +2 -2
  265. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +1 -1
  266. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.fixtures.json +0 -98
  267. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +103 -1
  268. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsLatestEnvironment.fixtures.json +634 -0
  269. data/webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js +1 -1
  270. data/webpack/scenes/Hosts/ChangeContentSource/actions.js +14 -12
  271. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +45 -6
  272. data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js +42 -7
  273. data/webpack/scenes/Hosts/ChangeContentSource/index.js +37 -10
  274. data/webpack/scenes/Hosts/ChangeContentSource/styles.scss +5 -0
  275. data/webpack/scenes/RedHatRepositories/__tests__/__snapshots__/RedHatRepositoriesPage.test.js.snap +0 -8
  276. data/webpack/scenes/RedHatRepositories/index.scss +1 -1
  277. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +2 -2
  278. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +0 -8
  279. metadata +85 -80
  280. data/app/lib/actions/katello/agent/dispatch_history_presenter.rb +0 -64
  281. data/app/lib/actions/katello/agent_action.rb +0 -119
  282. data/app/lib/actions/katello/bulk_agent_action.rb +0 -34
  283. data/app/lib/actions/katello/host/erratum/applicable_errata_install.rb +0 -44
  284. data/app/lib/actions/katello/host/erratum/install.rb +0 -38
  285. data/app/lib/actions/katello/host/package/install.rb +0 -34
  286. data/app/lib/actions/katello/host/package/remove.rb +0 -48
  287. data/app/lib/actions/katello/host/package/update.rb +0 -42
  288. data/app/lib/actions/katello/host/package_group/install.rb +0 -30
  289. data/app/lib/actions/katello/host/package_group/remove.rb +0 -30
  290. data/app/lib/katello/agent/base_message.rb +0 -41
  291. data/app/lib/katello/agent/client_message_handler.rb +0 -69
  292. data/app/lib/katello/agent/connection.rb +0 -38
  293. data/app/lib/katello/agent/install_errata_message.rb +0 -25
  294. data/app/lib/katello/agent/install_package_group_message.rb +0 -25
  295. data/app/lib/katello/agent/install_package_message.rb +0 -28
  296. data/app/lib/katello/agent/remove_package_group_message.rb +0 -25
  297. data/app/lib/katello/agent/remove_package_message.rb +0 -28
  298. data/app/lib/katello/agent/update_package_message.rb +0 -33
  299. data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +0 -59
  300. data/app/lib/katello/qpid/connection.rb +0 -149
  301. data/app/lib/katello/util/default_enablement_migrator.rb +0 -183
  302. data/app/models/katello/agent/dispatch_history.rb +0 -19
  303. data/app/models/katello/events/delete_host_agent_queue.rb +0 -19
  304. data/app/services/katello/agent/dispatcher.rb +0 -60
  305. data/app/views/foreman/job_templates/change_content_source.erb +0 -18
  306. data/app/views/katello/api/v2/sync/index.json.rabl +0 -1
  307. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +0 -8
  308. data/lib/katello/tasks/upgrades/4.9/update_custom_products_enablement.rake +0 -13
@@ -8,19 +8,20 @@ module Actions
8
8
  content_view = cv_env.content_view
9
9
  environment = cv_env.environment
10
10
  content_view.check_remove_from_environment!(environment) unless organization_destroy
11
-
11
+ docker_cleanup = false
12
12
  sequence do
13
13
  concurrence do
14
14
  unless skip_repo_destroy
15
15
  content_view.repos(environment).each do |repo|
16
16
  # no need to update the content view environment since it's
17
17
  # getting destroyed so skip_environment_update
18
- plan_action(Repository::Destroy, repo, skip_environment_update: true)
18
+ plan_action(Repository::Destroy, repo, skip_environment_update: true, docker_cleanup: false)
19
+ docker_cleanup ||= repo.docker?
19
20
  end
20
21
  end
21
22
  end
22
23
  plan_action(Candlepin::Environment::Destroy, cp_id: cv_env.cp_id) unless organization_destroy
23
- plan_self(:id => cv_env.id)
24
+ plan_self(:id => cv_env.id, :docker_cleanup => docker_cleanup)
24
25
  end
25
26
  end
26
27
 
@@ -31,6 +32,7 @@ module Actions
31
32
  else
32
33
  cv_env.destroy!
33
34
  end
35
+ ::Katello::DockerMetaTag.cleanup_tags if input[:docker_cleanup]
34
36
  end
35
37
  end
36
38
  end
@@ -7,22 +7,26 @@ module Actions
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
10
+ docker_cleanup = false
10
11
 
11
12
  sequence do
12
13
  concurrence do
13
14
  repos.each do |repo|
14
15
  repo_options = options.clone
16
+ repo_options[:docker_cleanup] = false
15
17
  plan_action(Repository::Destroy, repo, repo_options)
18
+ docker_cleanup ||= repo.docker?
16
19
  end
17
20
  end
18
21
  end
19
22
 
20
- plan_self(:id => version.id)
23
+ plan_self(:id => version.id, :docker_cleanup => docker_cleanup)
21
24
  end
22
25
 
23
26
  def finalize
24
27
  version = ::Katello::ContentViewVersion.find_by(id: input[:id])
25
28
  version&.destroy!
29
+ ::Katello::DockerMetaTag.cleanup_tags if input[:docker_cleanup]
26
30
  end
27
31
  end
28
32
  end
@@ -2,10 +2,16 @@ module Actions
2
2
  module Katello
3
3
  module ContentViewVersion
4
4
  class RepublishRepositories < Actions::EntryAction
5
- def plan(content_view_version)
5
+ def plan(content_view_version, options = {force: false})
6
+ force = options[:force]
6
7
  action_subject(content_view_version.content_view)
7
8
  plan_self(:version_id => content_view_version.id)
8
- plan_action(::Actions::Katello::Repository::BulkMetadataGenerate, content_view_version.repositories.joins(:root).where.not(root: { mirroring_policy: ::Katello::RootRepository::MIRRORING_POLICY_COMPLETE }))
9
+ repositories = if force
10
+ content_view_version.repositories
11
+ else
12
+ content_view_version.repositories.joins(:root).where.not(root: { mirroring_policy: ::Katello::RootRepository::MIRRORING_POLICY_COMPLETE })
13
+ end
14
+ plan_action(::Actions::Katello::Repository::BulkMetadataGenerate, repositories)
9
15
  end
10
16
 
11
17
  def run
@@ -4,8 +4,10 @@ module Actions
4
4
  class UpdateContentView < Actions::EntryAction
5
5
  def plan(host, content_view_id, lifecycle_environment_id)
6
6
  if host.content_facet
7
- host.content_facet.content_view = ::Katello::ContentView.find(content_view_id)
8
- host.content_facet.lifecycle_environment = ::Katello::KTEnvironment.find(lifecycle_environment_id)
7
+ host.content_facet.assign_single_environment(
8
+ content_view_id: content_view_id,
9
+ lifecycle_environment_id: lifecycle_environment_id
10
+ )
9
11
  host.update_candlepin_associations
10
12
  plan_self(:hostname => host.name)
11
13
  else
@@ -2,21 +2,11 @@ module Actions
2
2
  module Katello
3
3
  module Product
4
4
  class Destroy < Actions::EntryAction
5
- # rubocop:disable Metrics/MethodLength
6
5
  def plan(product, options = {})
7
6
  organization_destroy = options.fetch(:organization_destroy, false)
8
7
  skip_environment_update = options.fetch(:skip_environment_update, false) ||
9
8
  options.fetch(:organization_destroy, false)
10
-
11
- unless organization_destroy || product.user_deletable?
12
- if product.redhat?
13
- fail _("Cannot delete Red Hat product: %{product}") % { :product => product.name }
14
- elsif !product.published_content_view_versions.not_ignorable.empty?
15
- fail _("Cannot delete product with repositories published in a content view. Product: %{product}, %{view_versions}") %
16
- { :product => product.name, :view_versions => view_versions(product) }
17
- end
18
- end
19
-
9
+ check_ready_to_delete(product, organization_destroy)
20
10
  action_subject(product)
21
11
 
22
12
  # Candlepin::Product::ContentRemove is called with Katello::Repository::Destroy, so we only want to run ContentRemove
@@ -99,6 +89,20 @@ module Actions
99
89
  end
100
90
  results.join(', ')
101
91
  end
92
+
93
+ def check_ready_to_delete(product, organization_destroy)
94
+ unless organization_destroy || product.user_deletable?
95
+ if product.redhat?
96
+ fail _("Cannot delete Red Hat product: %{product}") % { :product => product.name }
97
+ elsif !product.published_content_view_versions.not_ignorable.empty?
98
+ fail _("Cannot delete product with repositories published in a content view. Product: %{product}, %{view_versions}") %
99
+ { :product => product.name, :view_versions => view_versions(product) }
100
+ elsif product.repositories.any? { |repo| repo.filters.any? { |filter| filter.repositories.size == 1 } }
101
+ fail _("Cannot delete product: %{product} with repositories that are the last affected repository in content view filters. Delete these repositories before deleting product.") %
102
+ { :product => product.name }
103
+ end
104
+ end
105
+ end
102
106
  end
103
107
  end
104
108
  end
@@ -9,7 +9,7 @@ module Actions
9
9
  def plan(repo)
10
10
  if repo.node_syncable?
11
11
  concurrence do
12
- smart_proxies = ::SmartProxy.with_environment(repo.environment)
12
+ smart_proxies = ::SmartProxy.unscoped.with_environment(repo.environment).select { |sp| sp.authorized?(:manage_capsule_content) && sp.authorized?(:view_capsule_content) }
13
13
  unless smart_proxies.blank?
14
14
  plan_action(::Actions::BulkAction, ::Actions::Katello::CapsuleContent::Sync, smart_proxies,
15
15
  :repository_id => repo.id)
@@ -15,6 +15,8 @@ module Actions
15
15
  options.fetch(:organization_destroy, false)
16
16
  destroy_content = options.fetch(:destroy_content, true)
17
17
  remove_from_content_view_versions = options.fetch(:remove_from_content_view_versions, false)
18
+ delete_empty_repo_filters = options.fetch(:delete_empty_repo_filters, true)
19
+ docker_cleanup = options.fetch(:docker_cleanup, true)
18
20
  action_subject(repository)
19
21
  check_destroyable!(repository, remove_from_content_view_versions)
20
22
  remove_generated_content_views(repository)
@@ -29,8 +31,9 @@ module Actions
29
31
 
30
32
  handle_acs_product_removal(repository)
31
33
  handle_alternate_content_sources(repository)
34
+ delete_empty_repo_filters(repository) if delete_empty_repo_filters
32
35
 
33
- plan_self(:user_id => ::User.current.id, :affected_cvv_ids => affected_cvv_ids)
36
+ plan_self(:user_id => ::User.current.id, :affected_cvv_ids => affected_cvv_ids, :docker_cleanup => docker_cleanup)
34
37
  sequence do
35
38
  if repository.redhat?
36
39
  handle_redhat_content(repository) unless skip_environment_update
@@ -45,7 +48,7 @@ module Actions
45
48
  def finalize
46
49
  repository = ::Katello::Repository.find_by(id: input[:repository][:id])
47
50
  if repository
48
- docker_cleanup = repository.content_type == ::Katello::Repository::DOCKER_TYPE
51
+ docker_cleanup = repository.docker? && input[:docker_cleanup]
49
52
  delete_record(repository, {docker_cleanup: docker_cleanup})
50
53
 
51
54
  if (affected_cvv_ids = input[:affected_cvv_ids]).any?
@@ -81,6 +84,11 @@ module Actions
81
84
  end
82
85
  end
83
86
 
87
+ def delete_empty_repo_filters(repository)
88
+ filters_to_delete = repository.filters.select { |filter| filter.repositories.size == 1 }
89
+ ::Katello::ContentViewFilter.where(id: filters_to_delete).destroy_all
90
+ end
91
+
84
92
  def handle_custom_content(repository, remove_from_content_view_versions)
85
93
  #if this is the last instance of a custom repo, destroy the content
86
94
  if remove_from_content_view_versions || repository.root.repositories.where.not(id: repository.id).empty?
@@ -20,7 +20,6 @@ module Actions
20
20
 
21
21
  if input[:force_index] || (repo.last_contents_changed >= repo.last_indexed)
22
22
  repo.index_content(source_repository: source_repository, full_index: input[:full_index].present?)
23
- repo.update(:last_indexed => DateTime.now)
24
23
  else
25
24
  output[:index_skipped] = true
26
25
  end
@@ -26,7 +26,6 @@ module Actions
26
26
 
27
27
  validate_repo!(repo: repo,
28
28
  source_url: source_url,
29
- validate_contents: validate_contents,
30
29
  skip_metadata_check: skip_metadata_check,
31
30
  skip_candlepin_check: options.fetch(:skip_candlepin_check, false))
32
31
 
@@ -81,9 +80,8 @@ module Actions
81
80
  end
82
81
  end
83
82
 
84
- def validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:)
83
+ def validate_repo!(repo:, source_url:, skip_metadata_check:, skip_candlepin_check:)
85
84
  fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
86
- fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
87
85
  fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum/deb repositories.") if skip_metadata_check && !repo.yum? && !repo.deb?
88
86
  ::Katello::Util::CandlepinRepositoryChecker.check_repository_for_sync!(repo) if repo.yum? && !skip_candlepin_check
89
87
  end
@@ -6,7 +6,7 @@ module Actions
6
6
  sequence do
7
7
  plan_action(Katello::Repository::MetadataGenerate, repository)
8
8
  concurrence do
9
- ::SmartProxy.with_repo(repository).each do |capsule|
9
+ (::SmartProxy.unscoped.with_repo(repository).select { |sp| sp.authorized?(:manage_capsule_content) && sp.authorized?(:view_capsule_content) })&.each do |capsule|
10
10
  next if capsule.pulp_primary?
11
11
  plan_action(Katello::CapsuleContent::Sync, capsule, repository_id: repository.id)
12
12
  end
@@ -6,19 +6,11 @@ module Actions
6
6
 
7
7
  def plan(repo)
8
8
  action_subject(repo)
9
-
10
- if SmartProxy.pulp_primary.pulp3_support?(repo)
11
- plan_action(Actions::Pulp3::Repository::Repair, repo.id, SmartProxy.pulp_primary)
12
- else
13
- options = {}
14
- options[:validate_contents] = true
15
- plan_action(Actions::Katello::Repository::Sync, repo, options)
16
- end
9
+ plan_action(Actions::Pulp3::Repository::Repair, repo.id, SmartProxy.pulp_primary)
17
10
  end
18
11
 
19
12
  def presenter
20
- found = all_planned_actions(Katello::Repository::Sync)
21
- found = all_planned_actions(Pulp3::Repository::Repair) if found.empty?
13
+ found = all_planned_actions(Pulp3::Repository::Repair)
22
14
  Helpers::Presenter::Delegated.new(self, found)
23
15
  end
24
16
  end
@@ -14,6 +14,8 @@ module Actions
14
14
  plan_self(source_repository_id: options[:source_repository].id, target_repository_id: repository.id, smart_proxy_id: smart_proxy.id)
15
15
  elsif publication_content_type && (force_publication || repository.publication_href.nil? || !repository.using_mirrored_metadata?)
16
16
  plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options)
17
+ elsif !publication_content_type
18
+ plan_self(target_repository_id: repository.id, contents_changed: options[:contents_changed], skip_publication: true)
17
19
  end
18
20
  plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
19
21
  plan_action(Actions::Pulp3::Repository::RefreshDistribution, repository, smart_proxy, :contents_changed => options[:contents_changed]) if Setting[:distribute_archived_cvv] || repository.environment
@@ -21,13 +23,18 @@ module Actions
21
23
  end
22
24
 
23
25
  def run
24
- #we don't have to actually generate a publication, we can reuse the old one
25
26
  target_repo = ::Katello::Repository.find(input[:target_repository_id])
26
- source_repo = ::Katello::Repository.find(input[:source_repository_id])
27
- if (target_repo.publication_href != source_repo.publication_href && smart_proxy.pulp_primary?)
28
- target_repo.clear_smart_proxy_sync_histories
27
+ if input[:skip_publication]
28
+ #Need to clear smart proxy sync histories for non-publication content_types: docker, ansible collection
29
+ target_repo.clear_smart_proxy_sync_histories if input[:contents_changed]
30
+ else
31
+ #we don't have to actually generate a publication, we can reuse the old one
32
+ source_repo = ::Katello::Repository.find(input[:source_repository_id])
33
+ if (target_repo.publication_href != source_repo.publication_href && smart_proxy.pulp_primary?)
34
+ target_repo.clear_smart_proxy_sync_histories
35
+ end
36
+ target_repo.update!(publication_href: source_repo.publication_href)
29
37
  end
30
- target_repo.update!(publication_href: source_repo.publication_href)
31
38
  end
32
39
  end
33
40
  end
@@ -320,17 +320,12 @@ module Katello
320
320
  Util::Package.sortable_version(version)
321
321
  end
322
322
 
323
- apipie :method, 'Returns true if Katello Agent infrastructure is enabled on the server'
324
- def katello_agent_enabled?
325
- Katello.with_katello_agent?
326
- end
327
-
328
323
  include Katello::ContentSourceHelper
329
324
 
330
325
  apipie :method, "Generate script to change a host's content source" do
331
326
  returns String
332
327
  end
333
- def change_content_source(host, ca_cert)
328
+ def configure_host_for_new_content_source(host, ca_cert)
334
329
  return missing_content_source(host) unless host.content_source
335
330
 
336
331
  prepare_ssl_cert(ca_cert) + configure_subman(host.content_source)
@@ -359,9 +354,9 @@ module Katello
359
354
  def parse_errata(task)
360
355
  task_input = get_task_input(task)
361
356
  agent_input = task_input['errata'] || task_input['content']
362
- # Pick katello agent errata if present
363
- # Otherwise pick rex errata. There are multiple template inputs, such as errata, pre_script and post_script we only need the
364
- # errata input here.
357
+ # agent_input retrieves past katello-agent tasks.
358
+ # There are multiple template inputs, such as errata, pre_script and post_script.
359
+ # We only need the errata input here.
365
360
  @_tasks_errata_cache[task.id] ||= agent_input.presence || errata_ids_from_template_invocation(task, task_input)
366
361
  end
367
362
 
@@ -67,6 +67,10 @@ module Katello
67
67
  self.new(cdn_configuration.url, options)
68
68
  elsif cdn_configuration.custom_cdn?
69
69
  options[:ssl_ca_cert] = cdn_configuration.ssl_ca
70
+ if cdn_configuration.custom_cdn_auth_enabled?
71
+ options[:ssl_client_cert] = OpenSSL::X509::Certificate.new(product.certificate)
72
+ options[:ssl_client_key] = OpenSSL::PKey::RSA.new(product.key)
73
+ end
70
74
  self.new(cdn_configuration.url, options)
71
75
  else
72
76
  options[:username] = cdn_configuration.username
@@ -7,7 +7,7 @@ module Katello
7
7
  product = ::Katello::Product.find(value)
8
8
  content_type = record.alternate_content_source.content_type
9
9
  if product.repositories.with_type(content_type).has_url.empty?
10
- record.errors[attribute] << N_("The product %{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type }
10
+ record.errors.add(attribute, _("%{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type })
11
11
  end
12
12
  end
13
13
  end
@@ -56,6 +56,7 @@ module Katello
56
56
  end
57
57
 
58
58
  def substitutor
59
+ fail _("Manifest does not have a valid subscription") if product.cdn_resource.nil?
59
60
  product.cdn_resource.substitutor
60
61
  end
61
62
 
@@ -37,6 +37,10 @@ module Katello
37
37
  type == CUSTOM_CDN_TYPE
38
38
  end
39
39
 
40
+ def custom_cdn_auth_enabled?
41
+ custom_cdn_auth_enabled
42
+ end
43
+
40
44
  def redhat_cdn_url?
41
45
  Katello::Resources::CDN::CdnResource.redhat_cdn?(url)
42
46
  end
@@ -1,22 +1,40 @@
1
1
  module Katello
2
2
  module Concerns
3
+ # rubocop:disable Metrics/ModuleLength
3
4
  module HostManagedExtensions
4
5
  extend ActiveSupport::Concern
5
6
  include Katello::KatelloUrlsHelper
6
7
  include ForemanTasks::Concerns::ActionSubject
7
8
 
8
9
  module Overrides
9
- def update(attrs)
10
+ def check_cve_attributes(attrs)
10
11
  if attrs[:content_facet_attributes]
11
12
  cv_id = attrs[:content_facet_attributes].delete(:content_view_id)
12
13
  lce_id = attrs[:content_facet_attributes].delete(:lifecycle_environment_id)
14
+ # Running validations on a host will clear out any existing errors, and then
15
+ # validate all attributes. As we know, running update or save will run validations.
16
+ # Since we've just removed two attributes that may
17
+ # have caused an error, we need to save those so we can explicitly validate
18
+ # them below in add_back_cve_errors.
19
+ @pending_cve_attrs = { content_view_id: cv_id, lifecycle_environment_id: lce_id }
13
20
  if cv_id && lce_id
14
- content_facet.assign_single_environment(content_view_id: cv_id, lifecycle_environment_id: lce_id)
21
+ cve = content_facet&.assign_single_environment(content_view_id: cv_id, lifecycle_environment_id: lce_id)
22
+ Rails.logger.warn "Couldn't assign content view environment; host has no content facet" if cve.blank?
23
+ @pending_cve_attrs = {}
15
24
  end
16
25
  if (cv_id.present? && lce_id.blank?) || (cv_id.blank? && lce_id.present?)
17
- fail "content_view_id and lifecycle_environment_id must be provided together"
26
+ errors.add(:base, _("Content view and lifecycle environment must be provided together"))
18
27
  end
19
28
  end
29
+ end
30
+
31
+ def attributes=(attrs)
32
+ check_cve_attributes(attrs) unless self.content_facet.blank?
33
+ super
34
+ end
35
+
36
+ def update(attrs)
37
+ check_cve_attributes(attrs) unless self.content_facet.blank?
20
38
  super
21
39
  end
22
40
 
@@ -30,6 +48,28 @@ module Katello
30
48
  inherited_attrs
31
49
  end
32
50
 
51
+ def apply_inherited_attributes(attributes, initialized = true)
52
+ attributes = super(attributes, initialized) || {}
53
+ facet_attrs = attributes&.[]('content_facet_attributes')
54
+ return attributes if facet_attrs.blank?
55
+ cv_id = facet_attrs['content_view_id']
56
+ lce_id = facet_attrs['lifecycle_environment_id']
57
+ if initialized && (cv_id.blank? || lce_id.blank?)
58
+ if cv_id.blank?
59
+ Rails.logger.info "Hostgroup has no content view assigned; using host's existing content view"
60
+ facet_attrs['content_view_id'] = content_facet&.single_content_view&.id
61
+ end
62
+ if lce_id.blank?
63
+ Rails.logger.info "Hostgroup has no lifecycle environment assigned; using host's existing lifecycle environment"
64
+ facet_attrs['lifecycle_environment_id'] = content_facet&.single_lifecycle_environment&.id
65
+ end
66
+ attributes['content_facet_attributes'] = facet_attrs
67
+ else
68
+ Rails.logger.debug "Hostgroup has content view and lifecycle environment assigned; using those"
69
+ end
70
+ attributes
71
+ end
72
+
33
73
  def smart_proxy_ids
34
74
  ids = super
35
75
  ids << content_source_id
@@ -72,7 +112,6 @@ module Katello
72
112
  has_many :content_view_environments, through: :content_view_environment_content_facets
73
113
  has_many :content_views, through: :content_view_environments
74
114
  has_many :lifecycle_environments, through: :content_view_environments
75
- has_many :dispatch_histories, :class_name => "::Katello::Agent::DispatchHistory", :foreign_key => :host_id, :dependent => :delete_all
76
115
 
77
116
  has_many :host_installed_packages, :class_name => "::Katello::HostInstalledPackage", :foreign_key => :host_id, :dependent => :delete_all
78
117
  has_many :installed_packages, :class_name => "::Katello::InstalledPackage", :through => :host_installed_packages
@@ -89,7 +128,11 @@ module Katello
89
128
 
90
129
  has_many :hypervisor_pools, :class_name => '::Katello::Pool', :foreign_key => :hypervisor_id, :dependent => :nullify
91
130
 
131
+ validates :name, format: { with: Net::Validations::HOST_REGEXP, message: _("%{value} can contain only lowercase letters, numbers, dashes and dots.") }
132
+
92
133
  before_validation :correct_kickstart_repository
134
+ after_validation :add_back_cve_errors
135
+ after_update :clear_pending_cve_attributes
93
136
  before_update :check_host_registration, :if => proc { organization_id_changed? }
94
137
 
95
138
  after_validation :queue_reset_content_host_status
@@ -118,6 +161,16 @@ module Katello
118
161
 
119
162
  scoped_search relation: :pools, on: :pools_expiring_in_days, ext_method: :find_with_expiring_pools, only_explicit: true
120
163
 
164
+ def add_back_cve_errors
165
+ if @pending_cve_attrs&.[](:content_view_id).present? || @pending_cve_attrs&.[](:lifecycle_environment_id).present?
166
+ check_cve_attributes({ content_facet_attributes: @pending_cve_attrs })
167
+ end
168
+ end
169
+
170
+ def clear_pending_cve_attributes
171
+ @pending_cve_attrs = {}
172
+ end
173
+
121
174
  def self.find_with_expiring_pools(_key, _operator, days_from_now)
122
175
  host_ids = with_pools_expiring_in_days(days_from_now).ids
123
176
  if host_ids.any?
@@ -1,7 +1,7 @@
1
1
  module Katello
2
2
  # rubocop:disable Metrics/ClassLength
3
3
  class ContentView < Katello::Model
4
- audited :associations => [:repositories, :environments, :filters], :except => [:name, :label, :description]
4
+ audited :associations => [:repositories, :environments, :filters]
5
5
  has_associated_audits
6
6
  include Ext::LabelFromName
7
7
  include Katello::Authorization::ContentView
@@ -178,6 +178,10 @@ module Katello
178
178
  content_view_components.map(&:latest_version).compact.freeze
179
179
  end
180
180
 
181
+ def sorted_versions
182
+ versions.order('created_at DESC')
183
+ end
184
+
181
185
  # Adds content view components based on the input
182
186
  # [{:content_view_version_id=>1, :latest=> false}, {:content_view_id=>1, :latest=> true} ..]
183
187
  def add_components(components_to_add)
@@ -794,12 +798,20 @@ module Katello
794
798
  return last_publish_result.present? && last_publish_result == 'success'
795
799
  end
796
800
 
801
+ def cv_repo_indexed_after_last_published?
802
+ repositories.any? { |repo| repo.last_indexed && repo.last_indexed > latest_version_object.created_at }
803
+ end
804
+
797
805
  def needs_publish?
798
806
  #Returns
799
807
  # True:
800
808
  # a) When content/repo/filter change audit records exist
801
809
  # b) CV hasn't ever been published
802
810
  # c) CV dependency_solving != latest_version.applied_filters.dependency_solving
811
+ # d) If repo was indexed after cv publish. This can happen under 3 cases:
812
+ # i) Index runs because last index(before publish) had failed and repo is picked up for index even if pulp publication hasn't changed.
813
+ # ii) Complete sync runs or sync adds/removes new content (Already true because new pulp publication/version gets created)
814
+ # iii) repo.index_content is run. (This doesn't necessarily indicate contents changed. Corner case where we play safe and return true)
803
815
  # nil:
804
816
  # a) When CV version creation audit is missing(Indicating audit cleanup)
805
817
  # b) Version doesn't have audited_filters set indicating
@@ -814,10 +826,11 @@ module Katello
814
826
  return nil unless last_publish_task_success?
815
827
  return composite_cv_components_changed? if composite?
816
828
  # return true if the audit records clearly show we have unpublished changes
817
- return true if (audited_cv_repositories_since_last_publish.present? || audited_cv_repository_changed.present? ||
818
- audited_cv_filters_changed.present? || audited_cv_filter_rules_changed.present?)
829
+ return true if audited_changes_present?
819
830
  # return true if the dependency solving changed for CV between last publish and now
820
831
  return true if dependency_solving_changed?
832
+ # return true if any child repo's indexed_at > last_version.created_at
833
+ return true if cv_repo_indexed_after_last_published?
821
834
  # if we didn't return `true` already, either the audit records show that we don't need to publish, or we may
822
835
  # have insufficient data to make the determination (either audits were cleaned, or never got created at all).
823
836
  # first, check for the `create` audit record; its absence indicates that audits were cleaned some time after
@@ -834,6 +847,11 @@ module Katello
834
847
  latest_version_object.applied_filters.nil? ? nil : false
835
848
  end
836
849
 
850
+ def audited_changes_present?
851
+ audited_cv_repositories_since_last_publish.present? || audited_cv_repository_changed.present? ||
852
+ audited_cv_filters_changed.present? || audited_cv_filter_rules_changed.present?
853
+ end
854
+
837
855
  def dependency_solving_changed?
838
856
  latest_version_object.applied_filters && solve_dependencies != latest_version_object.applied_filters['dependency_solving']
839
857
  end
@@ -32,7 +32,7 @@ module Katello
32
32
  end
33
33
 
34
34
  def component_content_view_versions
35
- self.content_view&.versions
35
+ self.content_view&.versions&.order(created_at: :desc)
36
36
  end
37
37
 
38
38
  private
@@ -106,6 +106,10 @@ module Katello
106
106
  name
107
107
  end
108
108
 
109
+ def self.contains_file(file_unit_id)
110
+ where(id: Katello::Repository.where(id: Katello::RepositoryFileUnit.where(file_unit_id: file_unit_id).select(:repository_id)).select(:content_view_version_id))
111
+ end
112
+
109
113
  def ansible_collections
110
114
  AnsibleCollection.in_repositories(archived_repos)
111
115
  end
@@ -134,7 +134,9 @@ module Katello
134
134
  end
135
135
 
136
136
  def self.cleanup_tags
137
- self.where("id not in (?) OR (schema2_id IS NULL AND schema1_id IS NULL)", Katello::RepositoryDockerMetaTag.pluck(:docker_meta_tag_id) + [0]).delete_all
137
+ #Cleanup RepositoryMetaTag for nil schema meta tags
138
+ RepositoryDockerMetaTag.where(docker_meta_tag: where(schema1: nil, schema2: nil)).delete_all
139
+ self.where.not(id: RepositoryDockerMetaTag.select(:docker_meta_tag_id)).or(where(schema1: nil, schema2: nil)).delete_all
138
140
  end
139
141
 
140
142
  def self.import_meta_tags(repositories)
@@ -61,6 +61,10 @@ module Katello
61
61
  self.cves_changed = true
62
62
  end
63
63
 
64
+ def mark_cves_unchanged
65
+ self.cves_changed = false
66
+ end
67
+
64
68
  def cves_changed?
65
69
  cves_changed
66
70
  end
@@ -89,12 +93,13 @@ module Katello
89
93
  content_view_environments&.first&.lifecycle_environment
90
94
  end
91
95
 
96
+ # rubocop:disable Metrics/CyclomaticComplexity
92
97
  def assign_single_environment(
93
98
  content_view_id: nil, lifecycle_environment_id: nil, environment_id: nil,
94
99
  content_view: nil, lifecycle_environment: nil, environment: nil
95
100
  )
96
- lifecycle_environment_id ||= environment_id || lifecycle_environment&.id || environment&.id
97
- content_view_id ||= content_view&.id
101
+ lifecycle_environment_id ||= environment_id || lifecycle_environment&.id || environment&.id || self.single_lifecycle_environment&.id
102
+ content_view_id ||= content_view&.id || self.single_content_view&.id
98
103
 
99
104
  unless lifecycle_environment_id
100
105
  fail _("Lifecycle environment must be specified")
@@ -299,11 +304,6 @@ module Katello
299
304
  end
300
305
  end
301
306
 
302
- def katello_agent_installed?
303
- self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => 'katello-agent').any? ||
304
- self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => 'katello-agent').any?
305
- end
306
-
307
307
  def tracer_installed?
308
308
  self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => [ "python-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
309
309
  "python3-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
@@ -375,7 +375,9 @@ module Katello
375
375
  class Jail < ::Safemode::Jail
376
376
  allow :applicable_deb_count, :applicable_module_stream_count, :applicable_rpm_count, :content_source, :content_source_id, :content_source_name,
377
377
  :errata_counts, :id, :kickstart_repository, :kickstart_repository_id, :kickstart_repository_name,
378
- :upgradable_deb_count, :upgradable_module_stream_count, :upgradable_rpm_count, :uuid
378
+ :upgradable_deb_count, :upgradable_module_stream_count, :upgradable_rpm_count, :uuid,
379
+ :installable_security_errata_count, :installable_bugfix_errata_count, :installable_enhancement_errata_count,
380
+ :single_content_view, :single_lifecycle_environment
379
381
  end
380
382
  end
381
383
  end
@@ -278,7 +278,7 @@ module Katello
278
278
  prop_group :katello_basic_props, Katello::Model, meta: { friendly_name: 'Katello Environment' }
279
279
  end
280
280
  class Jail < ::Safemode::Jail
281
- allow :name, :label
281
+ allow :id, :name, :label
282
282
  end
283
283
 
284
284
  private