katello 4.1.4 → 4.2.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 (240) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  3. data/app/controllers/katello/api/v2/content_credentials_controller.rb +3 -3
  4. data/app/controllers/katello/api/v2/content_uploads_controller.rb +3 -1
  5. data/app/controllers/katello/api/v2/content_view_components_controller.rb +33 -1
  6. data/app/controllers/katello/api/v2/content_views_controller.rb +12 -0
  7. data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -2
  9. data/app/controllers/katello/api/v2/products_controller.rb +4 -4
  10. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +3 -11
  11. data/app/controllers/katello/api/v2/repositories_controller.rb +68 -47
  12. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +0 -28
  13. data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +26 -5
  14. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +26 -1
  15. data/app/lib/actions/candlepin/environment/destroy.rb +2 -0
  16. data/app/lib/actions/katello/agent_action.rb +2 -2
  17. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +3 -2
  18. data/app/lib/actions/katello/{gpg_key → content_credential}/update.rb +1 -1
  19. data/app/lib/actions/katello/content_view/publish.rb +6 -1
  20. data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -1
  21. data/app/lib/actions/katello/content_view_version/incremental_update.rb +0 -47
  22. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
  23. data/app/lib/actions/katello/repository/clone_contents.rb +1 -7
  24. data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -7
  25. data/app/lib/actions/katello/repository/create.rb +4 -8
  26. data/app/lib/actions/katello/repository/create_root.rb +1 -1
  27. data/app/lib/actions/katello/repository/destroy.rb +1 -3
  28. data/app/lib/actions/katello/repository/import_upload.rb +3 -2
  29. data/app/lib/actions/katello/repository/instance_update.rb +1 -1
  30. data/app/lib/actions/katello/repository/metadata_generate.rb +2 -8
  31. data/app/lib/actions/katello/repository/multi_clone_contents.rb +0 -1
  32. data/app/lib/actions/katello/repository/refresh_repository.rb +1 -4
  33. data/app/lib/actions/katello/repository/remove_content.rb +6 -4
  34. data/app/lib/actions/katello/repository/sync.rb +5 -25
  35. data/app/lib/actions/katello/repository/update.rb +1 -2
  36. data/app/lib/actions/katello/repository/update_http_proxy_details.rb +2 -5
  37. data/app/lib/actions/katello/repository/update_redhat_repository.rb +1 -1
  38. data/app/lib/actions/katello/repository/upload_files.rb +8 -3
  39. data/app/lib/actions/katello/repository/upload_package_group.rb +2 -11
  40. data/app/lib/actions/katello/repository/verify_checksum.rb +0 -1
  41. data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
  42. data/app/lib/actions/pulp3/orchestration/repository/create.rb +2 -2
  43. data/app/lib/actions/pulp3/repository/create.rb +3 -4
  44. data/app/lib/actions/pulp3/repository/create_remote.rb +1 -6
  45. data/app/lib/actions/pulp3/repository/repair.rb +4 -0
  46. data/app/lib/katello/errors.rb +1 -0
  47. data/app/lib/katello/http_resource.rb +26 -73
  48. data/app/lib/katello/qpid/connection.rb +1 -3
  49. data/app/lib/katello/resources/candlepin/consumer.rb +1 -1
  50. data/app/lib/katello/resources/candlepin/environment.rb +2 -0
  51. data/app/lib/katello/resources/registry.rb +7 -20
  52. data/app/lib/katello/util/http_proxy.rb +0 -3
  53. data/app/lib/katello/validators/gpg_key_content_validator.rb +1 -1
  54. data/app/models/katello/authorization/{gpg_key.rb → content_credential.rb} +1 -1
  55. data/app/models/katello/authorization/product.rb +0 -4
  56. data/app/models/katello/concerns/host_managed_extensions.rb +2 -16
  57. data/app/models/katello/concerns/organization_extensions.rb +1 -1
  58. data/app/models/katello/concerns/pulp_database_unit.rb +13 -5
  59. data/app/models/katello/concerns/smart_proxy_extensions.rb +45 -41
  60. data/app/models/katello/{gpg_key.rb → content_credential.rb} +4 -4
  61. data/app/models/katello/content_view.rb +6 -1
  62. data/app/models/katello/generic_content_unit.rb +16 -0
  63. data/app/models/katello/glue/pulp/repos.rb +9 -25
  64. data/app/models/katello/kt_environment.rb +1 -1
  65. data/app/models/katello/product.rb +4 -4
  66. data/app/models/katello/repository.rb +13 -7
  67. data/app/models/katello/repository_generic_content_unit.rb +7 -0
  68. data/app/models/katello/root_repository.rb +38 -7
  69. data/app/models/setting/content.rb +5 -0
  70. data/app/services/cert/certs.rb +16 -8
  71. data/app/services/katello/applicability/applicable_content_helper.rb +1 -2
  72. data/app/services/katello/candlepin/consumer.rb +6 -0
  73. data/app/services/katello/component_view_presenter.rb +27 -0
  74. data/app/services/katello/pulp/repository.rb +1 -1
  75. data/app/services/katello/pulp/server.rb +2 -2
  76. data/app/services/katello/pulp3/api/core.rb +4 -0
  77. data/app/services/katello/pulp3/api/generic.rb +68 -0
  78. data/app/services/katello/pulp3/generic_content_unit.rb +29 -0
  79. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -1
  80. data/app/services/katello/pulp3/repository/generic.rb +94 -0
  81. data/app/services/katello/pulp3/repository/yum.rb +4 -5
  82. data/app/services/katello/pulp3/repository.rb +27 -12
  83. data/app/services/katello/pulp3/repository_mirror.rb +2 -2
  84. data/app/services/katello/pulp3/smart_proxy_repository.rb +4 -4
  85. data/app/services/katello/registration_manager.rb +18 -7
  86. data/app/services/katello/repository_type.rb +59 -1
  87. data/app/services/katello/repository_type_manager.rb +116 -24
  88. data/app/views/katello/api/v2/content_views/base.json.rabl +4 -4
  89. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -0
  90. data/app/views/smart_proxies/plugins/_pulpcore.html.erb +2 -5
  91. data/app/views/smart_proxies/pulp_status.html.erb +0 -7
  92. data/config/katello.yaml.example +0 -21
  93. data/config/routes/api/v2.rb +2 -1
  94. data/db/functions/deb_version_cmp_v01.sql +200 -0
  95. data/db/migrate/20171110082124_add_ssl_certs_to_products_and_repos.rb +5 -1
  96. data/db/migrate/20200402130013_add_repsoitory_docker_meta_tag_f_key.rb +3 -1
  97. data/db/migrate/20210624221630_katello_generic_content.rb +22 -0
  98. data/db/migrate/20210625095042_add_retain_package_versions_count.rb +9 -0
  99. data/db/migrate/20210628182553_add_generic_remote_options_to_root_repository.rb +5 -0
  100. data/db/migrate/20210714140440_remove_repo_export_permission.rb +5 -0
  101. data/db/migrate/20210721163730_change_gpg_keys_to_content_credentials.rb +8 -0
  102. data/db/migrate/20210728130748_create_function_deb_version_cmp.rb +12 -0
  103. data/db/seeds.d/111-upgrade_tasks.rb +1 -2
  104. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +7 -5
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +4 -1
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +1 -1
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +2 -1
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +25 -33
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-advanced-sync-modal.html +1 -1
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-repositories.controller.js +1 -6
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +10 -2
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +9 -0
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +0 -2
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-advanced-sync-options.html +1 -25
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +1 -1
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +31 -13
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +0 -6
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/aggregate-task.factory.js +3 -3
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/task.factory.js +1 -1
  123. data/lib/katello/engine.rb +2 -4
  124. data/lib/katello/permission_creator.rb +6 -12
  125. data/lib/katello/plugin.rb +76 -80
  126. data/lib/katello/repository_types/python.rb +37 -0
  127. data/lib/katello/tasks/reimport.rake +0 -9
  128. data/lib/katello/tasks/repository.rake +3 -4
  129. data/lib/katello/version.rb +1 -1
  130. data/locale/action_names.rb +28 -29
  131. data/locale/bn/katello.po +699 -221
  132. data/locale/cs/katello.po +167 -59
  133. data/locale/de/katello.po +585 -352
  134. data/locale/en/katello.po +167 -59
  135. data/locale/es/katello.po +1388 -1189
  136. data/locale/fr/katello.po +1740 -1494
  137. data/locale/gu/katello.po +896 -416
  138. data/locale/hi/katello.po +892 -415
  139. data/locale/it/katello.po +371 -170
  140. data/locale/ja/katello.po +1657 -1439
  141. data/locale/katello.pot +933 -736
  142. data/locale/kn/katello.po +894 -416
  143. data/locale/ko/katello.po +515 -317
  144. data/locale/mr/katello.po +857 -415
  145. data/locale/or/katello.po +894 -416
  146. data/locale/pa/katello.po +874 -411
  147. data/locale/pt/katello.po +347 -154
  148. data/locale/pt_BR/katello.po +1398 -1215
  149. data/locale/ru/katello.po +671 -463
  150. data/locale/ta/katello.po +697 -221
  151. data/locale/te/katello.po +891 -415
  152. data/locale/zh_CN/katello.po +2029 -1845
  153. data/locale/zh_TW/katello.po +735 -407
  154. data/package.json +3 -1
  155. data/webpack/components/EditableTextInput/EditableTextInput.js +3 -3
  156. data/webpack/components/RoutedTabs/RoutedTabs.js +7 -8
  157. data/webpack/components/Table/TableWrapper.js +19 -11
  158. data/webpack/components/Table/helpers.js +1 -1
  159. data/webpack/components/extensions/HostDetails/Tabs/ContentTab.js +42 -0
  160. data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +12 -0
  161. data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/ActivationKeys.test.js.snap +4 -0
  162. data/webpack/components/extensions/RegistrationCommands/fields/ActivationKeys.js +1 -1
  163. data/webpack/components/extensions/RegistrationCommands/index.js +1 -2
  164. data/webpack/components/pf3Table/formatters/selectionHeaderCellFormatter.js +2 -1
  165. data/webpack/fills_index.js +4 -1
  166. data/webpack/redux/actions/RedHatRepositories/helpers.js +2 -4
  167. data/webpack/redux/reducers/RedHatRepositories/enabled.js +4 -1
  168. data/webpack/scenes/ContentViews/ContentViewsActions.js +16 -1
  169. data/webpack/scenes/ContentViews/ContentViewsConstants.js +15 -0
  170. data/webpack/scenes/ContentViews/ContentViewsPage.js +12 -22
  171. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +4 -3
  172. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +25 -14
  173. data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +4 -2
  174. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +153 -0
  175. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentVersion.js +21 -10
  176. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +157 -19
  177. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.fixtures.json +100 -108
  178. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +140 -16
  179. data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/publishedContentViewDetails.fixtures.json +367 -0
  180. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +59 -6
  181. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +43 -0
  182. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +44 -13
  183. data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +161 -0
  184. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterAdd.test.js +54 -0
  185. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +124 -0
  186. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +8 -6
  187. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +7 -6
  188. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetails.js +4 -3
  189. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +71 -12
  190. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +77 -0
  191. data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +13 -12
  192. data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +2 -2
  193. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +17 -14
  194. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +3 -3
  195. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +2 -2
  196. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +6 -2
  197. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +61 -20
  198. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskInProgressResponse.fixtures.json +71 -0
  199. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskResponse.fixtures.json +75 -0
  200. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +86 -1
  201. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +713 -0
  202. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  203. data/webpack/scenes/ContentViews/Publish/CVPublishFinish.js +184 -0
  204. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +104 -0
  205. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +71 -0
  206. data/webpack/scenes/ContentViews/Publish/ContentViewPublishSelectors.js +17 -0
  207. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +145 -0
  208. data/webpack/scenes/ContentViews/Publish/__tests__/environmentPaths.fixtures.json +352 -0
  209. data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +184 -0
  210. data/webpack/scenes/ContentViews/Publish/__tests__/publishResponse.fixture.json +69 -0
  211. data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +3 -0
  212. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +75 -48
  213. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +15 -2
  214. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -10
  215. data/webpack/scenes/ContentViews/components/EnvironmentLabels.js +22 -10
  216. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathActions.js +12 -0
  217. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathConstants.js +2 -0
  218. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathSelectors.js +16 -0
  219. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +72 -0
  220. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +8 -0
  221. data/webpack/scenes/ContentViews/components/TaskPresenter/TaskPresenter.js +85 -0
  222. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +9 -8
  223. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +4 -25
  224. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -3
  225. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +3 -3
  226. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +4 -2
  227. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +24 -0
  228. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +4 -1
  229. data/webpack/scenes/Subscriptions/index.js +1 -4
  230. metadata +74 -39
  231. data/app/lib/actions/candlepin/environment/create.rb +0 -21
  232. data/app/lib/actions/foreman/environment/destroy.rb +0 -23
  233. data/app/lib/actions/katello/content_view/environment_create.rb +0 -21
  234. data/app/lib/actions/katello/repository/export.rb +0 -85
  235. data/app/lib/actions/katello/repository/purge_empty_content.rb +0 -16
  236. data/app/lib/actions/katello/repository/upload_errata.rb +0 -38
  237. data/app/lib/katello/util/proxy_uri.rb +0 -64
  238. data/app/models/katello/rhsm_fact_importer.rb +0 -20
  239. data/app/models/katello/rhsm_fact_name.rb +0 -17
  240. data/app/models/katello/rhsm_fact_parser.rb +0 -120
@@ -47,7 +47,7 @@ module Katello
47
47
  create_remote unless fetch_remote
48
48
  end
49
49
 
50
- def create(_force = false)
50
+ def create
51
51
  api.repositories_api.create(name: backend_object_name)
52
52
  end
53
53
 
@@ -170,7 +170,7 @@ module Katello
170
170
  end
171
171
 
172
172
  def pulp3_enabled_repo_types
173
- Katello::RepositoryTypeManager.repository_types.values.select do |repository_type|
173
+ Katello::RepositoryTypeManager.enabled_repository_types.values.select do |repository_type|
174
174
  smart_proxy.pulp3_repository_type_support?(repository_type)
175
175
  end
176
176
  end
@@ -45,9 +45,9 @@ module Katello
45
45
  tasks.flatten
46
46
  end
47
47
 
48
- def pulp3_enabled_repo_types(check_pulp2_preferred = true)
49
- Katello::RepositoryTypeManager.repository_types.values.select do |repository_type|
50
- smart_proxy.pulp3_repository_type_support?(repository_type, check_pulp2_preferred)
48
+ def pulp3_enabled_repo_types
49
+ Katello::RepositoryTypeManager.enabled_repository_types.values.select do |repository_type|
50
+ smart_proxy.pulp3_repository_type_support?(repository_type)
51
51
  end
52
52
  end
53
53
 
@@ -55,7 +55,7 @@ module Katello
55
55
  # Each key is a Pulp 3 plugin API and each value is the list of version_hrefs
56
56
  repo_version_map = {}
57
57
  pulp3_enabled_repo_types.each do |repo_type|
58
- api = repo_type.pulp3_service_class.api(smart_proxy)
58
+ api = repo_type.pulp3_api(smart_proxy)
59
59
  version_hrefs = api.repository_versions.select { |repo_version| repo_version.number != 0 }.map(&:pulp_href)
60
60
  repo_version_map[api] = version_hrefs - ::Katello::Repository.where(version_href: version_hrefs).pluck(:version_href)
61
61
  end
@@ -50,6 +50,16 @@ module Katello
50
50
  Katello::Host::SubscriptionFacet::DMI_UUID_ALLOWED_DUPS
51
51
  end
52
52
 
53
+ def dmi_uuid_change_allowed?(host, host_uuid_overridden)
54
+ if host_uuid_overridden
55
+ true
56
+ elsif host.build && Setting[:host_profile_assume_build_can_change]
57
+ true
58
+ else
59
+ Setting[:host_profile_assume]
60
+ end
61
+ end
62
+
53
63
  def find_existing_hosts(host_name, host_uuid)
54
64
  query = ::Host.unscoped.where("#{::Host.table_name}.name = ?", host_name)
55
65
 
@@ -77,11 +87,14 @@ module Katello
77
87
  host = hosts.first
78
88
 
79
89
  if host.name == host_name
80
- unless Setting[:host_profile_assume] || host.subscription_facet.nil? || host.build || host_uuid_overridden
81
- current_dmi_uuid = host.subscription_facet.dmi_uuid
82
- if current_dmi_uuid && current_dmi_uuid != host_uuid
83
- registration_error("This host is reporting a DMI UUID that differs from the existing registration.")
84
- end
90
+ if !host.build && Setting[:host_re_register_build_only]
91
+ registration_error("Host with name %{host_name} is currently registered but not in build mode (host_re_register_build_only==True). Unregister the host manually or put it into build mode to continue.", host_name: host_name)
92
+ end
93
+
94
+ current_dmi_uuid = host.subscription_facet&.dmi_uuid
95
+ dmi_uuid_changed = current_dmi_uuid && current_dmi_uuid != host_uuid
96
+ if dmi_uuid_changed && !dmi_uuid_change_allowed?(host, host_uuid_overridden)
97
+ registration_error("This host is reporting a DMI UUID that differs from the existing registration.")
85
98
  end
86
99
 
87
100
  return true
@@ -249,8 +262,6 @@ module Katello
249
262
  end
250
263
 
251
264
  def delete_agent_queue(host)
252
- return unless ::Katello.with_katello_agent?
253
-
254
265
  queue_name = Katello::Agent::Dispatcher.host_queue_name(host)
255
266
  Katello::EventQueue.push_event(::Katello::Events::DeleteHostAgentQueue::EVENT_TYPE, host.id) do |attrs|
256
267
  attrs[:metadata] = { queue_name: queue_name }
@@ -13,7 +13,10 @@ module Katello
13
13
  end
14
14
 
15
15
  def_field :allow_creation_by_user, :service_class, :pulp3_service_class, :pulp3_plugin,
16
- :pulp3_skip_publication, :pulp3_api_class
16
+ :pulp3_skip_publication, :configuration_class, :partial_repo_path, :pulp3_api_class,
17
+ :repositories_api_class, :api_class, :remotes_api_class, :repository_versions_api_class,
18
+ :distributions_api_class, :remote_class, :repo_sync_url_class, :client_module_class,
19
+ :distribution_class, :publication_class, :publications_api_class, :model_name, :model_version
17
20
 
18
21
  attr_accessor :metadata_publish_matching_check, :index_additional_data_proc
19
22
  attr_reader :id, :unique_content_per_repo
@@ -22,6 +25,8 @@ module Katello
22
25
  @id = id.to_sym
23
26
  allow_creation_by_user(true)
24
27
  @unique_content_per_repo = false
28
+ @content_types = []
29
+ @generic_remote_options = []
25
30
  end
26
31
 
27
32
  def set_unique_content_per_repo
@@ -32,6 +37,10 @@ module Katello
32
37
  @content_types.sort_by(&:priority)
33
38
  end
34
39
 
40
+ def generic_remote_options
41
+ @generic_remote_options.sort_by(&:name)
42
+ end
43
+
35
44
  def content_types_to_index
36
45
  if SmartProxy.pulp_primary&.pulp3_repository_type_support?(self)
37
46
  # type.index being false supersedes type.index_on_pulp3 being true
@@ -54,6 +63,16 @@ module Katello
54
63
  @content_types << ContentType.new(options.merge(:model_class => model_class))
55
64
  end
56
65
 
66
+ def generic_content_type(content_type, options = {})
67
+ @content_types ||= []
68
+ @content_types << GenericContentType.new(options.merge(:content_type => content_type))
69
+ end
70
+
71
+ def generic_remote_option(name, options = {})
72
+ @generic_remote_options ||= []
73
+ @generic_remote_options << GenericRemoteOption.new(options.merge(:name => name))
74
+ end
75
+
57
76
  def prevent_unneeded_metadata_publish
58
77
  self.metadata_publish_matching_check = true
59
78
  end
@@ -75,6 +94,14 @@ module Katello
75
94
  }
76
95
  end
77
96
 
97
+ def pulp3_api(smart_proxy)
98
+ if pulp3_api_class == Katello::Pulp3::Api::Generic
99
+ pulp3_api_class.new(smart_proxy, self)
100
+ else
101
+ pulp3_api_class ? pulp3_api_class.new(smart_proxy) : Katello::Pulp3::Api::Core.new(smart_proxy)
102
+ end
103
+ end
104
+
78
105
  class ContentType
79
106
  attr_accessor :model_class, :priority, :pulp2_service_class, :pulp3_service_class, :index, :uploadable, :removable, :index_on_pulp3
80
107
 
@@ -93,5 +120,36 @@ module Katello
93
120
  self.model_class::CONTENT_TYPE
94
121
  end
95
122
  end
123
+
124
+ class GenericContentType < ContentType
125
+ attr_accessor :pulp3_api, :pulp3_model, :content_type
126
+
127
+ def initialize(options)
128
+ self.model_class = options[:model_class]
129
+ self.priority = options[:priority] || 99
130
+ self.pulp3_service_class = options[:pulp3_service_class]
131
+ self.index = options[:index].nil? ? true : options[:index]
132
+ self.index_on_pulp3 = options[:index_on_pulp3].nil? ? true : options[:index_on_pulp3]
133
+ self.uploadable = options[:uploadable] || false
134
+ self.removable = options[:removable] || false
135
+ self.pulp3_api = options[:pulp3_api]
136
+ self.pulp3_model = options[:pulp3_model]
137
+ self.content_type = options[:content_type]
138
+ end
139
+
140
+ def label
141
+ self.model_class::CONTENT_TYPE
142
+ end
143
+ end
144
+
145
+ class GenericRemoteOption
146
+ attr_accessor :name, :type, :description
147
+
148
+ def initialize(options)
149
+ self.name = options[:name]
150
+ self.type = options[:type]
151
+ self.description = options[:description]
152
+ end
153
+ end
96
154
  end
97
155
  end
@@ -1,69 +1,125 @@
1
1
  module Katello
2
2
  class RepositoryTypeManager
3
- @repository_types = {}
3
+ PULP3_FEATURE = "Pulpcore".freeze
4
+
5
+ @defined_repository_types = {}
6
+ @enabled_repository_types = {}
7
+ begin
8
+ @pulp_primary = ::SmartProxy.unscoped.detect { |proxy| !proxy.setting(PULP3_FEATURE, 'mirror') }
9
+ rescue ActiveRecord::StatementInvalid
10
+ @pulp_primary = nil
11
+ end
4
12
  class << self
5
13
  private :new
6
- attr_reader :repository_types
14
+ attr_reader :defined_repository_types
7
15
 
8
16
  # Plugin constructor
9
17
  def register(id, &block)
10
- configured = SETTINGS[:katello][:content_types].nil? || SETTINGS[:katello][:content_types].with_indifferent_access[id]
11
- if find(id).blank? && configured
12
- repository_type = ::Katello::RepositoryType.new(id)
13
- repository_type.instance_eval(&block) if block_given?
14
- repository_types[id.to_s] = repository_type
18
+ if @pulp_primary&.has_feature?(PULP3_FEATURE) && @pulp_primary&.capabilities(PULP3_FEATURE)&.empty?
19
+ fix_pulp3_capabilities
20
+ end
21
+ defined_repo_type = find_defined(id)
22
+ if defined_repo_type.blank?
23
+ defined_repo_type = ::Katello::RepositoryType.new(id)
24
+ defined_repo_type.instance_eval(&block) if block_given?
25
+ @defined_repository_types[id.to_s] = defined_repo_type
26
+ end
27
+ if find(id).blank? && defined_repo_type.present?
28
+ enabled_repository_types[id.to_s] = defined_repo_type if pulp3_plugin_installed?(id)
29
+ end
30
+ end
31
+
32
+ def fix_pulp3_capabilities
33
+ save_pulp_primary if @pulp_primary.nil?
34
+ @pulp_primary&.refresh
35
+ if @pulp_primary&.capabilities(PULP3_FEATURE)&.empty?
36
+ fail Katello::Errors::PulpcoreMissingCapabilities
37
+ end
38
+ end
39
+
40
+ def enabled_repository_types(update = true)
41
+ disabled_types = @defined_repository_types.keys - @enabled_repository_types.keys
42
+ if update && disabled_types.present?
43
+ disabled_types.each { |repo_type| update_enabled_repository_type(repo_type.to_s) }
44
+ end
45
+ @enabled_repository_types
46
+ end
47
+
48
+ def creatable_repository_types(enabled_only = true)
49
+ repo_types = enabled_only ? enabled_repository_types : defined_repository_types
50
+ repo_types.select do |repo_type, _|
51
+ creatable_by_user?(repo_type, enabled_only)
15
52
  end
16
53
  end
17
54
 
18
- def creatable_repository_types
19
- repository_types.select do |repo_type, _|
20
- creatable_by_user?(repo_type)
55
+ def generic_repository_types(enabled_only = true)
56
+ repo_types = enabled_only ? enabled_repository_types : defined_repository_types
57
+ repo_types.select do |_, values|
58
+ values.pulp3_service_class == Katello::Pulp3::Repository::Generic
21
59
  end
22
60
  end
23
61
 
24
- def enabled_content_types
25
- list = repository_types.values.map do |type|
62
+ def pulp3_plugin_installed?(repository_type)
63
+ save_pulp_primary
64
+ @pulp_primary&.capabilities(PULP3_FEATURE)&.include?(@defined_repository_types[repository_type].pulp3_plugin)
65
+ end
66
+
67
+ def enabled_content_types(enabled_only = true)
68
+ repo_types = enabled_only ? enabled_repository_types : defined_repository_types
69
+ list = repo_types.values.map do |type|
26
70
  type.content_types.map(&:model_class).flatten.map { |ct| ct::CONTENT_TYPE }
27
71
  end
28
72
  list.flatten
29
73
  end
30
74
 
31
75
  def indexable_content_types
32
- repository_types.
76
+ enabled_repository_types.
33
77
  values.
34
78
  map(&:content_types_to_index).
35
79
  flatten
36
80
  end
37
81
 
38
- def creatable_by_user?(repository_type)
39
- return false unless (type = find(repository_type))
82
+ def creatable_by_user?(repository_type, enabled_only = true)
83
+ type = enabled_only ? find(repository_type) : find_defined(repository_type)
84
+ return false unless type
40
85
  type.allow_creation_by_user
41
86
  end
42
87
 
43
- def removable_content_types
44
- list = @repository_types.values.map do |type|
88
+ def removable_content_types(enabled_only = true)
89
+ repo_types = enabled_only ? enabled_repository_types : defined_repository_types
90
+ list = repo_types.values.map do |type|
45
91
  type.content_types.select(&:removable)
46
92
  end
47
93
  list.flatten
48
94
  end
49
95
 
50
- def uploadable_content_types
51
- list = @repository_types.values.map do |type|
96
+ def uploadable_content_types(enabled_only = true)
97
+ repo_types = enabled_only ? enabled_repository_types : defined_repository_types
98
+ list = repo_types.values.map do |type|
52
99
  type.content_types.select(&:uploadable)
53
100
  end
54
101
  list.flatten
55
102
  end
56
103
 
104
+ def find_defined(repository_type)
105
+ @defined_repository_types[repository_type.to_s]
106
+ end
107
+
57
108
  def find(repository_type)
58
- repository_types[repository_type.to_s]
109
+ # Skip updating disabled repo types because find() updates the input type if necessary
110
+ found_repo_type = enabled_repository_types(false)[repository_type.to_s]
111
+ if found_repo_type.blank?
112
+ found_repo_type = update_enabled_repository_type(repository_type.to_s)
113
+ end
114
+ found_repo_type
59
115
  end
60
116
 
61
117
  def find_by(attribute, value)
62
- repository_types.values.find { |type| type.try(attribute) == value }
118
+ enabled_repository_types.values.find { |type| type.try(attribute) == value }
63
119
  end
64
120
 
65
121
  def find_repository_type(katello_label)
66
- repository_types.values.each do |repo_type|
122
+ enabled_repository_types.values.each do |repo_type|
67
123
  repo_type.content_types.each do |content_type|
68
124
  return repo_type if content_type.label == katello_label.to_s
69
125
  end
@@ -72,7 +128,7 @@ module Katello
72
128
  end
73
129
 
74
130
  def find_content_type(katello_label)
75
- repository_types.values.each do |repo_type|
131
+ enabled_repository_types.values.each do |repo_type|
76
132
  repo_type.content_types.each do |content_type|
77
133
  return content_type if content_type.label == katello_label.to_s
78
134
  end
@@ -81,7 +137,7 @@ module Katello
81
137
  end
82
138
 
83
139
  def model_class(pulp_service_class)
84
- repository_types.values.each do |repo_type|
140
+ enabled_repository_types.values.each do |repo_type|
85
141
  repo_type.content_types.each do |content_type|
86
142
  return content_type.model_class if (content_type.pulp2_service_class == pulp_service_class || content_type.pulp3_service_class == pulp_service_class)
87
143
  end
@@ -95,6 +151,42 @@ module Katello
95
151
  def enabled?(repository_type)
96
152
  find(repository_type).present?
97
153
  end
154
+
155
+ def check_content_matches_repo_type!(repository, content_type)
156
+ repo_content_types = repository.repository_type.content_types.collect { |type| type.label }
157
+ unless repo_content_types.include?(content_type)
158
+ fail _("Content type %{content_type} is incompatible with repositories of type %{repo_type}") %
159
+ { content_type: content_type, repo_type: repository.content_type }
160
+ end
161
+ end
162
+
163
+ def generic_remote_options(opts = {})
164
+ options = []
165
+ repo_types = opts[:defined_only] ? defined_repository_types : enabled_repository_types
166
+ repo_types.each do |_, type|
167
+ if opts[:content_type]
168
+ (options << type.generic_remote_options).flatten! if type.pulp3_service_class == Katello::Pulp3::Repository::Generic && type.id.to_s == opts[:content_type]
169
+ else
170
+ (options << type.generic_remote_options).flatten! if type.pulp3_service_class == Katello::Pulp3::Repository::Generic
171
+ end
172
+ end
173
+ options
174
+ end
175
+
176
+ private
177
+
178
+ def update_enabled_repository_type(repository_type)
179
+ defined_repo_type = find_defined(repository_type.to_s)
180
+ if defined_repo_type.present? && pulp3_plugin_installed?(repository_type.to_s)
181
+ @enabled_repository_types[repository_type.to_s] = defined_repo_type
182
+ end
183
+ end
184
+
185
+ def save_pulp_primary
186
+ @pulp_primary = ::SmartProxy.unscoped.detect { |proxy| !proxy.setting(PULP3_FEATURE, 'mirror') }
187
+ rescue ActiveRecord::StatementInvalid
188
+ @pulp_primary = nil
189
+ end
98
190
  end
99
191
  end
100
192
  end
@@ -15,11 +15,11 @@ node :next_version do |content_view|
15
15
  end
16
16
 
17
17
  child :last_task => :last_task do |_task|
18
- attributes :task_id => :id
19
- attributes :status => :result
18
+ attributes :id
19
+ attributes :result => :result
20
20
  node :last_sync_words do |object|
21
- if object.try(:created_at)
22
- time_ago_in_words(Time.parse(object.created_at.to_s))
21
+ if object.try(:started_at)
22
+ time_ago_in_words(Time.parse(object.started_at.to_s))
23
23
  end
24
24
  end
25
25
  end
@@ -27,6 +27,7 @@ glue(@resource.root) do
27
27
  attributes :http_proxy_policy
28
28
  attributes :http_proxy_id
29
29
  attributes :http_proxy_name
30
+ attributes :retain_package_versions_count
30
31
 
31
32
  node :http_proxy do
32
33
  attributes :id => @resource.root&.http_proxy&.id, :name => @resource.root&.http_proxy&.name, :policy => @resource.root&.http_proxy_policy
@@ -8,12 +8,9 @@
8
8
  </div>
9
9
  <div class="col-md-8">
10
10
  <ul style="list-style-type: none; padding: 0">
11
- <% @smart_proxy.supported_pulp_types[:pulp3][:supported_types].each do |content_type| %>
11
+ <% @smart_proxy.supported_pulp_types.each do |content_type| %>
12
12
  <li><%= content_type %></li>
13
13
  <% end %>
14
- <% @smart_proxy.supported_pulp_types[:pulp3][:overriden_to_pulp2].each do |content_type| %>
15
- <li><%= content_type + " (supported, but overridden to use Pulp 2)" %></li>
16
- <% end %>
17
14
  </ul>
18
15
  </div>
19
- </div>
16
+ </div>
@@ -25,10 +25,3 @@
25
25
  <div class="col-md-4">
26
26
  <strong><%= _('Supported Content Types') %></strong>
27
27
  </div>
28
- <div class="col-md-8">
29
- <ul style="list-style-type: none; padding: 0">
30
- <% @smart_proxy.supported_pulp_types[:pulp2][:supported_types].each do |content_type| %>
31
- <li><%= content_type %></li>
32
- <% end %>
33
- </ul>
34
- </div>
@@ -1,15 +1,4 @@
1
1
  :katello:
2
- #if this block is not define, all types are enabled
3
- #types are defined in lib/katello/repository_types/*.rb
4
- :content_types:
5
- :yum: true
6
- :file: true
7
- :deb: true
8
- :puppet: true
9
- :docker: true
10
- :ostree: true
11
- :ansible_collection: true
12
-
13
2
  :rest_client_timeout: 30
14
3
  :gpg_strict_validation: false
15
4
 
@@ -42,10 +31,6 @@
42
31
  # :bulk_load_size: 1000
43
32
  # Setup your pulp environment here
44
33
  :pulp:
45
- # refers to the url of the pulp
46
- # example https://localhost/pulp/api
47
- :url: https://localhost/pulp/api/v2/
48
-
49
34
  :sync_threads: 4
50
35
  # refers to the apache certificate
51
36
  # (typically /etc/pki/tls/certs/localhost.crt) location that is needed
@@ -60,12 +45,6 @@
60
45
  :url: amqp:ssl:katello-devel.example.com:5671
61
46
  :subscriptions_queue_address: katello_event_queue
62
47
 
63
- # Internal configuration for communication from server to pulp crane service.
64
- :container_image_registry:
65
- :crane_url: https://localhost:5000
66
- :crane_ca_cert_file: /etc/pki/katello/certs/katello-server-ca.crt
67
- :allow_push: false # default false if omitted
68
-
69
48
  # Logging configuration can be changed by uncommenting the loggers
70
49
  # section and the logger configuration desired.
71
50
  #
@@ -63,6 +63,7 @@ Katello::Engine.routes.draw do
63
63
  end
64
64
 
65
65
  match '/content_views/:composite_content_view_id/content_view_components' => 'content_view_components#index', :via => :get
66
+ match '/content_views/:composite_content_view_id/content_view_components/show_all' => 'content_view_components#show_all', :via => :get
66
67
  match '/content_views/:composite_content_view_id/content_view_components/:id' => 'content_view_components#show', :via => :get
67
68
  match '/content_views/:composite_content_view_id/content_view_components/add' => 'content_view_components#add_components', :via => :put
68
69
  match '/content_views/:composite_content_view_id/content_view_components/remove' => 'content_view_components#remove_components', :via => :put
@@ -74,6 +75,7 @@ Katello::Engine.routes.draw do
74
75
  post :copy
75
76
  post :publish
76
77
  put :remove
78
+ put :remove_filters
77
79
  match '/environments/:environment_id' => "content_views#remove_from_environment", :via => :delete
78
80
  end
79
81
  api_resources :filters, :controller => :content_view_filters do
@@ -402,7 +404,6 @@ Katello::Engine.routes.draw do
402
404
  put :remove_content
403
405
  post :sync
404
406
  post :verify_checksum
405
- post :export
406
407
  post :upload_content
407
408
  put :import_uploads
408
409
  end