katello 4.7.4 → 4.8.0.rc1

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

Potentially problematic release.


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

Files changed (334) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +6 -4
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -12
  4. data/app/controllers/katello/api/v2/capsule_content_controller.rb +0 -4
  5. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +22 -81
  6. data/app/controllers/katello/api/v2/content_exports_controller.rb +11 -80
  7. data/app/controllers/katello/api/v2/content_imports_controller.rb +1 -0
  8. data/app/controllers/katello/api/v2/exports_controller.rb +130 -0
  9. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +7 -8
  10. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +8 -4
  11. data/app/controllers/katello/api/v2/organizations_controller.rb +3 -0
  12. data/app/controllers/katello/api/v2/package_groups_controller.rb +0 -52
  13. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -6
  14. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -2
  15. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +4 -1
  16. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +24 -0
  17. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +3 -3
  18. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +55 -24
  19. data/app/helpers/katello/katello_urls_helper.rb +0 -15
  20. data/app/helpers/katello/sync_management_helper.rb +0 -4
  21. data/app/lib/actions/candlepin/owner/destroy_imports.rb +1 -1
  22. data/app/lib/actions/katello/capsule_content/sync.rb +0 -4
  23. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +1 -2
  24. data/app/lib/actions/katello/content_view/publish.rb +6 -2
  25. data/app/lib/actions/katello/content_view/remove.rb +8 -2
  26. data/app/lib/actions/katello/content_view_version/destroy.rb +1 -1
  27. data/app/lib/actions/katello/environment/destroy.rb +8 -2
  28. data/app/lib/actions/katello/host/reassign.rb +4 -2
  29. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +0 -1
  30. data/app/lib/actions/katello/product/destroy.rb +2 -1
  31. data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -10
  32. data/app/lib/actions/katello/repository/import_upload.rb +0 -1
  33. data/app/lib/actions/katello/repository/sync.rb +0 -1
  34. data/app/lib/actions/katello/repository/update.rb +5 -3
  35. data/app/lib/actions/katello/repository/upload_files.rb +0 -1
  36. data/app/lib/actions/pulp3/abstract.rb +0 -6
  37. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -2
  38. data/app/lib/actions/pulp3/content_view_version/create_syncable_export_history.rb +4 -0
  39. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +1 -0
  40. data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +7 -2
  41. data/app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb +7 -2
  42. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -2
  43. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +2 -2
  44. data/app/lib/katello/concerns/renderer_extensions.rb +1 -1
  45. data/app/lib/katello/event_daemon/runner.rb +12 -9
  46. data/app/lib/katello/resources/candlepin/consumer.rb +6 -6
  47. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  48. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +3 -4
  49. data/app/lib/katello/resources/candlepin.rb +4 -4
  50. data/app/lib/katello/util/errata.rb +12 -10
  51. data/app/lib/katello/util/search.rb +0 -1
  52. data/app/lib/katello/validators/content_view_environment_org_validator.rb +5 -2
  53. data/app/lib/katello/validators/content_view_environment_validator.rb +1 -2
  54. data/app/lib/katello/validators/generated_content_view_validator.rb +16 -0
  55. data/app/mailers/katello/errata_mailer.rb +4 -2
  56. data/app/models/katello/alternate_content_source.rb +5 -1
  57. data/app/models/katello/concerns/content_facet_host_extensions.rb +25 -14
  58. data/app/models/katello/concerns/host_managed_extensions.rb +17 -8
  59. data/app/models/katello/concerns/redhat_extensions.rb +16 -6
  60. data/app/models/katello/concerns/smart_proxy_extensions.rb +0 -12
  61. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -0
  62. data/app/models/katello/content_view.rb +22 -5
  63. data/app/models/katello/content_view_environment.rb +11 -2
  64. data/app/models/katello/content_view_environment_content_facet.rb +9 -0
  65. data/app/models/katello/content_view_version.rb +10 -5
  66. data/app/models/katello/erratum.rb +6 -1
  67. data/app/models/katello/glue/candlepin/pool.rb +6 -0
  68. data/app/models/katello/glue/candlepin/product.rb +7 -1
  69. data/app/models/katello/glue/candlepin/subscription.rb +5 -0
  70. data/app/models/katello/glue/provider.rb +26 -26
  71. data/app/models/katello/host/content_facet.rb +106 -18
  72. data/app/models/katello/host/info_provider.rb +25 -21
  73. data/app/models/katello/host/subscription_facet.rb +18 -14
  74. data/app/models/katello/kt_environment.rb +12 -7
  75. data/app/models/katello/package_group.rb +0 -12
  76. data/app/models/katello/pool.rb +4 -1
  77. data/app/models/katello/product.rb +11 -1
  78. data/app/models/katello/repository.rb +11 -11
  79. data/app/models/katello/root_repository.rb +5 -4
  80. data/app/models/katello/task_status.rb +0 -18
  81. data/app/services/katello/candlepin/consumer.rb +2 -2
  82. data/app/services/katello/host/package_profile_uploader.rb +1 -1
  83. data/app/services/katello/product_content_finder.rb +11 -8
  84. data/app/services/katello/pulp3/content_view_version/export.rb +8 -65
  85. data/app/services/katello/pulp3/content_view_version/export_validation_error.rb +7 -0
  86. data/app/services/katello/pulp3/content_view_version/export_validator.rb +105 -0
  87. data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -1
  88. data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +7 -1
  89. data/app/services/katello/pulp3/erratum.rb +1 -0
  90. data/app/services/katello/pulp3/module_stream.rb +26 -11
  91. data/app/services/katello/pulp3/repository/yum.rb +2 -1
  92. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +2 -1
  93. data/app/services/katello/registration_manager.rb +46 -26
  94. data/app/services/katello/repository_type.rb +3 -9
  95. data/app/services/katello/simple_package.rb +22 -0
  96. data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -0
  97. data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +1 -0
  98. data/app/views/katello/api/v2/content_facet/base.json.rabl +23 -2
  99. data/app/views/katello/api/v2/content_facet/show.json.rabl +11 -8
  100. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  101. data/app/views/katello/api/v2/hosts/base.json.rabl +22 -2
  102. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +2 -2
  103. data/config/initializers/monkeys.rb +0 -2
  104. data/config/routes/api/registry.rb +8 -7
  105. data/config/routes/api/v2.rb +0 -2
  106. data/config/routes.rb +3 -0
  107. data/db/migrate/20200429153103_installed_package_bad_nvrea.rb +1 -1
  108. data/db/migrate/20220228173251_remove_drpm_from_ignorable_content.rb +7 -3
  109. data/db/migrate/20220419193414_content_settings_to_dsl_category.rb +1 -1
  110. data/db/migrate/20220929204746_add_content_view_environment_content_facet.rb +52 -0
  111. data/db/migrate/20221123212341_remove_pulp_docker_registry_port_setting.rb +5 -0
  112. data/db/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb +1 -1
  113. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  114. data/engines/bastion/app/assets/stylesheets/bastion/bastion.scss +4 -0
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -4
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +0 -1
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -4
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -1
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +11 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +1 -1
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +8 -4
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +5485 -0
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +5397 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +5658 -0
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +5284 -0
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ka.po +5231 -0
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +5275 -0
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +5389 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +5212 -0
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +5145 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +2 -2
  133. data/lib/katello/engine.rb +2 -1
  134. data/lib/katello/permission_creator.rb +2 -4
  135. data/lib/katello/permissions/registry_permissions.rb +5 -5
  136. data/lib/katello/plugin.rb +22 -14
  137. data/lib/katello/repository_types/README.md +136 -19
  138. data/lib/katello/repository_types/deb.rb +0 -1
  139. data/lib/katello/repository_types/docker.rb +0 -1
  140. data/lib/katello/repository_types/file.rb +0 -1
  141. data/lib/katello/repository_types/yum.rb +0 -4
  142. data/lib/katello/tasks/clean_candlepin_orphaned_products.rake +38 -0
  143. data/lib/katello/tasks/clean_orphaned_facets.rb +20 -0
  144. data/lib/katello/tasks/reimport.rake +1 -2
  145. data/lib/katello/tasks/repository.rake +1 -22
  146. data/lib/katello/tasks/reset.rake +1 -0
  147. data/lib/katello/tasks/upgrades/4.8/fix_incorrect_providers.rake +29 -0
  148. data/lib/katello/version.rb +1 -1
  149. data/lib/katello.rb +0 -5
  150. data/locale/bn/katello.po +69 -27
  151. data/locale/cs/katello.po +69 -27
  152. data/locale/de/katello.po +78 -36
  153. data/locale/en/katello.po +69 -27
  154. data/locale/es/katello.po +70 -28
  155. data/locale/fr/katello.po +73 -31
  156. data/locale/gu/katello.po +69 -27
  157. data/locale/hi/katello.po +69 -27
  158. data/locale/it/katello.po +69 -27
  159. data/locale/ja/katello.po +73 -31
  160. data/locale/ka/katello.po +73 -31
  161. data/locale/katello.pot +335 -262
  162. data/locale/kn/katello.po +69 -27
  163. data/locale/ko/katello.po +69 -27
  164. data/locale/mr/katello.po +69 -27
  165. data/locale/or/katello.po +69 -27
  166. data/locale/pa/katello.po +69 -27
  167. data/locale/pt/katello.po +69 -27
  168. data/locale/pt_BR/katello.po +70 -28
  169. data/locale/ru/katello.po +70 -28
  170. data/locale/ta/katello.po +69 -27
  171. data/locale/te/katello.po +69 -27
  172. data/locale/zh_CN/katello.po +73 -31
  173. data/locale/zh_TW/katello.po +70 -28
  174. data/webpack/components/Content/ContentPage.js +51 -35
  175. data/webpack/components/Content/__tests__/ContentPage.test.js +2 -4
  176. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +22 -3
  177. data/webpack/components/Table/EmptyStateMessage.js +14 -11
  178. data/webpack/components/Table/MainTable.js +36 -15
  179. data/webpack/components/Table/TableWrapper.js +25 -25
  180. data/webpack/components/Table/__test__/emptyStateMessage.test.js +51 -0
  181. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +5 -4
  182. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +1 -1
  183. data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/__tests__/hostCollectionsModal.test.js +1 -17
  184. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +18 -9
  185. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -2
  186. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackageInstallModal.js +1 -2
  187. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +1 -2
  188. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +47 -27
  189. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +1 -2
  190. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -21
  191. data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +1 -28
  192. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +1 -10
  193. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +1 -18
  194. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +1 -17
  195. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -15
  196. data/webpack/global_test_setup.js +1 -1
  197. data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +12 -10
  198. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCredentials.js +6 -0
  199. data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +1 -0
  200. data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +3 -10
  201. data/webpack/scenes/AlternateContentSources/Create/Steps/NameACS.js +1 -0
  202. data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +3 -3
  203. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +1 -0
  204. data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +12 -4
  205. data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +7 -4
  206. data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +4 -8
  207. data/webpack/scenes/AlternateContentSources/helpers.js +1 -1
  208. data/webpack/scenes/Content/Details/ContentRepositories.js +5 -4
  209. data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +1 -12
  210. data/webpack/scenes/Content/Table/ContentTable.js +2 -1
  211. data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -14
  212. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -25
  213. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  214. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +44 -31
  215. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -0
  216. data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +6 -1
  217. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +2 -1
  218. data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +2 -1
  219. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +3 -1
  220. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -1
  221. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
  222. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +2 -1
  223. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +2 -0
  224. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +2 -1
  225. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +1 -1
  226. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVRpmMatchContentModal.js +1 -1
  227. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +35 -33
  228. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +48 -45
  229. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +58 -24
  230. data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +64 -0
  231. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +36 -20
  232. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +40 -23
  233. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +0 -13
  234. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +0 -13
  235. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +2 -1
  236. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -10
  237. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -1
  238. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -10
  239. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +21 -9
  240. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +4 -0
  241. data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +1 -32
  242. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +3 -1
  243. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -15
  244. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedActivationKeys.js +1 -1
  245. data/webpack/scenes/ContentViews/Details/Versions/Delete/affectedHosts.js +1 -2
  246. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -9
  247. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsTable.js +4 -0
  248. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +30 -14
  249. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
  250. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +55 -120
  251. data/webpack/scenes/ContentViews/components/WizardHeader.js +1 -1
  252. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +1 -1
  253. data/webpack/scenes/ContentViews/expansions/__tests__/contentViewComponentsModal.test.js +8 -1
  254. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +3 -9
  255. data/webpack/scenes/ModuleStreams/__tests__/__snapshots__/ModuleStreamPage.test.js.snap +7 -1
  256. data/webpack/scenes/RedHatRepositories/components/Search.js +22 -16
  257. data/webpack/scenes/RedHatRepositories/index.scss +20 -1
  258. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +12 -1
  259. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CdnTypeForm.js +1 -1
  260. data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/CustomCdnTypeForm.js +1 -1
  261. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +21 -19
  262. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +34 -1
  263. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +20 -7
  264. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +0 -1
  265. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +65 -15
  266. metadata +50 -116
  267. data/app/lib/actions/katello/pulp_selector.rb +0 -24
  268. data/app/lib/actions/katello/repository/correct_checksum.rb +0 -24
  269. data/app/lib/actions/katello/repository/destroy_package_group.rb +0 -26
  270. data/app/lib/actions/katello/repository/upload_package_group.rb +0 -24
  271. data/app/lib/actions/pulp/abstract.rb +0 -37
  272. data/app/lib/actions/pulp/abstract_async_task.rb +0 -154
  273. data/app/lib/actions/pulp/abstract_async_task_group.rb +0 -94
  274. data/app/lib/actions/pulp/consumer/sync_capsule.rb +0 -45
  275. data/app/lib/actions/pulp/consumer/unassociate_units.rb +0 -20
  276. data/app/lib/actions/pulp/expect_one_task.rb +0 -11
  277. data/app/lib/actions/pulp/orchestration/orphan_cleanup/remove_orphans.rb +0 -16
  278. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +0 -19
  279. data/app/lib/actions/pulp/orchestration/repository/delete.rb +0 -15
  280. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +0 -14
  281. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +0 -13
  282. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -19
  283. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +0 -14
  284. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +0 -34
  285. data/app/lib/actions/pulp/orchestration/repository/sync.rb +0 -18
  286. data/app/lib/actions/pulp/orchestration/repository/upload_content.rb +0 -37
  287. data/app/lib/actions/pulp/orphan_cleanup/remove_orphans.rb +0 -15
  288. data/app/lib/actions/pulp/orphan_cleanup/remove_unneeded_repos.rb +0 -16
  289. data/app/lib/actions/pulp/repository/abstract_copy_content.rb +0 -45
  290. data/app/lib/actions/pulp/repository/abstract_remove_content.rb +0 -32
  291. data/app/lib/actions/pulp/repository/clear.rb +0 -18
  292. data/app/lib/actions/pulp/repository/copy_all_units.rb +0 -30
  293. data/app/lib/actions/pulp/repository/copy_units.rb +0 -25
  294. data/app/lib/actions/pulp/repository/create.rb +0 -28
  295. data/app/lib/actions/pulp/repository/create_in_plan.rb +0 -15
  296. data/app/lib/actions/pulp/repository/create_upload_request.rb +0 -20
  297. data/app/lib/actions/pulp/repository/delete_upload_request.rb +0 -19
  298. data/app/lib/actions/pulp/repository/destroy.rb +0 -28
  299. data/app/lib/actions/pulp/repository/distributor_publish.rb +0 -25
  300. data/app/lib/actions/pulp/repository/download.rb +0 -16
  301. data/app/lib/actions/pulp/repository/import_upload.rb +0 -19
  302. data/app/lib/actions/pulp/repository/presenters/abstract_sync_presenter.rb +0 -47
  303. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +0 -95
  304. data/app/lib/actions/pulp/repository/presenters/docker_presenter.rb +0 -103
  305. data/app/lib/actions/pulp/repository/presenters/file_unit_presenter.rb +0 -42
  306. data/app/lib/actions/pulp/repository/presenters/yum_presenter.rb +0 -131
  307. data/app/lib/actions/pulp/repository/refresh.rb +0 -21
  308. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +0 -21
  309. data/app/lib/actions/pulp/repository/remove_distribution.rb +0 -11
  310. data/app/lib/actions/pulp/repository/remove_units.rb +0 -44
  311. data/app/lib/actions/pulp/repository/sync.rb +0 -99
  312. data/app/lib/actions/pulp/repository/upload_file.rb +0 -28
  313. data/app/lib/actions/pulp/repository_group/create.rb +0 -31
  314. data/app/lib/actions/pulp/repository_group/delete.rb +0 -17
  315. data/app/lib/actions/pulp/repository_group/export.rb +0 -51
  316. data/app/lib/katello/util/package_clause_generator.rb +0 -77
  317. data/app/models/katello/glue/pulp/pulp_errors.rb +0 -9
  318. data/app/models/katello/glue/pulp/repo.rb +0 -353
  319. data/app/models/katello/pulp_sync_status.rb +0 -165
  320. data/app/models/katello/pulp_task_status.rb +0 -63
  321. data/app/services/katello/pulp/content.rb +0 -24
  322. data/app/services/katello/pulp/importer_comparison.rb +0 -28
  323. data/app/services/katello/pulp/repository/deb.rb +0 -61
  324. data/app/services/katello/pulp/repository/docker.rb +0 -82
  325. data/app/services/katello/pulp/repository/file.rb +0 -52
  326. data/app/services/katello/pulp/repository/yum.rb +0 -205
  327. data/app/services/katello/pulp/repository.rb +0 -327
  328. data/app/services/katello/pulp/server.rb +0 -35
  329. data/app/services/katello/pulp/simple_package.rb +0 -24
  330. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -52
  331. data/lib/monkeys/fix_deb_optimized_sync.rb +0 -35
  332. data/lib/monkeys/fix_pulp_container_path.rb +0 -35
  333. data/locale/zanata.xml +0 -30
  334. data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentSearch.fixtures.json +0 -33
@@ -1,82 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Repository
4
- class Docker < ::Katello::Pulp::Repository
5
- REPOSITORY_TYPE = 'docker'.freeze
6
-
7
- def unit_type_id(uploads = [])
8
- uploads.pluck('digest').any? ? 'docker_tag' : super
9
- end
10
-
11
- def unit_keys(uploads)
12
- uploads.map do |upload|
13
- upload.except('id')
14
- end
15
- end
16
-
17
- def generate_primary_importer
18
- config = {
19
- feed: root.url,
20
- upstream_name: root.docker_upstream_name,
21
- tags: root.include_tags,
22
- enable_v1: false
23
- }
24
- importer_class.new(config.merge(primary_importer_connection_options))
25
- end
26
-
27
- #what foreman proxies w/ content pull docker content from
28
- def docker_registry_host
29
- if SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::DOCKER_TYPE)
30
- foreman_url = URI.parse(Setting[:foreman_url]).host.downcase
31
- "https://#{foreman_url}"
32
- else
33
- pulp_uri = URI.parse(SmartProxy.pulp_primary.pulp_url)
34
- "https://#{pulp_uri.host.downcase}:#{Setting['pulp_docker_registry_port']}"
35
- end
36
- end
37
-
38
- def generate_mirror_importer
39
- config = {
40
- feed: docker_registry_host,
41
- upstream_name: repo.container_repository_name,
42
- enable_v1: false
43
- }
44
- importer_class.new(config.merge(mirror_importer_connection_options))
45
- end
46
-
47
- def generate_distributors
48
- [Runcible::Models::DockerDistributor.new(:protected => !root.unprotected,
49
- :id => repo.pulp_id,
50
- :auto_publish => true,
51
- :repo_registry_id => repo.container_repository_name)]
52
- end
53
-
54
- def distributors_to_publish(_options)
55
- {Runcible::Models::DockerDistributor => {}}
56
- end
57
-
58
- def external_url(_force_https = false)
59
- pulp_uri = URI.parse(SmartProxy.pulp_primary.pulp_url)
60
- "#{pulp_uri.host.downcase}:#{Setting['pulp_docker_registry_port']}/#{repo.container_repository_name}"
61
- end
62
-
63
- def importer_class
64
- Runcible::Models::DockerImporter
65
- end
66
-
67
- def copy_contents(destination_repo, options = {})
68
- if options[:filters]
69
- clause_gen = ::Katello::Util::DockerManifestClauseGenerator.new(@repo, options[:filters])
70
- clause_gen.generate
71
- criteria = {filters: {:unit => clause_gen.copy_clause } }
72
- end
73
-
74
- @smart_proxy.pulp_api.extensions.docker_tag.copy(
75
- @repo.pulp_id,
76
- destination_repo.pulp_id,
77
- criteria || {})
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,52 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Repository
4
- class File < ::Katello::Pulp::Repository
5
- REPOSITORY_TYPE = 'iso'.freeze
6
-
7
- def unit_keys(uploads)
8
- uploads.map do |upload|
9
- upload.except('id', 'content_unit_id')
10
- end
11
- end
12
-
13
- def generate_primary_importer
14
- config = { feed: root.url }
15
- importer_class.new(config.merge(primary_importer_connection_options))
16
- end
17
-
18
- def generate_mirror_importer
19
- config = {
20
- feed: external_url
21
- }
22
- importer_class.new(config.merge(mirror_importer_connection_options))
23
- end
24
-
25
- def generate_distributors
26
- yum_dist_id = repo.pulp_id
27
- options = {
28
- id: yum_dist_id,
29
- auto_publish: true
30
- }
31
- [Runcible::Models::IsoDistributor.new(repo.relative_path, repo.unprotected, true, options)]
32
- end
33
-
34
- def partial_repo_path
35
- "/pulp/isos/#{repo.relative_path}/"
36
- end
37
-
38
- def importer_class
39
- Runcible::Models::IsoImporter
40
- end
41
-
42
- def distributors_to_publish(_options)
43
- {Runcible::Models::IsoDistributor => {}}
44
- end
45
-
46
- def copy_contents(destination_repo, _options = {})
47
- @smart_proxy.pulp_api.extensions.file.copy(@repo.pulp_id, destination_repo.pulp_id, {})
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,205 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Repository
4
- class Yum < ::Katello::Pulp::Repository
5
- REPOSITORY_TYPE = 'yum'.freeze
6
-
7
- def generate_primary_importer
8
- config = {
9
- download_policy: root.download_policy,
10
- remove_missing: root.mirror_on_sync?,
11
- feed: root.url,
12
- type_skip_list: root.ignorable_content
13
- }
14
- importer_class.new(config.merge(primary_importer_connection_options))
15
- end
16
-
17
- def generate_mirror_importer
18
- config = {
19
- download_policy: smart_proxy_download_policy,
20
- remove_missing: true,
21
- feed: external_url(true)
22
- }
23
- importer_class.new(config.merge(mirror_importer_connection_options))
24
- end
25
-
26
- def partial_repo_path
27
- "/pulp/content/#{repo.relative_path}/".sub('//', '/')
28
- end
29
-
30
- def importer_class
31
- Runcible::Models::YumImporter
32
- end
33
-
34
- def generate_distributors
35
- yum_dist_id = repo.pulp_id
36
- options = {
37
- protected: true,
38
- id: yum_dist_id,
39
- auto_publish: true
40
- }
41
- if smart_proxy.pulp_primary?
42
- options[:checksum_type] = repo.saved_checksum_type || root.checksum_type
43
- else
44
- options[:checksum_type] = nil
45
- end
46
- distributors = [Runcible::Models::YumDistributor.new(repo.relative_path, root.unprotected, true, options)]
47
-
48
- if smart_proxy.pulp_primary?
49
- distributors << Runcible::Models::YumCloneDistributor.new(:id => "#{repo.pulp_id}_clone",
50
- :destination_distributor_id => yum_dist_id)
51
- distributors << Runcible::Models::ExportDistributor.new(false, false, repo.relative_path)
52
- end
53
- distributors
54
- end
55
-
56
- def distributors_to_publish(options)
57
- source_repo_id = options[:source_repository]&.fetch(:id)
58
- if (source_repo_id || !repo.primary?) && smart_proxy.pulp_primary?
59
- source_repository = source_repo_id ? ::Katello::Repository.find(source_repo_id) : repo.target_repository
60
- source_service = source_repository.backend_service(smart_proxy)
61
- source_distributor_id = source_service.lookup_distributor_id(Runcible::Models::YumDistributor.type_id)
62
- {Runcible::Models::YumCloneDistributor => {source_repo_id: source_repository.pulp_id,
63
- source_distributor_id: source_distributor_id}}
64
- else
65
- {Runcible::Models::YumDistributor => {}}
66
- end
67
- end
68
-
69
- def smart_proxy_download_policy
70
- policy = smart_proxy.download_policy || Setting[:default_proxy_download_policy]
71
- if policy == ::SmartProxy::DOWNLOAD_INHERIT
72
- self.root.download_policy
73
- else
74
- policy
75
- end
76
- end
77
-
78
- def regenerate_applicability
79
- smart_proxy.pulp_api.extensions.repository.regenerate_applicability_by_ids([repo.pulp_id], true)
80
- end
81
-
82
- def generate_mapping(destination_repo)
83
- source_repo_map = {}
84
- repo.siblings.yum_type.each do |sibling|
85
- key = sibling.library_instance? ? sibling.id : sibling.library_instance_id
86
- source_repo_map[key] = sibling.pulp_id
87
- end
88
-
89
- Hash[destination_repo.siblings.yum_type.map { |sibling| [source_repo_map[sibling.library_instance_id], sibling.pulp_id] }]
90
- end
91
-
92
- def build_override_config(destination_repo, incremental_update: false,
93
- solve_dependencies: false,
94
- filters: [])
95
- config = {}
96
- if incremental_update ||
97
- (filters.present? && solve_dependencies)
98
- if Setting[:dependency_solving_algorithm] == 'greedy'
99
- config[:recursive] = true
100
- else
101
- config[:recursive_conservative] = true
102
- end
103
- config[:additional_repos] = generate_mapping(destination_repo)
104
- end
105
- config
106
- end
107
-
108
- def import_distribution_data
109
- distribution = smart_proxy.pulp_api.extensions.repository.distributions(repo.pulp_id).first
110
- if distribution
111
- repo.update!(
112
- :distribution_version => distribution["version"],
113
- :distribution_arch => distribution["arch"],
114
- :distribution_family => distribution["family"],
115
- :distribution_variant => distribution["variant"],
116
- :distribution_bootable => self.class.distribution_bootable?(distribution)
117
- )
118
- end
119
- end
120
-
121
- def self.distribution_bootable?(distribution)
122
- # Not every distribution from Pulp represents a bootable
123
- # repo. Determine based on the files in the repo.
124
- distribution["files"].any? do |file|
125
- if file.is_a? Hash
126
- filename = file[:relativepath]
127
- else
128
- filename = file
129
- end
130
- filename.include?('vmlinuz') || filename.include?('pxeboot') || filename.include?('kernel.img') || filename.include?('initrd.img')
131
- end
132
- end
133
-
134
- def purge_empty_contents
135
- [purge_partial_errata, purge_empty_package_groups]
136
- end
137
-
138
- def should_purge_empty_contents?
139
- true
140
- end
141
-
142
- def purge_partial_errata
143
- task = nil
144
- repo.remove_partial_errata! do |errata_to_delete|
145
- task = repo.unassociate_by_filter(::Katello::ContentViewErratumFilter::CONTENT_TYPE,
146
- "id" => { "$in" => errata_to_delete.map(&:errata_id).sort })
147
- end
148
- task
149
- end
150
-
151
- private
152
-
153
- def purge_empty_package_groups
154
- rpm_names = repo.rpms.pluck(:name).uniq
155
-
156
- # Remove all package groups with no packages
157
- package_groups_to_delete = repo.package_groups.select do |group|
158
- (rpm_names & group.package_names).empty?
159
- end
160
-
161
- repo.repository_package_groups.where(:package_group_id => package_groups_to_delete.map(&:id)).delete_all
162
-
163
- criteria = {:association => {"unit_id" => {"$in" => package_groups_to_delete.compact}}}
164
- smart_proxy.pulp_api.extensions.repository.unassociate_units(repo.pulp_id, :filters => criteria)
165
- end
166
-
167
- def copy_module_contents(destination_repo, filters:, solve_dependencies:)
168
- override_config = build_override_config(destination_repo,
169
- filters: filters,
170
- solve_dependencies: solve_dependencies)
171
-
172
- filters = filters.module_stream.or(filters.errata) if filters
173
-
174
- copy_clauses, remove_clauses = generate_module_stream_copy_clauses(filters)
175
- tasks = [smart_proxy.pulp_api.extensions.module.copy(repo.pulp_id, destination_repo.pulp_id,
176
- copy_clauses.merge(:override_config => override_config))]
177
-
178
- if remove_clauses
179
- tasks << smart_proxy.pulp_api.extensions.repository.unassociate_units(destination_repo.pulp_id,
180
- type_ids: [::Katello::Pulp::ModuleStream::CONTENT_TYPE],
181
- filters: {unit: remove_clauses})
182
- end
183
- tasks
184
- end
185
-
186
- def generate_module_stream_copy_clauses(filters)
187
- if filters&.any?
188
- clause_gen = ::Katello::Util::ModuleStreamClauseGenerator.new(repo, filters)
189
- clause_gen.generate
190
-
191
- copy = clause_gen.copy_clause
192
- copy_clauses = {filters: {unit: copy }} if copy
193
-
194
- remove = clause_gen.remove_clause
195
- remove_clauses = {filters: {unit: remove}} if remove
196
- else
197
- copy_clauses = {}
198
- remove_clauses = nil
199
- end
200
- [copy_clauses, remove_clauses]
201
- end
202
- end
203
- end
204
- end
205
- end
@@ -1,327 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Repository < ::Actions::Pulp::Abstract
4
- include ImporterComparison
5
- attr_accessor :repo, :input
6
- attr_accessor :smart_proxy
7
- delegate :root, to: :repo
8
-
9
- def initialize(repo, smart_proxy)
10
- @repo = repo
11
- @smart_proxy = smart_proxy
12
- end
13
-
14
- def backend_data(force = false)
15
- if (repo.pulp_id && (force || @backend_data.nil?))
16
- @backend_data = smart_proxy.pulp_api.extensions.repository.retrieve_with_details(repo.pulp_id)
17
- end
18
- @backend_data
19
- rescue RestClient::ResourceNotFound
20
- nil
21
- end
22
-
23
- def self.instance_for_type(repo, smart_proxy)
24
- Katello::RepositoryTypeManager.enabled_repository_types[repo.root.content_type].service_class.new(repo, smart_proxy)
25
- end
26
-
27
- def unit_type_id(_uploads = [])
28
- @repo.unit_type_id
29
- end
30
-
31
- def unit_keys(uploads)
32
- uploads.map do |upload|
33
- upload.except('id', 'name')
34
- end
35
- end
36
-
37
- def partial_repo_path
38
- fail NotImplementedError
39
- end
40
-
41
- def importer_class
42
- fail NotImplementedError
43
- end
44
-
45
- def primary_importer_configuration
46
- fail NotImplementedError
47
- end
48
-
49
- def mirror_importer_configuration
50
- fail NotImplementedError
51
- end
52
-
53
- def generate_mirror_importer
54
- fail NotImplementedError
55
- end
56
-
57
- def distributors_to_publish
58
- fail NotImplementedError
59
- end
60
-
61
- def generate_primary_importer
62
- fail NotImplementedError
63
- end
64
-
65
- def generate_distributors
66
- fail NotImplementedError
67
- end
68
-
69
- def regenerate_applicability
70
- fail NotImplementedError
71
- end
72
-
73
- def copy_contents(_destination_repo, _filters)
74
- fail NotImplementedError
75
- end
76
-
77
- def content_service
78
- Katello::Pulp::Content
79
- end
80
-
81
- def should_purge_empty_contents?
82
- false
83
- end
84
-
85
- def create_mirror_entities
86
- create
87
- end
88
-
89
- def mirror_needs_updates?
90
- needs_update?
91
- end
92
-
93
- def needs_update?
94
- needs_importer_updates? || needs_distributor_updates?
95
- end
96
-
97
- def sync(overrides = {})
98
- sync_options = {}
99
- sync_options[:max_speed] = SETTINGS.dig(:katello, :pulp, :sync_KBlimit)
100
- sync_options[:num_threads] = SETTINGS.dig(:katello, :pulp, :sync_threads)
101
- sync_options[:feed] = overrides[:feed] if overrides[:feed]
102
- sync_options[:validate] = !SETTINGS.dig(:katello, :pulp, :skip_checksum_validation)
103
- sync_options.merge!(overrides[:options]) if overrides[:options]
104
- [smart_proxy.pulp_api.resources.repository.sync(@repo.pulp_id, override_config: sync_options.compact!)]
105
- end
106
-
107
- def create
108
- smart_proxy.pulp_api.extensions.repository.create_with_importer_and_distributors(
109
- repo.pulp_id,
110
- generate_importer,
111
- generate_distributors,
112
- display_name: root.name)
113
- end
114
-
115
- def delete
116
- smart_proxy.pulp_api.extensions.repository.delete(repo.pulp_id)
117
- rescue RestClient::ResourceNotFound
118
- Rails.logger.warn("Tried to delete repository #{repo.pulp_id}, but it did not exist.")
119
- []
120
- end
121
-
122
- def external_url(force_https = false)
123
- uri = URI.parse(::SmartProxy.pulp_primary.pulp_url)
124
- uri.scheme = (root.unprotected && !force_https) ? 'http' : 'https'
125
- uri.path = partial_repo_path
126
- uri.to_s
127
- end
128
-
129
- def generate_importer
130
- if smart_proxy.pulp_mirror?
131
- generate_mirror_importer
132
- elsif repo.in_default_view?
133
- generate_primary_importer
134
- else #content view repositories don't need any importer configuration
135
- importer_class.new
136
- end
137
- end
138
-
139
- def needs_importer_updates?
140
- repo_details = backend_data
141
- return unless repo_details
142
- capsule_importer = repo_details["importers"][0]
143
- !importer_matches?(generate_importer, capsule_importer)
144
- end
145
-
146
- def needs_distributor_updates?
147
- repo_details = backend_data
148
- return unless repo_details
149
- !distributors_match?(repo_details["distributors"])
150
- end
151
-
152
- def primary_importer_connection_options
153
- options = {
154
- basic_auth_username: root.upstream_username,
155
- basic_auth_password: root.upstream_password,
156
- ssl_validation: root.verify_ssl_on_sync?
157
- }
158
- options.merge!(proxy_options)
159
- options.merge!(primary_importer_ssl_options)
160
- end
161
-
162
- def primary_importer_ssl_options
163
- if root.redhat? && Katello::Resources::CDN::CdnResource.redhat_cdn?(root.url)
164
- {
165
- ssl_client_cert: root.product.certificate,
166
- ssl_client_key: root.product.key,
167
- ssl_ca_cert: Katello::Repository.feed_ca_cert(root.url)
168
- }
169
- elsif root.custom?
170
- {
171
- ssl_client_cert: root.ssl_client_cert&.content,
172
- ssl_client_key: root.ssl_client_key&.content,
173
- ssl_ca_cert: root.ssl_ca_cert&.content
174
- }
175
- else
176
- {}
177
- end
178
- end
179
-
180
- def mirror_importer_connection_options
181
- ueber_cert = ::Cert::Certs.ueber_cert(root.organization)
182
- {
183
- ssl_client_cert: ueber_cert[:cert],
184
- ssl_client_key: ueber_cert[:key],
185
- ssl_ca_cert: ::Cert::Certs.ca_cert,
186
- ssl_validation: true
187
- }
188
- end
189
-
190
- def distributor_publish(options)
191
- distributors_to_publish(options).map do |distributor_class, config|
192
- config[:force_full] = options.fetch(:force, false)
193
- smart_proxy.pulp_api.extensions.repository.publish(repo.pulp_id, lookup_distributor_id(distributor_class.type_id),
194
- override_config: config)
195
- end
196
- end
197
-
198
- def lookup_distributor_id(distributor_type_id)
199
- distributor = backend_data["distributors"].find do |dist|
200
- dist["distributor_type_id"] == distributor_type_id
201
- end
202
- distributor['id']
203
- end
204
-
205
- def refresh_if_needed
206
- refresh if needs_update?
207
- end
208
-
209
- def refresh
210
- tasks = update_or_associate_importer
211
- tasks += update_or_associate_distributors
212
- tasks += remove_unnecessary_distributors
213
- tasks
214
- end
215
-
216
- def refresh_mirror_entities
217
- refresh_if_needed
218
- end
219
-
220
- def update_or_associate_importer
221
- existing_importers = backend_data["importers"]
222
- importer = generate_importer
223
- found = existing_importers.find { |i| i['importer_type_id'] == importer.id }
224
-
225
- tasks = []
226
- if found
227
- ssl_ca_cert = importer.config.delete('ssl_ca_cert')
228
- ssl_client_cert = importer.config.delete('ssl_client_cert')
229
- ssl_client_key = importer.config.delete('ssl_client_key')
230
- importer.config['basic_auth_username'] = nil if importer.config['basic_auth_username'].blank?
231
- importer.config['basic_auth_password'] = nil if importer.config['basic_auth_password'].blank?
232
- # Update ssl options by themselves workaround for https://pulp.plan.io/issues/2727
233
- tasks << smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], :ssl_client_cert => ssl_client_cert,
234
- :ssl_client_key => ssl_client_key, :ssl_ca_cert => ssl_ca_cert)
235
- tasks << smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], importer.config)
236
- else
237
- tasks << smart_proxy.pulp_api.resources.repository.associate_importer(repo.pulp_id, repo.importers.first['importer_type_id'], importer.config)
238
- end
239
- tasks
240
- end
241
-
242
- def update_or_associate_distributors
243
- tasks = []
244
- existing_distributors = backend_data["distributors"]
245
- generate_distributors.each do |distributor|
246
- found = existing_distributors.find { |i| i['distributor_type_id'] == distributor.type_id }
247
- if found
248
- tasks << smart_proxy.pulp_api.resources.repository.update_distributor(repo.pulp_id, found['id'], distributor.config)
249
- else
250
- smart_proxy.pulp_api.resources.repository.
251
- associate_distributor(repo.pulp_id, distributor.type_id, distributor.config, :distributor_id => distributor.id,
252
- :auto_publish => distributor.auto_publish)
253
- end
254
- end
255
- tasks
256
- end
257
-
258
- def remove_unnecessary_distributors
259
- tasks = []
260
- existing_distributors = backend_data["distributors"]
261
- generated_distributors = generate_distributors
262
- existing_distributors.each do |distributor|
263
- found = generated_distributors.find { |dist| dist.type_id == distributor['distributor_type_id'] }
264
- tasks << smart_proxy.pulp_api.resources.repository.delete_distributor(repo.pulp_id, distributor['id']) unless found
265
- end
266
- tasks
267
- end
268
-
269
- def copy_units(destination_repo, units, incremental_update: false)
270
- override_config = {}
271
- override_config = build_override_config(destination_repo, incremental_update: incremental_update) if respond_to? :build_override_config
272
- content_type = units.first.class::CONTENT_TYPE
273
- unit_ids = units.pluck(:pulp_id)
274
- smart_proxy.pulp_api.extensions.send(content_type).copy(repo.pulp_id, destination_repo.pulp_id, ids: unit_ids, override_config: override_config)
275
- end
276
-
277
- def content_unit_types
278
- Katello::RepositoryTypeManager.find(repo.content_type)
279
- end
280
-
281
- def proxy_options
282
- if repo.root.http_proxy_policy == RootRepository::NO_DEFAULT_HTTP_PROXY
283
- return { proxy_host: '' }
284
- end
285
-
286
- proxy = repo.root.http_proxy
287
- if repo.root.http_proxy_policy == RootRepository::GLOBAL_DEFAULT_HTTP_PROXY
288
- proxy = HttpProxy.default_global_content_proxy
289
- end
290
-
291
- if proxy
292
- uri = URI(proxy.url)
293
- proxy_options = {
294
- proxy_host: uri.scheme + '://' + uri.host,
295
- proxy_port: uri.port,
296
- proxy_username: proxy.username,
297
- proxy_password: proxy.password
298
- }
299
- return proxy_options
300
- end
301
- { proxy_host: '' }
302
- end
303
-
304
- private
305
-
306
- def filtered_distribution_config_equal?(generated_config, actual_config)
307
- generated = generated_config.clone
308
- actual = actual_config.clone
309
- #We store 'default' checksum type as nil, but pulp will default to sha256, so if we haven't set it, ignore it
310
- if generated.keys.include?('checksum_type') && generated['checksum_type'].nil?
311
- generated.delete('checksum_type')
312
- actual.delete('checksum_type')
313
- end
314
- generated.compact == actual.compact
315
- end
316
-
317
- def distributors_match?(capsule_distributors)
318
- generated_distributor_configs = generate_distributors
319
- generated_distributor_configs.all? do |gen_dist|
320
- type = gen_dist.class.type_id
321
- found_on_capsule = capsule_distributors.find { |dist| dist['distributor_type_id'] == type }
322
- found_on_capsule && filtered_distribution_config_equal?(gen_dist.config, found_on_capsule['config'])
323
- end
324
- end
325
- end
326
- end
327
- end
@@ -1,35 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Server
4
- def self.config(url, user_remote_id)
5
- uri = URI.parse(url)
6
-
7
- runcible_params = {
8
- :url => "#{uri.scheme}://#{uri.host.downcase}:#{uri.port}",
9
- :api_path => uri.path,
10
- :user => user_remote_id,
11
- :timeout => SETTINGS[:katello][:rest_client_timeout],
12
- :open_timeout => SETTINGS[:katello][:rest_client_timeout],
13
- :logging => {
14
- :logger => ::Foreman::Logging.logger('katello/pulp_rest'),
15
- :exception => true,
16
- :info => true,
17
- :debug => true
18
- },
19
- :cert_auth => {
20
- :ssl_client_cert => '/etc/pki/katello/certs/pulp-client.crt',
21
- :ssl_client_key => '/etc/pki/katello/private/pulp-client.key'
22
- }
23
- }
24
-
25
- if (ca_cert = SETTINGS[:katello][:pulp][:ca_cert_file])
26
- runcible_params[:ca_cert_file] = ca_cert
27
- end
28
-
29
- runcible_params[:verify_ssl] = SETTINGS[:katello][:pulp][:verify_ssl] if SETTINGS[:katello][:pulp].key?(:verify_ssl)
30
-
31
- Runcible::Instance.new(runcible_params)
32
- end
33
- end
34
- end
35
- end