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
@@ -37,7 +37,7 @@ module Katello
37
37
  before_action :find_organization, :only => [:create, :paths, :auto_complete_search]
38
38
  before_action :find_optional_organization, :only => [:index, :show, :update, :destroy]
39
39
  before_action :find_prior, :only => [:create]
40
- before_action :find_environment, :only => [:show, :update, :destroy, :repositories]
40
+ before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :repositories]
41
41
  before_action :find_content_view, :only => [:repositories]
42
42
  before_action :find_path, :only => [:create]
43
43
 
@@ -154,16 +154,16 @@ module Katello
154
154
  respond_for_index(:collection => collection, :template => :paths)
155
155
  end
156
156
 
157
- protected
157
+ def resource_name
158
+ 'environment'
159
+ end
158
160
 
159
- def find_environment
160
- identifier = params.require(:id) || params.require(:environment).require(:id)
161
- @environment = KTEnvironment.find(identifier)
162
- fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % identifier.to_s if @environment.nil?
163
- @organization = @environment.organization
164
- @environment
161
+ def resource_class
162
+ Katello::KTEnvironment
165
163
  end
166
164
 
165
+ protected
166
+
167
167
  def find_prior
168
168
  prior = params[:environment][:prior] || params.require(:environment).require(:prior_id)
169
169
  @prior = KTEnvironment.readable.find(prior)
@@ -52,13 +52,13 @@ module Katello
52
52
  respond_for_create(:resource => gpg_key)
53
53
  end
54
54
 
55
- api :GET, "/gpg_keys/:id", N_("Show a gpg key")
55
+ api :GET, "/gpg_keys/:id", N_("Show a gpg key"), :deprecated => true
56
56
  param :id, :number, :desc => N_("gpg key numeric identifier"), :required => true
57
57
  def show
58
58
  respond_for_show(:resource => @gpg_key)
59
59
  end
60
60
 
61
- api :PUT, "/gpg_keys/:id", N_("Update a repository")
61
+ api :PUT, "/gpg_keys/:id", N_("Update a repository"), :deprecated => true
62
62
  param :id, :number, :desc => N_("gpg key numeric identifier"), :required => true
63
63
  param_group :gpg_key
64
64
  def update
@@ -67,20 +67,20 @@ module Katello
67
67
  respond_for_show(:resource => @gpg_key)
68
68
  end
69
69
 
70
- api :DELETE, "/gpg_keys/:id", N_("Destroy a gpg key")
70
+ api :DELETE, "/gpg_keys/:id", N_("Destroy a gpg key"), :deprecated => true
71
71
  param :id, :number, :desc => N_("gpg key numeric identifier"), :required => true
72
72
  def destroy
73
73
  @gpg_key.destroy
74
74
  respond_for_destroy
75
75
  end
76
76
 
77
- api :GET, "/gpg_keys/:id/content", N_("Return the content of a gpg key, used directly by yum")
77
+ api :GET, "/gpg_keys/:id/content", N_("Return the content of a gpg key, used directly by yum"), :deprecated => true
78
78
  param :id, :number, :required => true
79
79
  def content
80
80
  render(:plain => @gpg_key.content, :layout => false)
81
81
  end
82
82
 
83
- api :POST, "/gpg_keys/:id/content", N_("Upload gpg key contents")
83
+ api :POST, "/gpg_keys/:id/content", N_("Upload gpg key contents"), :deprecated => true
84
84
  param :id, :number, :desc => N_("gpg key numeric identifier"), :required => true
85
85
  param :content, File, :desc => N_("file contents"), :required => true
86
86
  def set_content
@@ -1,10 +1,17 @@
1
1
  module Katello
2
2
  class Api::V2::HostCollectionsController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
- before_action :find_host_collection, :only => [:copy, :show, :update, :destroy,
5
- :add_hosts, :remove_hosts, :hosts]
6
- before_action :find_activation_key
7
- before_action :find_host
4
+ before_action :find_authorized_katello_resource, :only => [
5
+ :copy,
6
+ :show,
7
+ :update,
8
+ :destroy,
9
+ :add_hosts,
10
+ :remove_hosts,
11
+ :hosts
12
+ ]
13
+ before_action :find_readable_activation_key, :only => [:index]
14
+ before_action :find_editable_host, :only => [:index]
8
15
  before_action :find_optional_organization, :only => [:index]
9
16
  before_action :find_organization, :only => [:create, :auto_complete_search]
10
17
 
@@ -175,14 +182,6 @@ module Katello
175
182
 
176
183
  private
177
184
 
178
- def find_host_collection
179
- @organization = @host.organization if @host
180
- @organization = @activation_key.organization if @activation_key
181
- id = params[:host_collection_id] || params[:id]
182
- @host_collection = HostCollection.where(:id => id).first
183
- fail HttpErrors::NotFound, _("Couldn't find host collection '%s'") % id if @host_collection.nil?
184
- end
185
-
186
185
  def host_collection_params
187
186
  attrs = [:name,
188
187
  :description,
@@ -199,14 +198,18 @@ module Katello
199
198
  result
200
199
  end
201
200
 
202
- def find_host
201
+ def find_editable_host
203
202
  @host = resource_finder(::Host::Managed.authorized("edit_hosts"), params[:host_id]) if params[:host_id]
204
203
  @organization = @host.organization if @host
205
204
  end
206
205
 
207
- def find_activation_key
208
- @activation_key = ActivationKey.find_by!(:id => params[:activation_key_id]) if params[:activation_key_id]
209
- @organization = @activation_key.organization if @activation_key
206
+ def find_readable_activation_key
207
+ @activation_key = ActivationKey.readable.find_by(:id => params[:activation_key_id]) if params[:activation_key_id]
208
+ if params[:activation_key_id] && @activation_key.nil?
209
+ throw_resource_not_found(name: 'activation_key', id: params[:activation_key_id])
210
+ else
211
+ @organization = @activation_key&.organization
212
+ end
210
213
  end
211
214
  end
212
215
  end
@@ -29,6 +29,7 @@ module Katello
29
29
 
30
30
  def find_host
31
31
  @host = resource_finder(::Host::Managed.authorized(:view_hosts, ::Host::Managed), params[:host_id])
32
+ throw_resource_not_found(name: 'host', id: params[:host_id]) if @host.nil?
32
33
  end
33
34
  end
34
35
  end
@@ -125,13 +125,13 @@ module Katello
125
125
 
126
126
  def find_host
127
127
  @host = resource_finder(::Host::Managed.authorized("view_hosts"), params[:host_id])
128
- fail HttpErrors::NotFound, _("Couldn't find host '%s'") % params[:host_id] if @host.nil?
128
+ throw_resource_not_found(name: 'host', id: params[:host_id]) if @host.nil?
129
129
  @host
130
130
  end
131
131
 
132
132
  def find_host_editable
133
133
  @host = resource_finder(::Host::Managed.authorized("edit_hosts"), params[:host_id])
134
- fail HttpErrors::NotFound, _("Couldn't find host '%s'") % params[:host_id] if @host.nil?
134
+ throw_resource_not_found(name: 'host', id: params[:host_id]) if @host.nil?
135
135
  @host
136
136
  end
137
137
 
@@ -7,11 +7,12 @@ module Katello
7
7
  before_action :find_host_collections, :only => [:bulk_add_host_collections, :bulk_remove_host_collections]
8
8
  before_action :find_environment, :only => [:environment_content_view]
9
9
  before_action :find_content_view, :only => [:environment_content_view]
10
- before_action :find_editable_hosts, :except => [:destroy_hosts, :applicable_errata, :installable_errata, :resolve_traces]
10
+ before_action :find_editable_hosts, :except => [:destroy_hosts, :resolve_traces]
11
11
  before_action :find_deletable_hosts, :only => [:destroy_hosts]
12
12
  before_action :find_readable_hosts, :only => [:applicable_errata, :installable_errata, :available_incremental_updates]
13
13
  before_action :find_errata, :only => [:available_incremental_updates]
14
14
  before_action :find_organization, :only => [:add_subscriptions]
15
+ before_action :find_traces, :only => [:resolve_traces]
15
16
  before_action :deprecate_katello_agent, :only => [:install_content, :update_content, :remove_content]
16
17
 
17
18
  before_action :validate_content_action, :only => [:install_content, :update_content, :remove_content]
@@ -241,12 +242,28 @@ module Katello
241
242
  param_group :bulk_params
242
243
  param :trace_ids, Array, :required => true, :desc => N_("Array of Trace IDs")
243
244
  def resolve_traces
244
- traces = Katello::HostTracer.resolvable.where(id: params[:trace_ids])
245
- result = Katello::HostTraceManager.resolve_traces(traces)
245
+ result = Katello::HostTraceManager.resolve_traces(@traces)
246
246
 
247
247
  render json: result
248
248
  end
249
249
 
250
+ api :PUT, "/hosts/bulk/system_purpose", N_("Assign system purpose attributes on one or more hosts")
251
+ param_group :bulk_params
252
+ param :service_level, String, :desc => N_("Service level of host")
253
+ param :purpose_role, String, :desc => N_("Role of host")
254
+ param :purpose_usage, String, :desc => N_("Usage of host")
255
+ param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
256
+ def system_purpose
257
+ task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::UpdateSystemPurpose,
258
+ @hosts,
259
+ params[:service_level],
260
+ params[:purpose_role],
261
+ params[:purpose_usage],
262
+ params[:purpose_addons])
263
+
264
+ respond_for_async :resource => task
265
+ end
266
+
250
267
  api :POST, "/hosts/bulk/available_incremental_updates", N_("Given a set of hosts and errata, lists the content view versions" \
251
268
  " and environments that need updating.")
252
269
  param_group :bulk_params
@@ -297,7 +314,9 @@ module Katello
297
314
  end
298
315
 
299
316
  def find_host_collections
300
- @host_collections = HostCollection.where(:id => params[:host_collection_ids])
317
+ throw_resources_not_found(name: 'host collection', expected_ids: params[:host_collection_ids]) do
318
+ @host_collections = HostCollection.editable.where(id: params[:host_collection_ids])
319
+ end
301
320
  end
302
321
 
303
322
  def find_readable_hosts
@@ -360,11 +379,21 @@ module Katello
360
379
  end
361
380
 
362
381
  def find_environment
363
- @environment = KTEnvironment.find(params[:environment_id])
382
+ @environment = KTEnvironment.editable.find(params[:environment_id])
383
+ throw_resource_not_found(name: 'lifecycle environment', id: params[:environment_id]) unless @environment
384
+ @environment
364
385
  end
365
386
 
366
387
  def find_content_view
367
- @view = ContentView.find(params[:content_view_id])
388
+ @view = ContentView.editable.find(params[:content_view_id])
389
+ throw_resource_not_found(name: 'content view', id: params[:content_view_id]) unless @view
390
+ @view
391
+ end
392
+
393
+ def find_traces
394
+ throw_resources_not_found(name: 'host trace', expected_ids: params[:trace_ids]) do
395
+ @traces = Katello::HostTracer.resolvable.where(id: params[:trace_ids])
396
+ end
368
397
  end
369
398
 
370
399
  def disable_erratum_hosts_count
@@ -107,7 +107,7 @@ module Katello
107
107
 
108
108
  def find_products
109
109
  params.require(:ids)
110
- @products = Product.where(:id => params[:ids])
110
+ @products = Product.readable.where(:id => params[:ids])
111
111
  end
112
112
  end
113
113
  end
@@ -4,7 +4,7 @@ module Katello
4
4
 
5
5
  before_action :find_activation_key, :only => [:index]
6
6
  before_action :find_organization, :only => [:create, :index, :auto_complete_search]
7
- before_action :find_product, :only => [:update, :destroy, :sync]
7
+ before_action :find_authorized_katello_resource, :only => [:update, :destroy, :sync]
8
8
  before_action :find_organization_from_product, :only => [:update]
9
9
  before_action :authorize_gpg_key, :only => [:update, :create]
10
10
  before_action :authorize_ssl_ca_cert, :only => [:update, :create]
@@ -131,14 +131,14 @@ module Katello
131
131
  protected
132
132
 
133
133
  def find_product(options = {})
134
- @product = Product.includes(options[:includes] || []).find_by(:id => params[:id])
135
- fail HttpErrors::NotFound, _("Couldn't find product '%s'") % params[:id] unless @product
134
+ @product = Product.includes(options[:includes] || []).readable.find_by(:id => params[:id])
135
+ throw_resource_not_found(name: 'product', id: params[:id]) if @product.nil?
136
136
  end
137
137
 
138
138
  def find_activation_key
139
139
  if params[:activation_key_id]
140
- @activation_key = ActivationKey.find_by(:id => params[:activation_key_id])
141
- fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % params[:activation_key_id] if @activation_key.nil?
140
+ @activation_key = ActivationKey.readable.find_by(:id => params[:activation_key_id])
141
+ throw_resource_not_found(name: 'Activation Key', id: params[:activation_key_id]) if @activation_key.nil?
142
142
  @organization = @activation_key.organization
143
143
  end
144
144
  end
@@ -151,7 +151,7 @@ module Katello
151
151
  gpg_key_id = product_params[:gpg_key_id]
152
152
  if gpg_key_id
153
153
  gpg_key = GpgKey.readable.where(:id => gpg_key_id, :organization_id => @organization).first
154
- fail HttpErrors::NotFound, _("Couldn't find gpg key '%s'") % gpg_key_id if gpg_key.nil?
154
+ throw_resource_not_found(name: 'gpg key', id: gpg_key_id) if gpg_key.nil?
155
155
  end
156
156
  end
157
157
 
@@ -159,7 +159,7 @@ module Katello
159
159
  ssl_ca_cert_id = product_params[:ssl_ca_cert_id]
160
160
  if ssl_ca_cert_id
161
161
  ssl_ca_cert = GpgKey.readable.where(:id => ssl_ca_cert_id, :organization_id => @organization).first
162
- fail HttpErrors::NotFound, _("Couldn't find ssl ca cert '%s'") % ssl_ca_cert_id if ssl_ca_cert.nil?
162
+ throw_resource_not_found(name: 'ssl ca cert', id: ssl_ca_cert_id) if ssl_ca_cert.nil?
163
163
  end
164
164
  end
165
165
 
@@ -167,7 +167,7 @@ module Katello
167
167
  ssl_client_cert_id = product_params[:ssl_client_cert_id]
168
168
  if ssl_client_cert_id
169
169
  ssl_client_cert = GpgKey.readable.where(:id => ssl_client_cert_id, :organization_id => @organization).first
170
- fail HttpErrors::NotFound, _("Couldn't find ssl client cert '%s'") % ssl_client_cert_id if ssl_client_cert.nil?
170
+ throw_resource_not_found(name: 'ssl client cert', id: ssl_client_cert_id) if ssl_client_cert.nil?
171
171
  end
172
172
  end
173
173
 
@@ -175,7 +175,7 @@ module Katello
175
175
  ssl_client_key_id = product_params[:ssl_client_key_id]
176
176
  if ssl_client_key_id
177
177
  ssl_client_key = GpgKey.readable.where(:id => ssl_client_key_id, :organization_id => @organization).first
178
- fail HttpErrors::NotFound, _("Couldn't find ssl client key '%s'") % ssl_client_key_id if ssl_client_key.nil?
178
+ throw_resource_not_found(name: 'ssl client key', id: ssl_client_key_id) if ssl_client_key.nil?
179
179
  end
180
180
  end
181
181
 
@@ -62,7 +62,7 @@ module Katello
62
62
 
63
63
  def find_repositories
64
64
  params.require(:ids)
65
- @repositories = Repository.where(:id => params[:ids])
65
+ @repositories = Repository.readable.where(:id => params[:ids])
66
66
  end
67
67
  end
68
68
  end
@@ -35,6 +35,8 @@ module Katello
35
35
 
36
36
  def_param_group :repo do
37
37
  param :url, String, :desc => N_("repository source url")
38
+ param :os_versions, Array,
39
+ :desc => N_("Identifies whether the repository should be disabled on a client with a non-matching OS version. Pass [] to enable regardless of OS version. Maximum length 1; allowed tags are: %s") % Katello::RootRepository::ALLOWED_OS_VERSIONS.join(', ')
38
40
  param :gpg_key_id, :number, :desc => N_("id of the gpg key that will be assigned to the new repository")
39
41
  param :ssl_ca_cert_id, :number, :desc => N_("Identifier of the content credential containing the SSL CA Cert")
40
42
  param :ssl_client_cert_id, :number, :desc => N_("Identifier of the content credential containing the SSL Client Cert")
@@ -42,7 +44,7 @@ module Katello
42
44
  param :unprotected, :bool, :desc => N_("true if this repository can be published via HTTP")
43
45
  param :checksum_type, String, :desc => N_("Checksum of the repository, currently 'sha1' & 'sha256' are supported")
44
46
  param :docker_upstream_name, String, :desc => N_("Name of the upstream docker repository")
45
- param :docker_tags_whitelist, Array, :desc => N_("Comma separated list of tags to sync for Container Image repository")
47
+ param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository")
46
48
  param :download_policy, ["immediate", "on_demand", "background"], :desc => N_("download policy for yum repos (either 'immediate', 'on_demand', or 'background (deprecated)')")
47
49
  param :download_concurrency, :number, :desc => N_("Used to determine download concurrency of the repository in pulp3. Use value less than 20. Defaults to 10")
48
50
  param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed")
@@ -51,9 +53,9 @@ module Katello
51
53
  param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
52
54
  param :ostree_upstream_sync_policy, ::Katello::RootRepository::OSTREE_UPSTREAM_SYNC_POLICIES, :desc => N_("policies for syncing upstream ostree repositories")
53
55
  param :ostree_upstream_sync_depth, :number, :desc => N_("if a custom sync policy is chosen for ostree repositories then a 'depth' value must be provided")
54
- param :deb_releases, String, :desc => N_("comma separated list of releases to be synched from deb-archive")
55
- param :deb_components, String, :desc => N_("comma separated list of repo components to be synched from deb-archive")
56
- param :deb_architectures, String, :desc => N_("comma separated list of architectures to be synched from deb-archive")
56
+ param :deb_releases, String, :desc => N_("comma-separated list of releases to be synced from deb-archive")
57
+ param :deb_components, String, :desc => N_("comma-separated list of repo components to be synced from deb-archive")
58
+ param :deb_architectures, String, :desc => N_("comma-separated list of architectures to be synced from deb-archive")
57
59
  param :ignore_global_proxy, :bool, :desc => N_("if true, will ignore the globally configured proxy when syncing"), :deprecated => true
58
60
  param :ignorable_content, Array, :desc => N_("List of content units to ignore while syncing a yum repository. Must be subset of %s") % RootRepository::IGNORABLE_CONTENT_UNIT_TYPES.join(",")
59
61
  param :ansible_collection_requirements, String, :desc => N_("Contents of requirement yaml file to sync from URL")
@@ -93,6 +95,7 @@ module Katello
93
95
  param :available_for, String, :desc => N_("interpret specified object to return only Repositories that can be associated with specified object. Only 'content_view' & 'content_view_version' are supported."),
94
96
  :required => false
95
97
  param :with_content, RepositoryTypeManager.enabled_content_types, :desc => N_("only repositories having at least one of the specified content type ex: rpm , erratum")
98
+ param :download_policy, ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES, :desc => N_("limit to only repositories with this download policy")
96
99
  param_group :search, Api::V2::ApiController
97
100
  add_scoped_search_description_for(Repository)
98
101
  def index
@@ -136,6 +139,7 @@ module Katello
136
139
  def index_relation_product(query)
137
140
  query = query.joins(:root => :product).where("#{Product.table_name}.organization_id" => @organization) if @organization
138
141
  query = query.joins(:root).where("#{RootRepository.table_name}.product_id" => @product.id) if @product
142
+ query = query.joins(:root).where("#{RootRepository.table_name}.download_policy" => params[:download_policy]) if params[:download_policy]
139
143
  query
140
144
  end
141
145
 
@@ -476,7 +480,7 @@ module Katello
476
480
 
477
481
  def repository_params
478
482
  keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username, :download_concurrency,
479
- :ostree_upstream_sync_depth, :ostree_upstream_sync_policy,
483
+ :ostree_upstream_sync_depth, :ostree_upstream_sync_policy, {:os_versions => []},
480
484
  :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy, :http_proxy_id,
481
485
  {:ignorable_content => []}
482
486
  ]
@@ -527,6 +531,7 @@ module Katello
527
531
  root.ansible_collection_requirements = repo_params[:ansible_collection_requirements] if root.ansible_collection?
528
532
  root.http_proxy_policy = repo_params[:http_proxy_policy] if repo_params.key?(:http_proxy_policy)
529
533
  root.http_proxy_id = repo_params[:http_proxy_id] if repo_params.key?(:http_proxy_id)
534
+ root.os_versions = repo_params.fetch(:os_versions, []) if root.yum?
530
535
 
531
536
  if root.ostree?
532
537
  root.ostree_upstream_sync_policy = repo_params[:ostree_upstream_sync_policy]
@@ -4,8 +4,11 @@ module Katello
4
4
 
5
5
  include Katello::Concerns::FilteredAutoCompleteSearch
6
6
 
7
- before_action :find_product_or_organization
7
+ before_action :set_readable_product_scope, only: [:index, :show, :available_repositories, :auto_complete_search]
8
+ before_action :set_editable_product_scope, only: [:enable, :disable]
9
+ before_action :find_product
8
10
  before_action :custom_product?
11
+ before_action :find_organization
9
12
  before_action :find_product_content, :except => [:index, :auto_complete_search]
10
13
 
11
14
  resource_description do
@@ -102,7 +105,8 @@ module Katello
102
105
 
103
106
  def index_relation
104
107
  if @product.nil?
105
- relation = @organization.product_contents.displayable
108
+ authorized_product_contents = Katello::ProductContent.joins(:product).merge(@product_scope)
109
+ relation = @organization.product_contents.merge(authorized_product_contents).displayable
106
110
  else
107
111
  relation = @product.displayable_product_contents
108
112
  end
@@ -125,25 +129,31 @@ module Katello
125
129
  if @product.present?
126
130
  @product_content = @product.product_content_by_id(params[:id])
127
131
  else
128
- content = Katello::Content.find_by(:cp_content_id => params[:id], :organization_id => @organization[:id])
129
- @product_content = Katello::ProductContent.find_by(:content_id => content.id)
132
+ content = Katello::Content.where(cp_content_id: params[:id], organization: @organization)
133
+ authorized_product_contents = Katello::ProductContent.joins(:product).merge(@product_scope)
134
+ @product_content = authorized_product_contents.joins(:content).merge(content).first
135
+ @product = @product_content&.product
130
136
  end
131
- fail HttpErrors::NotFound, _("Couldn't find repository set with id '%s'.") % params[:id] if @product_content.nil?
132
- @product = @product_content.product if @product.nil?
137
+ throw_resource_not_found(name: 'repository set', id: params[:id]) if @product_content.nil?
133
138
  end
134
139
 
135
- def find_product_or_organization
140
+ def find_product
136
141
  if params[:product_id]
137
- find_product
138
- else
139
- @organization = find_organization
142
+ @product = @product_scope.find_by(id: params[:product_id])
143
+ throw_resource_not_found(name: 'product', id: params[:product_id]) if @product.nil?
140
144
  end
141
145
  end
142
146
 
143
- def find_product
144
- @product = Product.find_by(:id => params[:product_id])
145
- fail HttpErrors::NotFound, _("Couldn't find product with id '%s'") % params[:product_id] if @product.nil?
146
- @organization = @product.organization
147
+ def set_readable_product_scope
148
+ @product_scope = Katello::Product.readable
149
+ end
150
+
151
+ def set_editable_product_scope
152
+ @product_scope = Katello::Product.editable
153
+ end
154
+
155
+ def find_organization
156
+ @organization = @product&.organization || super
147
157
  end
148
158
 
149
159
  def custom_product?
@@ -19,7 +19,7 @@ module Katello
19
19
 
20
20
  api :GET, "/organizations/:organization_id/subscriptions", N_("List organization subscriptions")
21
21
  api :GET, "/activation_keys/:activation_key_id/subscriptions", N_("List an activation key's subscriptions")
22
- api :GET, "/subscriptions"
22
+ api :GET, "/subscriptions", N_("List subscriptions")
23
23
  param_group :search, Api::V2::ApiController
24
24
  param :organization_id, :number, :desc => N_("Organization ID"), :required => false
25
25
  param :host_id, String, :desc => N_("id of a host"), :required => false