katello 3.12.3 → 3.13.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (360) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +22 -3
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +32 -15
  5. data/app/controllers/katello/api/v2/ansible_collections_controller.rb +19 -0
  6. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +3 -0
  7. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +1 -0
  8. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -0
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +1 -0
  10. data/app/controllers/katello/api/v2/environments_controller.rb +1 -0
  11. data/app/controllers/katello/api/v2/errata_controller.rb +2 -1
  12. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -0
  13. data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -0
  14. data/app/controllers/katello/api/v2/host_debs_controller.rb +34 -0
  15. data/app/controllers/katello/api/v2/host_errata_controller.rb +51 -4
  16. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -0
  17. data/app/controllers/katello/api/v2/module_streams_controller.rb +1 -0
  18. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -3
  19. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +18 -0
  20. data/app/controllers/katello/api/v2/products_controller.rb +1 -0
  21. data/app/controllers/katello/api/v2/repositories_controller.rb +46 -11
  22. data/app/controllers/katello/api/v2/repository_sets_controller.rb +6 -5
  23. data/app/controllers/katello/api/v2/srpms_controller.rb +24 -0
  24. data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -0
  25. data/app/controllers/katello/application_controller.rb +1 -0
  26. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +2 -2
  27. data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +9 -0
  28. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +2 -0
  29. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +1 -1
  30. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +13 -10
  31. data/app/lib/actions/candlepin/activation_key/create.rb +7 -1
  32. data/app/lib/actions/candlepin/activation_key/update.rb +7 -1
  33. data/app/lib/actions/candlepin/owner/destroy.rb +1 -1
  34. data/app/lib/actions/candlepin/product/update.rb +17 -0
  35. data/app/lib/actions/helpers/output_propagator.rb +13 -0
  36. data/app/lib/actions/katello/activation_key/create.rb +4 -1
  37. data/app/lib/actions/katello/activation_key/update.rb +8 -2
  38. data/app/lib/actions/katello/content_view/publish.rb +22 -34
  39. data/app/lib/actions/katello/event_queue/poller_thread.rb +22 -9
  40. data/app/lib/actions/katello/host/update.rb +3 -1
  41. data/app/lib/actions/katello/host/upload_profiles.rb +16 -0
  42. data/app/lib/actions/katello/organization/destroy.rb +0 -11
  43. data/app/lib/actions/katello/product/update.rb +8 -0
  44. data/app/lib/actions/katello/product/update_http_proxy.rb +19 -0
  45. data/app/lib/actions/katello/provider/update.rb +6 -7
  46. data/app/lib/actions/katello/pulp_selector.rb +15 -5
  47. data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
  48. data/app/lib/actions/katello/repository/clone_contents.rb +19 -6
  49. data/app/lib/actions/katello/repository/clone_to_environment.rb +3 -5
  50. data/app/lib/actions/katello/repository/create.rb +3 -1
  51. data/app/lib/actions/katello/repository/destroy.rb +5 -4
  52. data/app/lib/actions/katello/repository/discover.rb +8 -8
  53. data/app/lib/actions/katello/repository/export.rb +1 -1
  54. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -5
  55. data/app/lib/actions/katello/repository/finish_upload.rb +8 -0
  56. data/app/lib/actions/katello/repository/import_upload.rb +5 -2
  57. data/app/lib/actions/katello/repository/index_content.rb +3 -2
  58. data/app/lib/actions/katello/repository/metadata_generate.rb +10 -4
  59. data/app/lib/actions/katello/repository/remove_content.rb +11 -3
  60. data/app/lib/actions/katello/repository/sync.rb +14 -7
  61. data/app/lib/actions/katello/repository/update.rb +11 -5
  62. data/app/lib/actions/katello/repository/update_http_proxy_details.rb +17 -0
  63. data/app/lib/actions/katello/repository/upload_files.rb +7 -3
  64. data/app/lib/actions/katello/subscription/update.rb +11 -0
  65. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlement.rb +3 -0
  66. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb +4 -1
  67. data/app/lib/actions/middleware/backend_services_check.rb +10 -2
  68. data/app/lib/actions/middleware/propagate_output.rb +15 -0
  69. data/app/lib/actions/middleware/pulp3_services_check.rb +9 -0
  70. data/app/lib/actions/pulp/abstract_async_task.rb +8 -1
  71. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +19 -0
  72. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +14 -0
  73. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +13 -0
  74. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +14 -0
  75. data/app/lib/actions/pulp/orchestration/repository/sync.rb +17 -0
  76. data/app/lib/actions/pulp/repository/copy_all_units.rb +1 -1
  77. data/app/lib/actions/pulp/repository/create.rb +0 -1
  78. data/app/lib/actions/pulp/repository/refresh.rb +0 -5
  79. data/app/lib/actions/pulp/repository/remove_units.rb +1 -1
  80. data/app/lib/actions/pulp/repository/sync.rb +8 -14
  81. data/app/lib/actions/pulp3/abstract.rb +2 -1
  82. data/app/lib/actions/pulp3/abstract_async_task.rb +15 -6
  83. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +55 -0
  84. data/app/lib/actions/pulp3/orchestration/repository/create.rb +1 -2
  85. data/app/lib/actions/pulp3/orchestration/repository/delete.rb +1 -2
  86. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +17 -2
  87. data/app/lib/actions/pulp3/orchestration/repository/remove_units.rb +18 -0
  88. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +19 -0
  89. data/app/lib/actions/pulp3/orchestration/repository/update.rb +15 -0
  90. data/app/lib/actions/pulp3/repository/copy_content.rb +19 -0
  91. data/app/lib/actions/pulp3/repository/copy_version.rb +19 -0
  92. data/app/lib/actions/pulp3/repository/create_publication.rb +3 -2
  93. data/app/lib/actions/pulp3/repository/presenters/abstract_sync_presenter.rb +42 -0
  94. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +57 -0
  95. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +7 -3
  96. data/app/lib/actions/pulp3/repository/remove_units.rb +23 -0
  97. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +6 -4
  98. data/app/lib/actions/pulp3/repository/save_publication.rb +5 -4
  99. data/app/lib/actions/pulp3/repository/save_version.rb +8 -4
  100. data/app/lib/actions/pulp3/repository/sync.rb +55 -0
  101. data/app/lib/actions/pulp3/repository/{delete_publisher.rb → update_distributions.rb} +5 -5
  102. data/app/lib/actions/pulp3/repository/{create_publisher.rb → update_remote.rb} +2 -2
  103. data/app/lib/actions/pulp3/repository/update_repository.rb +16 -0
  104. data/app/lib/katello/errors.rb +9 -0
  105. data/app/lib/katello/resources/candlepin/activation_key.rb +5 -4
  106. data/app/lib/katello/resources/candlepin/product.rb +4 -0
  107. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +11 -0
  108. data/app/lib/katello/resources/candlepin/upstream_pool.rb +6 -2
  109. data/app/lib/katello/resources/cdn.rb +3 -16
  110. data/app/lib/katello/util/cdn_var_substitutor.rb +0 -3
  111. data/app/lib/katello/util/http_proxy.rb +9 -9
  112. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +1 -1
  113. data/app/models/katello/activation_key.rb +14 -0
  114. data/app/models/katello/activation_key_purpose_addon.rb +6 -0
  115. data/app/models/katello/ansible_collection.rb +32 -0
  116. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  117. data/app/models/katello/concerns/host_managed_extensions.rb +3 -0
  118. data/app/models/katello/concerns/http_proxy_extensions.rb +60 -0
  119. data/app/models/katello/concerns/location_extensions.rb +8 -0
  120. data/app/models/katello/concerns/organization_extensions.rb +9 -0
  121. data/app/models/katello/concerns/pulp_database_unit.rb +56 -81
  122. data/app/models/katello/concerns/setting_extensions.rb +14 -0
  123. data/app/models/katello/concerns/smart_proxy_extensions.rb +27 -11
  124. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +8 -1
  125. data/app/models/katello/content_view.rb +4 -0
  126. data/app/models/katello/content_view_filter.rb +4 -8
  127. data/app/models/katello/docker_tag.rb +11 -10
  128. data/app/models/katello/erratum.rb +22 -0
  129. data/app/models/katello/event.rb +2 -0
  130. data/app/models/katello/events/auto_publish_composite_view.rb +41 -0
  131. data/app/models/katello/glue/pulp/repo.rb +0 -15
  132. data/app/models/katello/host/content_facet.rb +35 -4
  133. data/app/models/katello/host/subscription_facet.rb +14 -16
  134. data/app/models/katello/host_installed_deb.rb +7 -0
  135. data/app/models/katello/installed_deb.rb +10 -0
  136. data/app/models/katello/ping.rb +45 -10
  137. data/app/models/katello/product_content.rb +1 -1
  138. data/app/models/katello/purpose_addon.rb +11 -0
  139. data/app/models/katello/repository.rb +52 -41
  140. data/app/models/katello/repository_ansible_collection.rb +6 -0
  141. data/app/models/katello/repository_content_view_filter.rb +7 -0
  142. data/app/models/katello/rhsm_fact_parser.rb +11 -1
  143. data/app/models/katello/root_repository.rb +46 -4
  144. data/app/models/katello/srpm.rb +4 -0
  145. data/app/models/katello/subscription_facet_purpose_addon.rb +6 -0
  146. data/app/models/katello/yum_metadata_file.rb +3 -3
  147. data/app/models/setting/content.rb +32 -7
  148. data/app/overrides/add_about_page.rb +0 -7
  149. data/app/services/cert/certs.rb +1 -1
  150. data/app/services/katello/candlepin/consumer.rb +4 -0
  151. data/app/services/katello/event_queue.rb +33 -3
  152. data/app/services/katello/pulp/content_counts_calculator.rb +6 -0
  153. data/app/services/katello/pulp/docker_manifest.rb +1 -2
  154. data/app/services/katello/pulp/docker_manifest_list.rb +0 -1
  155. data/app/services/katello/pulp/file_unit.rb +1 -1
  156. data/app/services/katello/pulp/pulp_content_unit.rb +43 -0
  157. data/app/services/katello/pulp/repository.rb +32 -5
  158. data/app/services/katello/pulp/repository/file.rb +6 -1
  159. data/app/services/katello/pulp/repository/yum.rb +6 -6
  160. data/app/services/katello/pulp/rpm.rb +1 -1
  161. data/app/services/katello/pulp/srpm.rb +1 -1
  162. data/app/services/katello/pulp3/ansible_collection.rb +31 -0
  163. data/app/services/katello/pulp3/docker_blob.rb +17 -0
  164. data/app/services/katello/pulp3/docker_manifest.rb +36 -0
  165. data/app/services/katello/pulp3/docker_manifest_list.rb +30 -0
  166. data/app/services/katello/pulp3/docker_tag.rb +28 -0
  167. data/app/services/katello/pulp3/file_unit.rb +25 -0
  168. data/app/services/katello/pulp3/pulp_content_unit.rb +75 -0
  169. data/app/services/katello/pulp3/repository.rb +160 -47
  170. data/app/services/katello/pulp3/repository/ansible_collection.rb +49 -0
  171. data/app/services/katello/pulp3/repository/docker.rb +55 -0
  172. data/app/services/katello/pulp3/repository/file.rb +35 -25
  173. data/app/services/katello/repository_type.rb +15 -5
  174. data/app/services/katello/repository_type_manager.rb +32 -1
  175. data/app/views/dashboard/_subscription_widget.html.erb +7 -7
  176. data/app/views/foreman/smart_proxies/_content_tab.html.erb +5 -1
  177. data/app/views/katello/api/v2/activation_keys/base.json.rabl +5 -1
  178. data/app/views/katello/api/v2/ansible_collections/base.json.rabl +7 -0
  179. data/app/views/katello/api/v2/ansible_collections/index.json.rabl +7 -0
  180. data/app/views/katello/api/v2/ansible_collections/show.json.rabl +3 -0
  181. data/app/views/katello/api/v2/host_debs/base.json.rabl +4 -0
  182. data/app/views/katello/api/v2/host_debs/index.json.rabl +7 -0
  183. data/app/views/katello/api/v2/ping/show.json.rabl +2 -1
  184. data/app/views/katello/api/v2/repositories/base.json.rabl +3 -2
  185. data/app/views/katello/api/v2/repositories/show.json.rabl +8 -1
  186. data/app/views/katello/api/v2/srpms/index.json.rabl +7 -0
  187. data/app/views/katello/api/v2/srpms/show.json.rabl +5 -0
  188. data/app/views/katello/api/v2/subscription_facet/base.json.rabl +5 -1
  189. data/config/katello.yaml.example +1 -0
  190. data/config/routes/api/rhsm.rb +1 -0
  191. data/config/routes/api/v2.rb +16 -0
  192. data/config/routes/overrides.rb +4 -0
  193. data/db/migrate/20180502155123_add_installed_deb.rb +23 -0
  194. data/db/migrate/20190513162209_drop_repository_reference_publisher_href.rb +5 -0
  195. data/db/migrate/20190605014649_add_purpose_addons.rb +29 -0
  196. data/db/migrate/20190617142328_create_katello_ansible_collections.rb +25 -0
  197. data/db/migrate/20190618034438_add_ansible_collection_whitelist_to_katello_root_repositories.rb +5 -0
  198. data/db/migrate/20190619192151_add_activation_key_system_purpose_attributes.rb +14 -0
  199. data/db/migrate/20190701174401_add_http_proxy_policy_to_repository_root.rb +12 -0
  200. data/db/migrate/20190701192616_add_http_proxy_to_repository_root.rb +6 -0
  201. data/db/migrate/20190702182118_add_metadata_process_after_to_katello_event.rb +6 -0
  202. data/db/migrate/20190708195809_remove_all_manifest_downloaded.rb +11 -0
  203. data/db/migrate/20190723171639_update_content_view_filters_repositories_join_table.rb +11 -0
  204. data/db/seeds.d/115-http_proxy.rb +25 -0
  205. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -0
  206. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js +15 -0
  207. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +69 -4
  208. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +39 -0
  209. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
  210. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
  211. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +2 -1
  212. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -7
  213. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js +26 -0
  214. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-actions.controller.js +14 -0
  215. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +77 -0
  216. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs.controller.js +63 -0
  217. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +18 -21
  218. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs-actions.html +62 -0
  219. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs-installed.html +52 -0
  220. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs.html +9 -0
  221. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +1 -1
  222. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +21 -1
  223. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -1
  224. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +1 -2
  225. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +1 -1
  226. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-yum.html +4 -4
  227. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-debs.factory.js +20 -0
  228. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host.factory.js +9 -0
  229. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/http-proxies/http-proxies.module.js +14 -0
  230. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/http-proxies/http-proxy.factory.js +21 -0
  231. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +2 -1
  232. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-http-proxy-modal.controller.js +77 -0
  233. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-http-proxy-modal.html +57 -0
  234. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +25 -3
  235. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +13 -1
  236. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +75 -29
  237. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/http-proxy-service.js +53 -0
  238. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +18 -2
  239. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +42 -16
  240. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +7 -0
  241. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +16 -0
  242. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
  243. data/lib/katello.rb +0 -1
  244. data/lib/katello/engine.rb +2 -0
  245. data/lib/katello/permission_creator.rb +7 -2
  246. data/lib/katello/permissions/host_permissions.rb +3 -0
  247. data/lib/katello/plugin.rb +3 -2
  248. data/lib/katello/repository_types/ansible_collection.rb +8 -0
  249. data/lib/katello/repository_types/deb.rb +2 -1
  250. data/lib/katello/repository_types/docker.rb +23 -4
  251. data/lib/katello/repository_types/file.rb +7 -1
  252. data/lib/katello/repository_types/ostree.rb +2 -1
  253. data/lib/katello/repository_types/puppet.rb +2 -1
  254. data/lib/katello/repository_types/yum.rb +3 -2
  255. data/lib/katello/tasks/clean_published_repo_directories.rake +1 -1
  256. data/lib/katello/tasks/delete_orphaned_content.rake +16 -5
  257. data/lib/katello/tasks/jenkins.rake +2 -0
  258. data/lib/katello/tasks/update_content_default_http_proxy.rake +69 -0
  259. data/lib/katello/version.rb +1 -1
  260. data/package.json +10 -22
  261. data/webpack/{move_to_foreman/__mocks__ → __mocks__/foremanJS}/foreman_toast_notifications.js +0 -0
  262. data/webpack/__mocks__/foremanReact/common/helpers.js +3 -6
  263. data/webpack/__mocks__/foremanReact/common/keyCodes.js +8 -0
  264. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +7 -0
  265. data/webpack/__mocks__/foremanReact/components/Settings/SettingsActions.js +4 -0
  266. data/webpack/__mocks__/foremanReact/components/Settings/SettingsConstants.js +2 -0
  267. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +3 -0
  268. data/webpack/__mocks__/foremanReact/components/common/ModalProgressBar.js +8 -0
  269. data/webpack/components/SelectOrg/SetOrganization.js +11 -19
  270. data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +1 -3
  271. data/webpack/components/WithOrganization/withOrganization.js +2 -2
  272. data/webpack/components/WithOrganization/withOrganization.test.js +2 -2
  273. data/webpack/components/extensions/about/SystemStatuses.js +55 -0
  274. data/webpack/components/extensions/about/SystemStatusesActions.js +16 -0
  275. data/webpack/components/extensions/about/SystemStatusesConsts.js +3 -0
  276. data/webpack/components/extensions/about/SystemStatusesReducer.js +26 -0
  277. data/webpack/components/extensions/about/SystemStatusesSelectors.js +3 -0
  278. data/webpack/components/extensions/about/__tests__/SystemStatuses.fixtures.js +20 -0
  279. data/webpack/components/extensions/about/__tests__/SystemStatuses.test.js +14 -0
  280. data/webpack/components/extensions/about/__tests__/SystemStatusesReducer.test.js +32 -0
  281. data/webpack/components/extensions/about/__tests__/__snapshots__/SystemStatuses.test.js.snap +156 -0
  282. data/webpack/components/extensions/about/__tests__/__snapshots__/SystemStatusesReducer.test.js.snap +47 -0
  283. data/webpack/components/extensions/about/index.js +19 -0
  284. data/webpack/components/extensions/reducers.js +6 -0
  285. data/webpack/containers/Application/config.js +4 -10
  286. data/webpack/fills_index.js +10 -0
  287. data/webpack/move_to_foreman/common/helpers.js +0 -20
  288. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.js +1 -0
  289. data/webpack/move_to_foreman/components/common/table/formatters/EntitlementsInlineEditFormatter.js +3 -3
  290. data/webpack/move_to_pf/LoadingState/LoadingState.js +1 -0
  291. data/webpack/move_to_pf/OptionTooltip/OptionTooltip.scss +2 -1
  292. data/webpack/move_to_pf/TypeAhead/TypeAhead.js +3 -4
  293. data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -1
  294. data/webpack/redux/reducers/index.js +2 -0
  295. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetailInfo.js +1 -0
  296. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetails.js +1 -0
  297. data/webpack/scenes/ModuleStreams/Details/Profiles/TableSchema.js +1 -0
  298. data/webpack/scenes/ModuleStreams/Details/Profiles/__tests__/ProfileRpmsCellFormatter.test.js +0 -2
  299. data/webpack/scenes/ModuleStreams/Details/Repositories/TableSchema.js +3 -2
  300. data/webpack/scenes/ModuleStreams/Details/index.js +1 -1
  301. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +2 -0
  302. data/webpack/scenes/ModuleStreams/ModuleStreamsTable.js +2 -0
  303. data/webpack/scenes/ModuleStreams/ModuleStreamsTableSchema.js +3 -2
  304. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamPage.test.js +0 -1
  305. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +0 -1
  306. data/webpack/scenes/ModuleStreams/index.js +1 -1
  307. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -3
  308. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepositoryContent.js +1 -0
  309. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.js +1 -0
  310. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.scss +1 -1
  311. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +1 -0
  312. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +3 -4
  313. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/__test__/RepositorySetRepository.test.js +0 -2
  314. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -0
  315. data/webpack/scenes/RedHatRepositories/helpers.js +1 -1
  316. data/webpack/scenes/RedHatRepositories/index.js +3 -2
  317. data/webpack/scenes/RedHatRepositories/index.scss +1 -1
  318. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +3 -3
  319. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js +1 -0
  320. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +1 -0
  321. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +1 -2
  322. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +0 -1
  323. data/webpack/scenes/Subscriptions/Details/index.js +1 -1
  324. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -0
  325. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +1 -2
  326. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +1 -1
  327. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +3 -2
  328. data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +1 -2
  329. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +9 -9
  330. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +2 -2
  331. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +0 -1
  332. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/index.js +1 -1
  333. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +1 -2
  334. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +2 -1
  335. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -1
  336. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionTypeFormatter.js +3 -2
  337. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +1 -0
  338. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +3 -2
  339. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +1 -1
  340. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/DeleteDialog.js +1 -1
  341. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/InputsErrorsDialog.js +1 -0
  342. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UnsavedChangesDialog.js +1 -0
  343. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js +1 -1
  344. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +1 -0
  345. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -0
  346. data/webpack/scenes/Subscriptions/index.js +1 -1
  347. data/webpack/scenes/Tasks/helpers.js +5 -6
  348. metadata +161 -20
  349. data/app/lib/actions/katello/repository/clear.rb +0 -11
  350. data/app/views/overrides/about/_system_status.html.erb +0 -19
  351. data/webpack/move_to_foreman/Settings/SettingsActions.js +0 -28
  352. data/webpack/move_to_foreman/Settings/SettingsConstants.js +0 -3
  353. data/webpack/move_to_foreman/Settings/__tests__/SettingsActions.test.js +0 -41
  354. data/webpack/move_to_foreman/Settings/__tests__/settings.fixtures.js +0 -34
  355. data/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js +0 -48
  356. data/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.scss +0 -15
  357. data/webpack/move_to_foreman/components/common/ModalProgressBar/__tests__/ModalProgressBar.test.js +0 -22
  358. data/webpack/move_to_foreman/components/common/ModalProgressBar/__tests__/__snapshots__/ModalProgressBar.test.js.snap +0 -60
  359. data/webpack/move_to_foreman/components/common/ModalProgressBar/index.js +0 -4
  360. data/webpack/move_to_foreman/foreman_toast_notifications.js +0 -22
@@ -4,7 +4,7 @@ module Katello
4
4
  include LazyAccessor
5
5
 
6
6
  PULP_SELECT_FIELDS = %w(name epoch version release arch checksumtype checksum).freeze
7
- PULP_INDEXED_FIELDS = %w(name version release arch epoch summary checksum filename _id).freeze
7
+ PULP_INDEXED_FIELDS = %w(name version release arch epoch summary checksum filename).freeze
8
8
  CONTENT_TYPE = "srpm".freeze
9
9
 
10
10
  lazy_accessor :pulp_facts, :initializer => :backend_data
@@ -0,0 +1,31 @@
1
+ module Katello
2
+ module Pulp3
3
+ class AnsibleCollection < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpAnsibleClient::ContentCollectionsApi.new(Katello::Pulp3::Repository::AnsibleCollection.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::AnsibleCollection.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+
16
+ def self.pulp_data(_href)
17
+ #No content read method
18
+ fail NotImplementedError
19
+ end
20
+
21
+ def update_model(model)
22
+ custom_json = {}
23
+ custom_json['checksum'] = backend_data['sha256']
24
+ custom_json['namespace'] = backend_data['namespace']
25
+ custom_json['version'] = backend_data['version']
26
+ custom_json['name'] = backend_data['name']
27
+ model.update_attributes!(custom_json)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ module Katello
2
+ module Pulp3
3
+ class DockerBlob < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpDockerClient::ContentBlobsApi.new(Katello::Pulp3::Repository::Docker.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::Docker.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ module Katello
2
+ module Pulp3
3
+ class DockerManifest < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpDockerClient::ContentManifestsApi.new(Katello::Pulp3::Repository::Docker.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::Docker.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+
16
+ def self.content_unit_list(page_opts)
17
+ page_opts[:media_type] = "application/vnd.docker.distribution.manifest.v1+json"
18
+ data_v1 = self.content_api.list(page_opts)
19
+ page_opts[:media_type] = "application/vnd.docker.distribution.manifest.v2+json"
20
+ data_v2 = self.content_api.list(page_opts)
21
+
22
+ filtered = {}
23
+ filtered["count"] = data_v1.count + data_v2.count
24
+ filtered["results"] = data_v1.results + data_v2.results
25
+ filtered
26
+ end
27
+
28
+ def update_model(model)
29
+ custom_json = {}
30
+ custom_json['schema_version'], = backend_data['schema_version']
31
+ custom_json['digest'], = backend_data['digest']
32
+ model.update_attributes!(custom_json)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ module Katello
2
+ module Pulp3
3
+ class DockerManifestList < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpDockerClient::ContentManifestsApi.new(Katello::Pulp3::Repository::Docker.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::Docker.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+
16
+ def self.content_unit_list(page_opts)
17
+ page_opts[:media_type] = "application/vnd.docker.distribution.manifest.list.v2+json"
18
+ self.content_api.list(page_opts)
19
+ end
20
+
21
+ def update_model(model)
22
+ custom_json = {}
23
+ custom_json['schema_version'], = backend_data['schema_version']
24
+ custom_json['digest'], = backend_data['digest']
25
+ custom_json['docker_manifests'] = ::Katello::DockerManifest.where(:pulp_id => backend_data[:listed_manifests])
26
+ model.update_attributes!(custom_json)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ module Katello
2
+ module Pulp3
3
+ class DockerTag < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpDockerClient::ContentManifestTagsApi.new(Katello::Pulp3::Repository::Docker.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::Docker.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+
16
+ def update_model(model)
17
+ custom_json = {}
18
+ taggable = ::Katello::DockerManifest.find_by(:pulp_id => backend_data['tagged_manifest'])
19
+ if taggable.nil?
20
+ taggable = ::Katello::DockerManifestList.find_by(:pulp_id => backend_data['tagged_manifest'])
21
+ end
22
+ custom_json['docker_taggable'] = taggable
23
+ custom_json['name'] = backend_data['name']
24
+ model.update_attributes!(custom_json)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ module Katello
2
+ module Pulp3
3
+ class FileUnit < PulpContentUnit
4
+ include LazyAccessor
5
+
6
+ def self.content_api
7
+ PulpFileClient::ContentFilesApi.new(Katello::Pulp3::Repository::File.api_client(SmartProxy.pulp_master!))
8
+ end
9
+
10
+ def self.ids_for_repository(repo_id)
11
+ repo = Katello::Pulp3::Repository::File.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
12
+ repo_content_list = repo.content_list
13
+ repo_content_list.map { |content| content.try(:_href) }
14
+ end
15
+
16
+ def update_model(model)
17
+ custom_json = {}
18
+ custom_json['checksum'] = backend_data['sha256']
19
+ custom_json['path'] = backend_data['relative_path']
20
+ custom_json['name'] = File.basename(backend_data['relative_path'].try(:split, '/').try(:[], -1))
21
+ model.update_attributes!(custom_json)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,75 @@
1
+ require 'set'
2
+ require 'pulp_file_client'
3
+
4
+ module Katello
5
+ module Pulp3
6
+ class PulpContentUnit
7
+ # Any class that extends this class should define:
8
+ # Class#update_model
9
+
10
+ def self.content_api
11
+ fail NotImplementedError
12
+ end
13
+
14
+ def update_model
15
+ fail NotImplementedError
16
+ end
17
+
18
+ attr_accessor :uuid
19
+ attr_writer :backend_data
20
+
21
+ def initialize(uuid)
22
+ self.uuid = uuid
23
+ end
24
+
25
+ def self.model_class
26
+ Katello::RepositoryTypeManager.model_class(self)
27
+ end
28
+
29
+ def self.unit_identifier
30
+ "_href"
31
+ end
32
+
33
+ def self.pulp_units_batch_for_repo(repository, options = {})
34
+ fetch_identifiers = options.fetch(:fetch_identifiers, false)
35
+ page_size = options.fetch(:page_size, SETTINGS[:katello][:pulp][:bulk_load_size])
36
+ repository_version_href = repository.version_href
37
+ page_opts = { "page" => 1, repository_version: repository_version_href, page_size: page_size}
38
+ page_opts[:fields] = '_href' if fetch_identifiers
39
+ response = {}
40
+ Enumerator.new do |yielder|
41
+ loop do
42
+ page_opts = page_opts.with_indifferent_access
43
+ break unless (response["next"] || page_opts["page"] == 1)
44
+ response = fetch_content_list page_opts
45
+ response = response.as_json.with_indifferent_access
46
+ yielder.yield response[:results]
47
+ page_opts[:page] += 1
48
+ end
49
+ end
50
+ end
51
+
52
+ def self.pulp_data(href)
53
+ content_unit = self.class.content_api.read(href)
54
+ content_unit.as_json
55
+ end
56
+
57
+ def self.content_unit_list(page_opts)
58
+ self.content_api.list page_opts
59
+ end
60
+
61
+ def backend_data
62
+ @backend_data ||= fetch_backend_data
63
+ @backend_data.try(:with_indifferent_access)
64
+ end
65
+
66
+ def fetch_backend_data
67
+ self.class.pulp_data(self.uuid)
68
+ end
69
+
70
+ def self.fetch_content_list(page_opts)
71
+ content_unit_list page_opts
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,44 +1,116 @@
1
+ require "pulpcore_client"
2
+
1
3
  module Katello
2
4
  module Pulp3
3
5
  class Repository
6
+ include Katello::Util::HttpProxy
7
+
4
8
  attr_accessor :repo, :input
5
9
  attr_accessor :smart_proxy
6
10
  delegate :root, to: :repo
7
11
  delegate :pulp3_api, to: :smart_proxy
8
12
 
13
+ COPY_UNIT_PAGE_SIZE = 10_000
14
+
9
15
  def initialize(repo, smart_proxy)
10
16
  @repo = repo
11
17
  @smart_proxy = smart_proxy
12
18
  end
13
19
 
14
- def create_remote
20
+ def api_exception_class
15
21
  fail NotImplementedError
16
22
  end
17
23
 
18
- def remote_options
24
+ def remote_class
19
25
  fail NotImplementedError
20
26
  end
21
27
 
22
- def update_remote
28
+ def publications_api
23
29
  fail NotImplementedError
24
30
  end
25
31
 
26
- def sync
32
+ def publication_class
27
33
  fail NotImplementedError
28
34
  end
29
35
 
30
- def create_publisher
36
+ def distribution_class
31
37
  fail NotImplementedError
32
38
  end
33
39
 
34
- def create_publication
40
+ def distributions_api_class
41
+ fail NotImplementedError
42
+ end
43
+
44
+ def distribution_options
45
+ fail NotImplementedError
46
+ end
47
+
48
+ def remote_options
35
49
  fail NotImplementedError
36
50
  end
37
51
 
52
+ def self.api_client(_smart_proxy)
53
+ fail NotImplementedError
54
+ end
55
+
56
+ def api_client
57
+ self.class.api_client(smart_proxy)
58
+ end
59
+
60
+ def create_remote
61
+ remote_file_data = remote_class.new(remote_options)
62
+ response = remotes_api.create(remote_file_data)
63
+ repo.update_attributes!(:remote_href => response._href)
64
+ end
65
+
66
+ def update_remote
67
+ if remote_options[:url].blank?
68
+ if repo.remote_href
69
+ href = repo.remote_href
70
+ repo.update_attributes(remote_href: nil)
71
+ delete_remote href
72
+ end
73
+ else
74
+ if repo.remote_href?
75
+ remote_partial_update
76
+ else
77
+ create_remote
78
+ end
79
+ end
80
+ end
81
+
82
+ def remote_partial_update
83
+ remotes_api.partial_update(repo.remote_href, remote_options)
84
+ end
85
+
86
+ def delete_remote(href = repo.remote_href)
87
+ remotes_api.delete(href) if href
88
+ end
89
+
90
+ def list_remotes(args)
91
+ remotes_api.list(args).results
92
+ end
93
+
94
+ def core_api_client
95
+ PulpcoreClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpcoreClient::Configuration))
96
+ end
97
+
98
+ def repositories_api
99
+ PulpcoreClient::RepositoriesApi.new(core_api_client)
100
+ end
101
+
102
+ def repository_versions_api
103
+ PulpcoreClient::RepositoriesVersionsApi.new(core_api_client)
104
+ end
105
+
38
106
  def self.instance_for_type(repo, smart_proxy)
39
107
  Katello::RepositoryTypeManager.repository_types[repo.root.content_type].pulp3_service_class.new(repo, smart_proxy)
40
108
  end
41
109
 
110
+ def should_purge_empty_contents?
111
+ false
112
+ end
113
+
42
114
  def backend_object_name
43
115
  "#{root.label}-#{repo.id}#{rand(9999)}"
44
116
  end
@@ -53,71 +125,96 @@ module Katello
53
125
 
54
126
  def create
55
127
  unless repository_reference
56
- response = pulp3_api.repositories_create(Zest::Repository.new(:name => backend_object_name))
57
- RepositoryReference.create!(:root_repository_id => repo.root_id, :content_view_id => repo.content_view.id, :repository_href => response._href)
128
+ response = repositories_api.create(
129
+ name: backend_object_name)
130
+ RepositoryReference.create!(
131
+ root_repository_id: repo.root_id,
132
+ content_view_id: repo.content_view.id,
133
+ repository_href: response._href)
58
134
  response
59
135
  end
60
136
  end
61
137
 
138
+ def update
139
+ repositories_api.update(repository_reference.repository_href, name: backend_object_name)
140
+ end
141
+
62
142
  def list(args)
63
- pulp3_api.repositories_list(args).results
143
+ repositories_api.list(args).results
64
144
  end
65
145
 
66
- def delete(href = repository_reference.repository_href)
67
- response = pulp3_api.repositories_delete(href)
68
- repository_reference.destroy if repository_reference
69
- response
146
+ def delete(href = repository_reference.try(:repository_href))
147
+ repository_reference.try(:destroy)
148
+ if href
149
+ response = repositories_api.delete(href)
150
+ response
151
+ end
70
152
  end
71
153
 
72
- def update_distribution(path)
73
- distribution_reference = distribution_reference(path)
74
- pulp3_api.distributions_partial_update(distribution_reference.href, publication: repo.publication_href)
154
+ def sync
155
+ [remotes_api.sync(repo.remote_href, repository: repository_reference.repository_href)]
156
+ end
157
+
158
+ def create_publication
159
+ publication_data = publication_class.new(repository_version: repo.version_href)
160
+ publications_api.create(publication_data)
75
161
  end
76
162
 
77
163
  def refresh_distributions
78
- paths.map do |prefix, path|
79
- if distribution_reference(path)
80
- update_distribution(path)
81
- else
82
- create_distribution(prefix, path)
83
- end
164
+ path = repo.relative_path.sub(/^\//, '')
165
+ dist_ref = distribution_reference(path)
166
+ if dist_ref
167
+ update_distribution(path)
168
+ else
169
+ create_distribution(path)
84
170
  end
85
171
  end
86
172
 
87
- def create_version
88
- pulp3_api.repositories_versions_create(repository_reference.repository_href, {})
173
+ def create_distribution(path)
174
+ distribution_data = distribution_class.new(distribution_options(path))
175
+ distributions_api.create(distribution_data)
89
176
  end
90
177
 
91
- def paths
92
- list = {
93
- https: "https/#{repo.relative_path}"
94
- }
95
- list['http'] = "http/#{repo.relative_path}" if repo.root.unprotected
96
- list
178
+ def delete_distribution(href)
179
+ distributions_api.delete(href)
180
+ rescue api_exception_class => e
181
+ raise e if e.code != 404
182
+ nil
97
183
  end
98
184
 
99
- private def delete_distribution(href)
100
- pulp3_api.distributions_delete(href)
185
+ def lookup_distributions(args)
186
+ distributions_api.list(args).results
101
187
  end
102
188
 
103
- def lookup_distributions(args)
104
- pulp3_api.distributions_list(args).results
189
+ def update_distribution(path)
190
+ distribution_reference = distribution_reference(path)
191
+ if distribution_reference
192
+ options = distribution_options(path).except(:name, :base_path)
193
+ distributions_api.partial_update(distribution_reference.href, options)
194
+ end
105
195
  end
106
196
 
107
197
  def get_distribution(href)
108
- pulp3_api.distributions_read(href)
109
- rescue Zest::ApiError => e
198
+ distributions_api.read(href)
199
+ rescue api_exception_class => e
110
200
  raise e if e.code != 404
111
201
  nil
112
202
  end
113
203
 
114
- def delete_distributions
115
- paths.values.each do |path|
116
- dists = lookup_distributions(base_path: path.sub(/^\//, ''))
117
- delete_distribution(dists.first._href) if dists.first
118
- distribution_reference = distribution_reference(path)
119
- distribution_reference.destroy if distribution_reference
204
+ def create_version(options = {})
205
+ repository_versions_api.create(repository_reference.repository_href, options)
206
+ end
207
+
208
+ def copy_units_by_href(unit_hrefs)
209
+ tasks = []
210
+ unit_hrefs.each_slice(COPY_UNIT_PAGE_SIZE) do |slice|
211
+ tasks << create_version(:add_content_units => slice)
120
212
  end
213
+ tasks
214
+ end
215
+
216
+ def copy_version(from_repository)
217
+ create_version(:base_version => from_repository.version_href)
121
218
  end
122
219
 
123
220
  def save_distribution_references(hrefs)
@@ -129,17 +226,20 @@ module Katello
129
226
  end
130
227
  end
131
228
 
132
- def create_distribution(prefix, path)
133
- path = path.sub(/^\//, '') #remove leading / if present
134
- pulp3_api.distributions_create(base_path: path, publication: repo.publication_href, name: "#{prefix}_#{backend_object_name}")
229
+ def delete_distributions
230
+ path = repo.relative_path.sub(/^\//, '')
231
+ dists = lookup_distributions(base_path: path)
232
+ delete_distribution(dists.first._href) if dists.first
233
+ dist_ref = distribution_reference(path)
234
+ dist_ref.destroy! if dist_ref
135
235
  end
136
236
 
137
237
  def common_remote_options
138
238
  remote_options = {
139
- validate: true,
140
239
  ssl_validation: root.verify_ssl_on_sync,
141
240
  name: backend_object_name,
142
- url: root.url
241
+ url: root.url,
242
+ proxy_url: root.http_proxy&.full_url
143
243
  }
144
244
  if root.upstream_username && root.upstream_password
145
245
  remote_options.merge(username: root.upstream_username,
@@ -165,6 +265,19 @@ module Katello
165
265
  {}
166
266
  end
167
267
  end
268
+
269
+ def lookup_version(href)
270
+ repository_versions_api.read(href)
271
+ rescue PulpcoreClient::ApiError => e
272
+ Rails.logger.error "Exception when calling RepositoriesApi->repositories_versions_read: #{e}"
273
+ nil
274
+ end
275
+
276
+ def remove_content(content_units)
277
+ data = PulpcoreClient::RepositoryVersionCreate.new(
278
+ remove_content_units: content_units.map(&:pulp_id))
279
+ repository_versions_api.create(repository_reference.repository_href, data)
280
+ end
168
281
  end
169
282
  end
170
283
  end