katello 3.17.0 → 3.18.0

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 (272) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
  5. data/app/controllers/katello/api/v2/capsule_content_controller.rb +2 -2
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
  7. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +98 -0
  8. data/app/controllers/katello/api/v2/content_exports_controller.rb +84 -0
  9. data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
  10. data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
  11. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +17 -8
  12. data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
  13. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -71
  14. data/app/controllers/katello/api/v2/content_views_controller.rb +37 -26
  15. data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
  16. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
  17. data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
  18. data/app/controllers/katello/api/v2/host_debs_controller.rb +1 -0
  19. data/app/controllers/katello/api/v2/host_errata_controller.rb +2 -2
  20. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +35 -6
  21. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -1
  22. data/app/controllers/katello/api/v2/products_controller.rb +9 -9
  23. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  24. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -5
  25. data/app/controllers/katello/api/v2/repository_sets_controller.rb +24 -14
  26. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  27. data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
  28. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
  29. data/app/controllers/katello/concerns/api/v2/authorization.rb +19 -5
  30. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +22 -18
  31. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
  32. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  33. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
  34. data/app/controllers/katello/concerns/registration_controller_extensions.rb +16 -0
  35. data/app/helpers/katello/katello_urls_helper.rb +5 -2
  36. data/app/lib/actions/candlepin/product/content_create.rb +2 -0
  37. data/app/lib/actions/candlepin/product/content_update.rb +2 -0
  38. data/app/lib/actions/helpers/smart_proxy_sync_history_helper.rb +24 -0
  39. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
  40. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  41. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +16 -7
  42. data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
  43. data/app/lib/actions/katello/content_view/publish.rb +9 -9
  44. data/app/lib/actions/katello/content_view_version/import.rb +8 -13
  45. data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
  46. data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
  47. data/app/lib/actions/katello/host/hypervisors_update.rb +18 -0
  48. data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
  49. data/app/lib/actions/katello/host/upload_package_profile.rb +3 -1
  50. data/app/lib/actions/katello/host/upload_profiles.rb +8 -6
  51. data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
  52. data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
  53. data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
  54. data/app/lib/actions/katello/product/content_create.rb +7 -6
  55. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
  56. data/app/lib/actions/katello/repository/import_upload.rb +4 -1
  57. data/app/lib/actions/katello/repository/remove_content.rb +1 -1
  58. data/app/lib/actions/katello/repository/sync.rb +3 -1
  59. data/app/lib/actions/katello/repository/update.rb +5 -1
  60. data/app/lib/actions/katello/repository/upload_files.rb +1 -0
  61. data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +15 -0
  62. data/app/lib/actions/pulp/consumer/sync_capsule.rb +4 -2
  63. data/app/lib/actions/pulp/repository/distributor_publish.rb +1 -1
  64. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -0
  65. data/app/lib/actions/pulp3/content_migration.rb +10 -0
  66. data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
  67. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  68. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
  69. data/app/lib/actions/pulp3/content_view_version/export.rb +7 -1
  70. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
  71. data/app/lib/actions/pulp3/import_migration.rb +6 -1
  72. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
  73. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +38 -14
  74. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
  75. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
  76. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +4 -1
  77. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
  78. data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
  79. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  80. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  81. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
  82. data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
  83. data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
  84. data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
  85. data/app/lib/katello/resources/candlepin/owner.rb +5 -0
  86. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  87. data/app/lib/katello/resources/registry.rb +3 -3
  88. data/app/models/katello/authorization/activation_key.rb +4 -0
  89. data/app/models/katello/authorization/content_view.rb +13 -0
  90. data/app/models/katello/authorization/content_view_component.rb +15 -0
  91. data/app/models/katello/authorization/content_view_filter.rb +15 -0
  92. data/app/models/katello/authorization/content_view_version.rb +25 -2
  93. data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
  94. data/app/models/katello/authorization/gpg_key.rb +12 -4
  95. data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
  96. data/app/models/katello/authorization/organization.rb +8 -0
  97. data/app/models/katello/authorization/sync_plan.rb +16 -0
  98. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
  99. data/app/models/katello/concerns/organization_extensions.rb +4 -5
  100. data/app/models/katello/concerns/smart_proxy_extensions.rb +6 -4
  101. data/app/models/katello/content_migration_progress.rb +4 -0
  102. data/app/models/katello/content_view.rb +30 -4
  103. data/app/models/katello/content_view_component.rb +2 -0
  104. data/app/models/katello/content_view_filter.rb +5 -0
  105. data/app/models/katello/content_view_history.rb +2 -1
  106. data/app/models/katello/content_view_package_filter.rb +1 -1
  107. data/app/models/katello/content_view_puppet_module.rb +8 -0
  108. data/app/models/katello/content_view_repository.rb +13 -1
  109. data/app/models/katello/content_view_version_export_history.rb +8 -1
  110. data/app/models/katello/glue/candlepin/pool.rb +9 -14
  111. data/app/models/katello/glue/pulp/repo.rb +8 -0
  112. data/app/models/katello/gpg_key.rb +1 -1
  113. data/app/models/katello/ping.rb +8 -3
  114. data/app/models/katello/repository.rb +33 -0
  115. data/app/models/katello/root_repository.rb +26 -1
  116. data/app/models/katello/smart_proxy_sync_history.rb +8 -0
  117. data/app/services/katello/candlepin/event_handler.rb +2 -0
  118. data/app/services/katello/candlepin/message_handler.rb +34 -0
  119. data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
  120. data/app/services/katello/host_status_manager.rb +9 -0
  121. data/app/services/katello/pulp3/api/apt.rb +57 -0
  122. data/app/services/katello/pulp3/api/core.rb +8 -0
  123. data/app/services/katello/pulp3/api/docker.rb +4 -0
  124. data/app/services/katello/pulp3/content_view_version/export.rb +125 -8
  125. data/app/services/katello/pulp3/content_view_version/import.rb +39 -34
  126. data/app/services/katello/pulp3/content_view_version/import_export_common.rb +6 -16
  127. data/app/services/katello/pulp3/content_view_version/import_validator.rb +114 -0
  128. data/app/services/katello/pulp3/deb.rb +38 -0
  129. data/app/services/katello/pulp3/docker_manifest.rb +1 -0
  130. data/app/services/katello/pulp3/docker_tag.rb +1 -0
  131. data/app/services/katello/pulp3/migration.rb +51 -10
  132. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
  133. data/app/services/katello/pulp3/repository.rb +10 -4
  134. data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
  135. data/app/services/katello/pulp3/repository/apt.rb +63 -0
  136. data/app/services/katello/pulp3/repository/docker.rb +9 -0
  137. data/app/services/katello/pulp3/repository/yum.rb +14 -9
  138. data/app/services/katello/pulp3/repository_mirror.rb +9 -4
  139. data/app/services/katello/pulp3/task.rb +4 -0
  140. data/app/services/katello/pulp3/task_group.rb +4 -0
  141. data/app/services/katello/repository_type.rb +2 -1
  142. data/app/services/katello/smart_proxy_helper.rb +9 -0
  143. data/app/views/dashboard/_subscription_widget.html.erb +0 -5
  144. data/app/views/foreman/hosts/_registration.html.erb +12 -0
  145. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
  146. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -0
  147. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  148. data/app/views/katello/layouts/react.html.erb +3 -2
  149. data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
  150. data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
  151. data/config/routes/api/v2.rb +24 -2
  152. data/config/routes/overrides.rb +1 -0
  153. data/db/migrate/20200929200357_create_katello_smart_proxy_sync_history.rb +13 -0
  154. data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
  155. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
  156. data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
  157. data/db/migrate/20201021150008_add_import_only_to_katello_content_view.rb +5 -0
  158. data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
  159. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  160. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  161. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
  162. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
  163. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
  164. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
  165. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
  166. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
  167. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
  168. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +6 -2
  169. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +12 -0
  170. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +7 -7
  171. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +7 -1
  172. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +17 -3
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -2
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +5 -0
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +92 -19
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
  185. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
  186. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
  187. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository-types.service.js +8 -1
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
  199. data/lib/katello/engine.rb +2 -0
  200. data/lib/katello/permission_creator.rb +98 -69
  201. data/lib/katello/permissions/host_permissions.rb +1 -0
  202. data/lib/katello/plugin.rb +10 -2
  203. data/lib/katello/repository_types/deb.rb +9 -1
  204. data/lib/katello/tasks/pulp3_migration.rake +17 -3
  205. data/lib/katello/tasks/pulp3_migration_abort.rake +22 -0
  206. data/lib/katello/tasks/pulp3_migration_stats.rake +41 -0
  207. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  208. data/lib/katello/tasks/reset.rake +2 -1
  209. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
  210. data/lib/katello/version.rb +1 -1
  211. data/locale/action_names.rb +51 -44
  212. data/locale/bn/katello.po +279 -55
  213. data/locale/cs/katello.po +278 -51
  214. data/locale/de/katello.po +279 -52
  215. data/locale/en/katello.po +278 -49
  216. data/locale/es/katello.po +279 -51
  217. data/locale/fr/katello.po +279 -51
  218. data/locale/gu/katello.po +279 -55
  219. data/locale/hi/katello.po +279 -55
  220. data/locale/it/katello.po +279 -51
  221. data/locale/ja/katello.po +279 -52
  222. data/locale/katello.pot +1379 -971
  223. data/locale/kn/katello.po +279 -55
  224. data/locale/ko/katello.po +279 -51
  225. data/locale/mr/katello.po +279 -55
  226. data/locale/or/katello.po +279 -55
  227. data/locale/pa/katello.po +279 -55
  228. data/locale/pt/katello.po +278 -52
  229. data/locale/pt_BR/katello.po +279 -51
  230. data/locale/ru/katello.po +279 -51
  231. data/locale/ta/katello.po +279 -55
  232. data/locale/te/katello.po +279 -55
  233. data/locale/zh_CN/katello.po +279 -51
  234. data/locale/zh_TW/katello.po +279 -52
  235. data/webpack/components/ActionableDetail.js +2 -1
  236. data/webpack/components/Search/Search.js +1 -1
  237. data/webpack/components/Table/MainTable.js +6 -2
  238. data/webpack/components/Table/TableWrapper.js +46 -9
  239. data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
  240. data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
  241. data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
  242. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
  243. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
  244. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  245. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
  246. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
  247. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
  248. data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
  249. data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
  250. data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
  251. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
  252. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
  253. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  254. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
  255. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  256. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +29 -19
  257. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
  258. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  259. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
  260. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
  261. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
  262. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
  263. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
  264. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
  265. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  266. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
  267. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  268. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  269. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
  270. data/webpack/test-utils/react-testing-lib-wrapper.js +3 -0
  271. metadata +74 -13
  272. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +0 -3
@@ -4,8 +4,10 @@ module Katello
4
4
 
5
5
  include Katello::Concerns::FilteredAutoCompleteSearch
6
6
  before_action :find_organization, :only => [:create, :index, :auto_complete_search]
7
- before_action :find_plan, :only => [:update, :show, :destroy, :sync,
8
- :add_products, :remove_products]
7
+ before_action :find_authorized_katello_resource, :only => [:update, :show, :destroy, :sync,
8
+ :add_products, :remove_products]
9
+ before_action :set_organization, :only => [:update, :show, :destroy, :sync,
10
+ :add_products, :remove_products]
9
11
 
10
12
  def_param_group :sync_plan do
11
13
  param :name, String, :desc => N_("sync plan name"), :required => true, :action_aware => true
@@ -117,16 +119,13 @@ module Katello
117
119
 
118
120
  protected
119
121
 
120
- def find_plan
121
- @sync_plan = SyncPlan.find_by(:id => params[:id])
122
- fail HttpErrors::NotFound, _("Couldn't find sync plan '%{plan}' in organization '%{org}'") % { :plan => params[:id], :org => params[:organization_id] } if @sync_plan.nil?
123
- @organization ||= @sync_plan.organization
124
- @sync_plan
125
- end
126
-
127
122
  def sync_plan_params
128
123
  params[:sync_plan][:enabled] = params[:enabled] unless params[:enabled].nil?
129
124
  params.require(:sync_plan).permit(:name, :description, :interval, :sync_date, :product_ids, :enabled, :cron_expression)
130
125
  end
126
+
127
+ def set_organization
128
+ @organization ||= @sync_plan.try(:organization)
129
+ end
131
130
  end
132
131
  end
@@ -77,7 +77,14 @@ module Katello
77
77
  render json: { status: 'OK' }
78
78
  end
79
79
 
80
- api :PUT, "/organizations/:organization_id/simple_content_access/enable",
80
+ api :GET, "/organizations/:organization_id/upstream_subscriptions/simple_content_access/eligible",
81
+ N_("Check if the specified organization is eligible for Simple Content Access")
82
+ def simple_content_access_eligible
83
+ eligible = @organization.upstream_consumer.simple_content_access_eligible?
84
+ render json: { simple_content_access_eligible: eligible }
85
+ end
86
+
87
+ api :PUT, "/organizations/:organization_id/upstream_subscriptions/simple_content_access/enable",
81
88
  N_("Enable simple content access for a manifest")
82
89
  param :organization_id, :number, :desc => N_("Organization ID"), :required => true
83
90
  def enable_simple_content_access
@@ -85,7 +92,7 @@ module Katello
85
92
  respond_for_async :resource => task
86
93
  end
87
94
 
88
- api :PUT, "/organizations/:organization_id/simple_content_access/disable",
95
+ api :PUT, "/organizations/:organization_id/upstream_subscriptions/simple_content_access/disable",
89
96
  N_("Disable simple content access for a manifest")
90
97
  param :organization_id, :number, :desc => N_("Organization ID"), :required => true
91
98
  def disable_simple_content_access
@@ -21,12 +21,16 @@ module Katello
21
21
  end
22
22
 
23
23
  def find_authorized_katello_resource
24
- finder_scope = ::Foreman::AccessControl.permissions_for_controller_action(path_to_authenticate).first&.finder_scope
25
- if finder_scope
26
- instance_variable_set("@#{resource_name}", resource_class.send(finder_scope).find_by(:id => params[:id]))
24
+ found_entity = nil
25
+ ::Foreman::AccessControl.permissions_for_controller_action(path_to_authenticate).each do |permission|
26
+ next unless found_entity.blank?
27
+ finder_scope = permission&.finder_scope
28
+ if finder_scope
29
+ found_entity = resource_class.send(finder_scope).find_by(:id => params[:id])
30
+ end
27
31
  end
28
-
29
- throw_resource_not_found if instance_variable_get("@#{resource_name}").nil?
32
+ throw_resource_not_found if found_entity.blank?
33
+ instance_variable_set("@#{resource_name}", found_entity)
30
34
  end
31
35
 
32
36
  def find_unauthorized_katello_resource
@@ -38,6 +42,16 @@ module Katello
38
42
  fail HttpErrors::NotFound, _("Could not find %{name} resource with id %{id}") % {id: id, name: name}
39
43
  end
40
44
 
45
+ def throw_resources_not_found(name:, expected_ids: [])
46
+ resources = yield
47
+ found_ids = resources.map(&:id)
48
+ missing_ids = expected_ids.map(&:to_i) - found_ids
49
+
50
+ if missing_ids.any?
51
+ fail HttpErrors::NotFound, _("Could not find %{name} resources with ids %{ids}") % {ids: missing_ids.join(', '), name: name}
52
+ end
53
+ end
54
+
41
55
  def check_association_ids
42
56
  if filtered_associations
43
57
  wrapped_params = params[self._wrapper_options.name]
@@ -3,37 +3,41 @@ module Katello
3
3
  module Api::V2::BulkHostsExtensions
4
4
  extend ActiveSupport::Concern
5
5
 
6
+ def bulk_hosts_relation(permission, org)
7
+ relation = ::Host::Managed.authorized(permission)
8
+ relation = relation.where(organization: org) if org
9
+ relation
10
+ end
11
+
6
12
  def find_bulk_hosts(permission, bulk_params, restrict_to = nil)
7
13
  #works on a structure of param_group bulk_params and transforms it into a list of systems
8
- find_organization
9
14
  bulk_params[:included] ||= {}
10
15
  bulk_params[:excluded] ||= {}
11
- @hosts = []
12
16
 
13
- unless bulk_params[:included][:ids].blank?
14
- @hosts = ::Host::Managed.authorized(permission).where(:id => bulk_params[:included][:ids])
15
- @hosts = @hosts.where(:organization_id => @organization.id) if @organization
17
+ if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
18
+ fail HttpErrors::BadRequest, _("No hosts have been specified.")
19
+ end
20
+
21
+ find_organization
22
+ @hosts = bulk_hosts_relation(permission, @organization)
23
+
24
+ if bulk_params[:included][:ids].present?
25
+ @hosts = @hosts.where(id: bulk_params[:included][:ids])
16
26
  end
17
27
 
18
28
  if bulk_params[:included][:search]
19
- search_hosts = ::Host::Managed.authorized(permission)
20
- search_hosts = search_hosts.where(:organization_id => @organization.id) if @organization
21
- search_hosts = search_hosts.search_for(bulk_params[:included][:search])
22
- if @hosts.any?
23
- @hosts = ::Host.where(id: @hosts).or(::Host.where(id: search_hosts))
24
- else
25
- @hosts = search_hosts
26
- end
29
+ search_hosts = bulk_hosts_relation(permission, @organization).search_for(bulk_params[:included][:search])
30
+ @hosts = @hosts.merge(search_hosts)
27
31
  end
28
32
 
29
33
  @hosts = restrict_to.call(@hosts) if restrict_to
30
- @hosts = @hosts.where.not(id: bulk_params[:excluded][:ids]) unless bulk_params[:excluded][:ids].blank?
31
34
 
32
- if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
33
- fail HttpErrors::BadRequest, _("No hosts have been specified.")
34
- elsif @hosts.empty?
35
- fail HttpErrors::Forbidden, _("Action unauthorized to be performed on selected hosts.")
35
+ if bulk_params[:excluded][:ids].present?
36
+ @hosts = @hosts.where.not(id: bulk_params[:excluded][:ids])
36
37
  end
38
+
39
+ fail HttpErrors::Forbidden, _("Action unauthorized to be performed on selected hosts.") if @hosts.empty?
40
+
37
41
  @hosts
38
42
  end
39
43
 
@@ -0,0 +1,21 @@
1
+ module Katello
2
+ module Concerns
3
+ module Api::V2::RegistrationControllerExtensions
4
+ extend ActiveSupport::Concern
5
+
6
+ def prepare_host
7
+ if params['uuid']
8
+ @host = Katello::Host::SubscriptionFacet.find_by(uuid: params['uuid'])&.host
9
+ if @host.nil?
10
+ msg = N_("Host was not found by the subscription UUID: '%s', this can happen if the host is registered already, but not to this Foreman") % params['uuid']
11
+ fail ActiveRecord::RecordNotFound, msg
12
+ end
13
+ @host.assign_attributes(host_params('host'))
14
+ @host.save!
15
+ else
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -60,7 +60,7 @@ module Katello
60
60
  collection = custom_collection_by_content_view_version(@versions)
61
61
  else
62
62
  repos = Katello::Repository.where(:content_view_version_id => @versions.pluck(:id))
63
- repos = repos.where(:library_instance_id => @repo.id) if @repo
63
+ repos = repos.where(:root_id => @repo.root_id) if @repo
64
64
  collection = filter_by_repos(repos, resource_class.all)
65
65
  end
66
66
 
@@ -7,7 +7,8 @@ module Katello
7
7
 
8
8
  module Overrides
9
9
  def edit
10
- @can_toggle_sca = Katello::UpstreamConnectionChecker.new(@taxonomy).can_connect?
10
+ @can_toggle_sca = Katello::UpstreamConnectionChecker.new(@taxonomy).can_connect? &&
11
+ (@taxonomy.upstream_consumer.simple_content_access_eligible? || @taxonomy.simple_content_access?)
11
12
  super
12
13
  end
13
14
 
@@ -0,0 +1,16 @@
1
+ module Katello
2
+ module Concerns
3
+ module RegistrationControllerExtensions
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_action :format_activation_key, only: [:create]
8
+ end
9
+
10
+ def format_activation_key
11
+ return if params[:activation_key].blank?
12
+ params[:activation_key] = params[:activation_key].split(',').map(&:strip).reject(&:blank?).join(',')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,12 +6,15 @@ module Katello
6
6
  ::Setting[:foreman_url].sub(%r|^.*?:|, "#{schema}:")
7
7
  end
8
8
 
9
- def subscription_manager_configuration_url(host = nil, rpm = true)
10
- prefix = if host&.content_source
9
+ def subscription_manager_configuration_url(host = nil, rpm = true, hostname: nil)
10
+ prefix = if hostname
11
+ "http://#{hostname}"
12
+ elsif host&.content_source
11
13
  "http://#{host.content_source.hostname}"
12
14
  else
13
15
  foreman_settings_url
14
16
  end
17
+
15
18
  config = rpm ? SETTINGS[:katello][:consumer_cert_rpm] : SETTINGS[:katello][:consumer_cert_sh]
16
19
 
17
20
  "#{prefix}/pub/#{config}"
@@ -9,6 +9,7 @@ module Actions
9
9
  param :label
10
10
  param :content_url
11
11
  param :owner
12
+ param :os_versions
12
13
  end
13
14
 
14
15
  def run
@@ -19,6 +20,7 @@ module Actions
19
20
  type: input[:type],
20
21
  arches: input[:arches],
21
22
  label: input[:label],
23
+ requiredTags: input[:os_versions],
22
24
  metadataExpire: 1,
23
25
  vendor: ::Katello::Provider::CUSTOM)
24
26
  end
@@ -7,6 +7,7 @@ module Actions
7
7
  param :name
8
8
  param :type
9
9
  param :arches
10
+ param :os_versions
10
11
  param :label
11
12
  param :content_url
12
13
  param :gpg_key_url
@@ -22,6 +23,7 @@ module Actions
22
23
  gpgUrl: input[:gpg_key_url] || '', #candlepin ignores nil
23
24
  type: input[:type],
24
25
  arches: input[:arches],
26
+ requiredTags: input[:os_versions],
25
27
  label: input[:label],
26
28
  metadataExpire: 1,
27
29
  vendor: ::Katello::Provider::CUSTOM)
@@ -0,0 +1,24 @@
1
+ module Actions
2
+ module Helpers
3
+ module SmartProxySyncHistoryHelper
4
+ def self.included(base)
5
+ base.middleware.use ::Actions::Middleware::RecordSmartProxySyncHistory
6
+ end
7
+
8
+ def done?
9
+ is_done = super
10
+ if is_done
11
+ ::Katello::SmartProxySyncHistory.where(:id => output[:smart_proxy_history_id], :finished_at => nil).update_all(finished_at: Time.now)
12
+ end
13
+ is_done
14
+ end
15
+
16
+ def rescue_external_task(error)
17
+ if output[:smart_proxy_history_id]
18
+ ::Katello::SmartProxySyncHistory.where(:id => output[:smart_proxy_history_id], :finished_at => nil).delete_all
19
+ end
20
+ super
21
+ end
22
+ end
23
+ end
24
+ end
@@ -9,8 +9,12 @@ module Actions
9
9
 
10
10
  def run
11
11
  input[:host_ids].each do |host_id|
12
- content_facet = ::Host.find(host_id).content_facet
13
- content_facet.calculate_and_import_applicability
12
+ content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id)
13
+ if content_facet.present?
14
+ content_facet.calculate_and_import_applicability
15
+ else
16
+ Rails.logger.warn(_("Content Facet for host with id %s is non-existent. Skipping applicability calculation.") % host_id)
17
+ end
14
18
  end
15
19
  end
16
20
 
@@ -39,7 +39,7 @@ module Actions
39
39
  environment: environment,
40
40
  repository: repository)
41
41
  sequence do
42
- plan_action(Actions::Pulp::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
42
+ plan_action(Actions::Pulp::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options) if smart_proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE)
43
43
  plan_action(Actions::Pulp3::CapsuleContent::RefreshContentGuard, smart_proxy) if repositories.any? { |repo| smart_proxy.pulp3_support?(repo) }
44
44
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options) if smart_proxy.pulp3_enabled?
45
45
  plan_action(SyncCapsule, smart_proxy, refresh_options)
@@ -9,9 +9,8 @@ module Actions
9
9
  content_view = options[:content_view]
10
10
  repository = options[:repository]
11
11
  skip_metadata_check = options.fetch(:skip_metadata_check, false)
12
-
13
12
  sequence do
14
- repos = repos_to_sync(smart_proxy, environment, content_view, repository)
13
+ repos = repos_to_sync(smart_proxy, environment, content_view, repository, skip_metadata_check)
15
14
 
16
15
  repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
17
16
  concurrence do
@@ -20,7 +19,6 @@ module Actions
20
19
  Actions::Pulp3::CapsuleContent::Sync],
21
20
  repo, smart_proxy,
22
21
  skip_metadata_check: skip_metadata_check)
23
-
24
22
  if repo.is_a?(::Katello::Repository) &&
25
23
  repo.distribution_bootable? &&
26
24
  repo.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND
@@ -34,22 +32,33 @@ module Actions
34
32
  end
35
33
  end
36
34
 
37
- def repos_to_sync(smart_proxy, environment, content_view, repository)
35
+ def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
38
36
  smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
39
37
  smart_proxy_helper.lifecycle_environment_check(environment, repository)
40
-
41
38
  if repository
42
- [repository]
39
+ if skip_metatadata_check || !repository.smart_proxy_sync_histories.where(:smart_proxy_id => smart_proxy).any? { |sph| !sph.finished_at.nil? }
40
+ [repository]
41
+ end
43
42
  else
44
43
  repositories = smart_proxy_helper.repositories_available_to_capsule(environment, content_view).by_rpm_count
45
44
  puppet_envs = smart_proxy_helper.puppet_environments_available_to_capsule(environment, content_view)
46
- repositories + puppet_envs
45
+ repositories_to_skip = []
46
+ if skip_metatadata_check
47
+ smart_proxy_helper.clear_smart_proxy_sync_histories repositories
48
+ else
49
+ repositories_to_skip = ::Katello::Repository.synced_on_capsule smart_proxy
50
+ end
51
+ repositories - repositories_to_skip + puppet_envs
47
52
  end
48
53
  end
49
54
 
50
55
  def resource_locks
51
56
  :link
52
57
  end
58
+
59
+ def rescue_strategy
60
+ Dynflow::Action::Rescue::Skip
61
+ end
53
62
  end
54
63
  end
55
64
  end
@@ -71,7 +71,7 @@ module Actions
71
71
  private
72
72
 
73
73
  def sync_proxies?(environment)
74
- Setting[:foreman_proxy_content_auto_sync] && ::SmartProxy.sync_needed?(environment)
74
+ ::SmartProxy.sync_needed?(environment)
75
75
  end
76
76
 
77
77
  def repos_to_delete(version, environment)
@@ -6,11 +6,10 @@ module Actions
6
6
  include ::Katello::ContentViewHelper
7
7
  attr_accessor :version
8
8
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
9
- def plan(content_view, description = "", options = {})
9
+ def plan(content_view, description = "", options = {importing: false})
10
10
  action_subject(content_view)
11
- import_only = options.fetch(:import_only, false)
12
- path = options[:path]
13
- content_view.check_ready_to_publish! unless import_only
11
+
12
+ content_view.check_ready_to_publish!(importing: options[:importing])
14
13
 
15
14
  if options[:repos_units].present?
16
15
  valid_labels_from_cv = content_view.repositories.map(&:label)
@@ -53,8 +52,9 @@ module Actions
53
52
 
54
53
  if separated_repo_map[:pulp3_yum].keys.flatten.present? &&
55
54
  SmartProxy.pulp_primary.pulp3_support?(separated_repo_map[:pulp3_yum].keys.flatten.first)
56
- if import_only
57
- handle_import(version, path)
55
+
56
+ if options[:importing]
57
+ handle_import(version, options.slice(:path, :metadata))
58
58
  else
59
59
  plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
60
60
  end
@@ -137,7 +137,7 @@ module Actions
137
137
  history.save!
138
138
  environment = ::Katello::KTEnvironment.find(input[:environment_id])
139
139
  view = ::Katello::ContentView.find(input[:content_view_id])
140
- if SmartProxy.sync_needed?(environment) && Setting[:foreman_proxy_content_auto_sync] && !input[:skip_promotion]
140
+ if SmartProxy.sync_needed?(environment) && !input[:skip_promotion]
141
141
  ForemanTasks.async_task(ContentView::CapsuleSync,
142
142
  view,
143
143
  environment)
@@ -188,8 +188,8 @@ module Actions
188
188
  end
189
189
  end
190
190
 
191
- def handle_import(version, path)
192
- plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Import, version, path: path)
191
+ def handle_import(version, path:, metadata:)
192
+ plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Import, version, path: path, metadata: metadata)
193
193
  plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
194
194
  concurrence do
195
195
  version.importable_repositories.pluck(:id).each do |id|
@@ -2,27 +2,22 @@ module Actions
2
2
  module Katello
3
3
  module ContentViewVersion
4
4
  class Import < Actions::EntryAction
5
- PULP_USER = 'pulp'.freeze
6
-
7
- def plan(content_view, path:)
5
+ def plan(content_view, path:, metadata:)
8
6
  content_view.check_ready_to_import!
9
7
  unless SmartProxy.pulp_primary.pulp3_repository_type_support?(::Katello::Repository::YUM_TYPE)
10
- fail HttpErrors::BadRequest, _("This API endpoint is only valid for Pulp 3 repositories.")
8
+ fail _("This action will become available after the Pulp 3 content migration")
11
9
  end
12
- ::Katello::Pulp3::ContentViewVersion::Import.check_permissions!(path)
13
- metadata = ::Katello::Pulp3::ContentViewVersion::Import.metadata(path)
10
+
11
+ ::Katello::Pulp3::ContentViewVersion::Import.check!(content_view: content_view, metadata: metadata, path: path)
12
+ ::Katello::Pulp3::ContentViewVersion::Import.reset_content_view_repositories_from_metadata!(content_view: content_view, metadata: metadata)
13
+
14
14
  major = metadata[:content_view_version][:major]
15
15
  minor = metadata[:content_view_version][:minor]
16
16
 
17
- if ::Katello::ContentViewVersion.where(major: major, minor: minor, content_view: content_view).exists?
18
- cvv_name = "#{content_view.name} #{major}.#{minor}"
19
- fail _("Content View Version specified in the metadata - '%{name}' already exists. "\
20
- "If you wish to replace the existing version, delete %{name} and try again. " % { name: cvv_name })
21
- end
22
-
23
17
  plan_action(::Actions::Katello::ContentView::Publish, content_view, '',
24
18
  path: path,
25
- import_only: true,
19
+ metadata: metadata,
20
+ importing: true,
26
21
  major: major,
27
22
  minor: minor)
28
23
  end