katello 4.3.0.rc1 → 4.3.0.rc2

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 (208) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +4 -0
  3. data/app/controllers/katello/api/v2/host_errata_controller.rb +5 -0
  4. data/app/controllers/katello/api/v2/host_packages_controller.rb +2 -0
  5. data/app/controllers/katello/api/v2/host_tracer_controller.rb +4 -0
  6. data/app/controllers/katello/api/v2/repository_sets_controller.rb +2 -2
  7. data/app/controllers/katello/api/v2/root_controller.rb +10 -19
  8. data/app/controllers/katello/concerns/api/v2/bulk_extensions.rb +3 -13
  9. data/app/controllers/katello/remote_execution_controller.rb +1 -1
  10. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -5
  11. data/app/lib/actions/katello/repository/destroy.rb +3 -3
  12. data/app/lib/actions/pulp/repository/sync.rb +0 -2
  13. data/app/lib/actions/pulp3/abstract_async_task.rb +16 -4
  14. data/app/lib/katello/resources/cdn.rb +10 -1
  15. data/app/models/katello/concerns/host_managed_extensions.rb +7 -4
  16. data/app/models/katello/concerns/smart_proxy_extensions.rb +6 -2
  17. data/app/models/katello/content_view_version.rb +1 -6
  18. data/app/models/katello/glue/pulp/repo.rb +1 -2
  19. data/app/models/katello/host_tracer.rb +2 -0
  20. data/app/models/katello/repository.rb +2 -30
  21. data/app/models/katello/root_repository.rb +3 -43
  22. data/app/presenters/katello/host_package_presenter.rb +21 -0
  23. data/app/services/katello/bulk_items_helper.rb +35 -0
  24. data/app/services/katello/smart_proxy_helper.rb +10 -1
  25. data/app/views/foreman/job_templates/install_errata.erb +8 -6
  26. data/app/views/foreman/job_templates/resolve_traces.erb +4 -5
  27. data/app/views/foreman/job_templates/resolve_traces_-_katello_ansible_default.erb +3 -5
  28. data/app/views/foreman/smart_proxies/_content_sync.html.erb +7 -0
  29. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +4 -0
  30. data/app/views/katello/api/v2/{organizations/cdn_configuration.rabl → cdn_configurations/show.json.rabl} +4 -0
  31. data/app/views/katello/api/v2/content_facet/show.json.rabl +8 -0
  32. data/app/views/katello/api/v2/content_view_filters/show.json.rabl +0 -1
  33. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  34. data/app/views/katello/api/v2/host_packages/base.json.rabl +2 -0
  35. data/app/views/katello/api/v2/organizations/show.json.rabl +1 -1
  36. data/app/views/katello/api/v2/repositories/show.json.rabl +0 -3
  37. data/config/routes/api/v2.rb +0 -10
  38. data/db/migrate/20211115215210_drop_ostree_branches.rb +13 -0
  39. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +0 -2
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +0 -3
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +0 -10
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +0 -3
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +0 -10
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-versions.module.js +0 -1
  45. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +0 -7
  46. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/content.service.js +0 -5
  47. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +0 -1
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.routes.js +0 -11
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js +1 -2
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -4
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +0 -10
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +3 -6
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +4 -1
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +1 -0
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repositories.routes.js +0 -9
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +0 -8
  58. data/engines/bastion_katello/lib/bastion_katello/engine.rb +0 -1
  59. data/lib/katello/permission_creator.rb +0 -1
  60. data/lib/katello/plugin.rb +0 -10
  61. data/lib/katello/tasks/reset.rake +2 -2
  62. data/lib/katello/version.rb +1 -1
  63. data/webpack/components/Packages/index.js +63 -0
  64. data/webpack/components/Search/Search.js +7 -1
  65. data/webpack/components/SelectAllCheckbox/index.js +2 -2
  66. data/webpack/components/Table/MainTable.scss +7 -1
  67. data/webpack/components/Table/TableHooks.js +10 -19
  68. data/webpack/components/Table/TableWrapper.js +0 -2
  69. data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +3 -3
  70. data/webpack/components/extensions/HostDetails/HostDetailsConstants.js +1 -0
  71. data/webpack/components/extensions/HostDetails/HostDetailsSelectors.js +16 -0
  72. data/webpack/components/extensions/HostDetails/HostErrata/HostErrataConstants.js +2 -0
  73. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesActions.js +11 -0
  74. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesConstants.js +2 -0
  75. data/webpack/components/extensions/HostDetails/HostPackages/HostPackagesSelectors.js +16 -0
  76. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +4 -0
  77. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/constants.js +1 -0
  78. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.js +119 -25
  79. data/webpack/components/extensions/HostDetails/Tabs/HostTracesConstants.js +1 -0
  80. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +127 -0
  81. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.scss +11 -0
  82. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +30 -4
  83. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
  84. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsActions.js +73 -0
  85. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsConstants.js +2 -0
  86. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsSelectors.js +16 -0
  87. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +347 -0
  88. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.scss +7 -0
  89. data/webpack/components/extensions/HostDetails/Tabs/TracesTab.js +38 -31
  90. data/webpack/components/extensions/HostDetails/Tabs/__tests__/bookmarks.fixtures.json +12 -0
  91. data/webpack/components/extensions/HostDetails/Tabs/__tests__/contentOverrides.fixtures.json +227 -0
  92. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +423 -2
  93. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packages.fixtures.json +28 -0
  94. data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +91 -0
  95. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySets.fixtures.json +120 -0
  96. data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +307 -0
  97. data/webpack/components/extensions/HostDetails/Tabs/__tests__/resolveErrata.fixtures.json +35 -0
  98. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +55 -9
  99. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +28 -14
  100. data/webpack/containers/Application/overrides.scss +31 -9
  101. data/webpack/global_index.js +4 -2
  102. data/webpack/redux/reducers/RedHatRepositories/enabled.fixtures.js +0 -2
  103. data/webpack/scenes/Content/ContentConfig.js +23 -7
  104. data/webpack/scenes/ContentCredentials/ContentCredentialActions.js +18 -0
  105. data/webpack/scenes/ContentCredentials/ContentCredentialConstants.js +2 -0
  106. data/webpack/scenes/ContentCredentials/ContentCredentialSelectors.js +12 -0
  107. data/webpack/scenes/ContentCredentials/__tests__/contentCredentials.fixtures.js +73 -0
  108. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +1 -1
  109. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +3 -3
  110. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +7 -2
  111. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.scss +7 -0
  112. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +9 -9
  113. data/webpack/scenes/ContentViews/Delete/ContentViewDeleteWizard.js +6 -6
  114. data/webpack/scenes/ContentViews/Delete/Steps/CVDeleteEnvironmentsSelection.js +39 -37
  115. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReview.js +35 -33
  116. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +7 -5
  117. data/webpack/scenes/ContentViews/Delete/__tests__/cvVersionsData.fixtures.json +2 -6
  118. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentEnvironments.js +13 -14
  119. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +18 -9
  120. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +3 -2
  121. data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +1 -2
  122. data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +1 -1
  123. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewErrataByDateDetails.fixtures.json +1 -8
  124. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetail.fixtures.json +1 -2
  125. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +3 -8
  126. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvAllRepos.fixtures.json +0 -2
  127. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErratumFilterDetails.fixtures.json +1 -2
  128. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailModuleAffectedRepos.fixtures.json +1 -8
  129. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvFilterDetailWithAffectedRepos.fixtures.json +1 -8
  130. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilterDetails.fixtures.json +1 -2
  131. data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvPackageFilterDetail.fixtures.json +1 -3
  132. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +44 -28
  133. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +2 -1
  134. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +1 -1
  135. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +46 -8
  136. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +0 -2
  137. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +19 -3
  138. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionEnvironments.js +2 -2
  139. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.js +5 -3
  140. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.scss +5 -2
  141. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +7 -4
  142. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVEnvironmentSelectionForm.js +59 -53
  143. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionRemoveReview.js +24 -17
  144. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/versionsResponseData.fixtures.json +1 -4
  145. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionRepositoryCell.js +8 -3
  146. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionComponent.fixtures.json +1 -4
  147. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.fixtures.json +1 -2
  148. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsCounts.fixtures.json +1 -2
  149. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionRepositories.fixtures.json +1 -18
  150. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.fixtures.json +5 -5
  151. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +1 -0
  152. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +1 -3
  153. data/webpack/scenes/ContentViews/Details/contentViewInfo.scss +0 -4
  154. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +66 -53
  155. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +40 -28
  156. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +3 -3
  157. data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +14 -14
  158. data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +6 -0
  159. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -12
  160. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +12 -6
  161. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -6
  162. data/webpack/scenes/ContentViews/components/ContentViewIcon.js +6 -5
  163. data/webpack/scenes/ContentViews/components/ContentViewsCounter.js +2 -2
  164. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +26 -27
  165. data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +18 -6
  166. data/webpack/scenes/ContentViews/components/WizardHeader.js +44 -0
  167. data/webpack/scenes/ContentViews/components/contentViewIcon.scss +13 -2
  168. data/webpack/scenes/Organizations/OrganizationActions.js +22 -24
  169. data/webpack/scenes/Organizations/OrganizationConstants.js +1 -3
  170. data/webpack/scenes/Organizations/OrganizationReducer.js +0 -7
  171. data/webpack/scenes/Organizations/OrganizationSelectors.js +16 -0
  172. data/webpack/scenes/Organizations/__tests__/OrganizationActions.test.js +1 -21
  173. data/webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js +0 -20
  174. data/webpack/scenes/Organizations/__tests__/organizations.fixtures.js +34 -23
  175. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +151 -14
  176. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +150 -31
  177. data/webpack/scenes/Subscriptions/Manifest/index.js +14 -3
  178. data/webpack/utils/dateTimeHelpers.js +7 -0
  179. data/webpack/utils/helpers.js +1 -1
  180. metadata +45 -43
  181. data/app/controllers/katello/api/v2/ostree_branches_controller.rb +0 -16
  182. data/app/lib/actions/pulp/repository/presenters/ostree_presenter.rb +0 -91
  183. data/app/models/katello/ostree_branch.rb +0 -12
  184. data/app/models/katello/repository_ostree_branch.rb +0 -7
  185. data/app/services/katello/pulp/ostree_branch.rb +0 -14
  186. data/app/services/katello/pulp/repository/ostree.rb +0 -48
  187. data/app/views/katello/api/v2/ostree_branches/compare.json.rabl +0 -10
  188. data/app/views/katello/api/v2/ostree_branches/index.json.rabl +0 -7
  189. data/app/views/katello/api/v2/ostree_branches/show.json.rabl +0 -5
  190. data/app/views/katello/api/v2/root/resource_list.json.rabl +0 -3
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-ostree-branches.html +0 -26
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +0 -27
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch-repositories.controller.js +0 -77
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branch.controller.js +0 -31
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-info.html +0 -15
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-repositories.html +0 -72
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch.html +0 -30
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branch.factory.js +0 -27
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.controller.js +0 -67
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.module.js +0 -15
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.routes.js +0 -50
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches.html +0 -40
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-ostree-branches.html +0 -40
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/ostree-upstream-sync-policy.service.js +0 -26
  205. data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +0 -12
  206. data/webpack/scenes/Content/Details/ContentCounts.js +0 -42
  207. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +0 -108
  208. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +0 -158
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf975eaf437422cc7622770087b3b996c0834bb4d0077de55ed4748670c888d2
4
- data.tar.gz: a6fbabac90eeed02b2b4a404e1c2d8af1cb245c083daf5981e2471ca035157b5
3
+ metadata.gz: f0f8ba091ba332e76f76b544ef424c77aa3a38b6b787e8f8f8b36ab1440e25af
4
+ data.tar.gz: 6f756d679f8b06257ed6b378832b657af76498831e8e22b28a46ae700e228e1e
5
5
  SHA512:
6
- metadata.gz: d349265901e8142d15ad6ee35fcf6045bec5cbc8197799b9f8b8fac3edbdb29433a40f774345118a86a598587b5656e04aa9f20263cdb81ed388c9f373414a55
7
- data.tar.gz: ee28f705628e3ff302918e2bf30ba5a78addc92454937fe43fc34ed2f48b4388f1f1294c630899884afb0d6071bc9ec733843b52175c1af5ef90160759d0f814
6
+ metadata.gz: 559529864f4cdb5816256466bcf41b19eaaea681003163b55740760ff264475d20e3a786da8e57faae43580550ead9e6850b72935addca224c20d85264e2ef9d
7
+ data.tar.gz: a699a711de49a1212a50e24cb7661e310723581a501bb74633ef4f41c062546362631588269452e9d54e39f2a809dc1c5d2a10fa4067f2ba1265fa5e3909a372
@@ -134,6 +134,10 @@ module Katello
134
134
  scoped_search_results(query: blank_query, page: page, per_page: per_page, error: message)
135
135
  end
136
136
 
137
+ def skip_session
138
+ request.session_options[:skip] = true
139
+ end
140
+
137
141
  protected
138
142
 
139
143
  def scoped_search_query(query, group)
@@ -63,6 +63,7 @@ module Katello
63
63
  param :errata_ids, Array, :desc => N_("List of Errata ids to install. Will be removed in %s") % katello_agent_removal_release, required: true
64
64
 
65
65
  param_group :bulk_errata_ids
66
+ param_group :search, Api::V2::ApiController
66
67
  def apply
67
68
  task = async_task(::Actions::Katello::Host::Erratum::Install, @host, content: @errata_ids)
68
69
  respond_for_async :resource => task
@@ -143,7 +144,11 @@ module Katello
143
144
  missing = params[:errata_ids] - Erratum.where(:errata_id => params[:errata_ids]).pluck(:errata_id)
144
145
  fail HttpErrors::NotFound, _("Couldn't find errata ids '%s'") % missing.to_sentence if missing.any?
145
146
  @errata_ids = params[:errata_ids]
147
+ elsif params[:search]
148
+ @errata_ids = @host.advisory_ids(search: params[:search])
146
149
  else
150
+ # old angular way
151
+ # Todo: remove this when the old content-host errata page is removed
147
152
  @errata_ids = find_bulk_errata_ids([@host], params[:bulk_errata_ids])
148
153
  end
149
154
  end
@@ -20,10 +20,12 @@ module Katello
20
20
 
21
21
  api :GET, "/hosts/:host_id/packages", N_("List packages installed on the host")
22
22
  param :host_id, :number, :required => true, :desc => N_("ID of the host")
23
+ param :include_latest_upgradable, :boolean, :desc => N_("Also include the latest upgradable package version for each host package")
23
24
  param_group :search, Api::V2::ApiController
24
25
  add_scoped_search_description_for(Katello::InstalledPackage)
25
26
  def index
26
27
  collection = scoped_search(index_relation, :name, :asc, :resource_class => ::Katello::InstalledPackage)
28
+ collection[:results] = HostPackagePresenter.with_latest(collection[:results], @host) if ::Foreman::Cast.to_bool(params[:include_latest_upgradable])
27
29
  respond_for_index(:collection => collection)
28
30
  end
29
31
 
@@ -35,6 +35,10 @@ module Katello
35
35
  @host.host_traces
36
36
  end
37
37
 
38
+ def total_selectable(query)
39
+ query.where(:id => @host.host_traces.selectable).count
40
+ end
41
+
38
42
  private
39
43
 
40
44
  def find_host
@@ -28,8 +28,8 @@ module Katello
28
28
  param :with_custom, :bool, :required => false, :desc => N_("If true, return custom repository sets along with redhat repos")
29
29
  param :activation_key_id, :number, :desc => N_("activation key identifier"), :required => false
30
30
  param :host_id, :number, :desc => N_("Id of the host"), :required => false
31
- param :content_access_mode_all, :bool, :desc => N_("Get all content available, not just that provided by subscriptions. Relevant for Activation Keys only")
32
- param :content_access_mode_env, :bool, :desc => N_("Limit content to just that available in the activation key's content view version. Relevant for Activation Keys only")
31
+ param :content_access_mode_all, :bool, :desc => N_("Get all content available, not just that provided by subscriptions.")
32
+ param :content_access_mode_env, :bool, :desc => N_("Limit content to just that available in the host's or activation key's content view version and lifecycle environment.")
33
33
  param_group :search, Api::V2::ApiController
34
34
  add_scoped_search_description_for(Katello::ProductContent)
35
35
  def index
@@ -1,35 +1,28 @@
1
1
  module Katello
2
2
  class Api::V2::RootController < Api::V2::ApiController
3
3
  skip_before_action :authorize # ok - only shows URLs available
4
+ skip_before_action :load_settings # no Settings used here, avoid DB calls
5
+ after_action :skip_session
4
6
 
5
7
  resource_description do
6
8
  api_version 'v2'
7
9
  api_base_url "/katello/api"
8
10
  end
9
11
 
10
- def resource_list
11
- all_routes = Engine.routes.routes
12
- all_routes = all_routes.collect { |r| r.path.spec.to_s }
13
-
14
- api_root_routes = all_routes.select do |path|
15
- path =~ %r{^/katello/api(\(/:api_version\))?/[^/]+/:id\(\.:format\)$}
16
- end
17
- api_root_routes = api_root_routes.collect do |path|
18
- path = path.sub("(/:api_version)", "")
19
- path[0..-(":id(.:format)".length + 1)]
20
- end
21
-
22
- api_root_routes.collect! { |r| { :rel => r["/katello/api/".size..-2], :href => r } }
23
-
24
- respond_for_index :collection => api_root_routes
25
- end
26
-
27
12
  def rhsm_resource_list
28
13
  # The RHSM resource list is required to interact with RHSM on the client.
29
14
  # When requested, it will return a list of the resources (href & rel) defined by katello
30
15
  # for the /rhsm namespace. The rel values are used by RHSM to determine if the server
31
16
  # supports a particular resource (e.g. environments, guestids, organizations..etc)
32
17
 
18
+ render json: self.class.rhsm_resource_list
19
+ end
20
+
21
+ def self.rhsm_resource_list
22
+ @rhsm_resource_list ||= generate_rhsm_resource_list
23
+ end
24
+
25
+ def self.generate_rhsm_resource_list
33
26
  all_routes = Engine.routes.routes.collect { |r| r.path.spec.to_s }
34
27
 
35
28
  api_routes = all_routes.select do |path|
@@ -53,8 +46,6 @@ module Katello
53
46
 
54
47
  api_routes.uniq!
55
48
  api_routes.collect! { |r| { :rel => r.split('/').last, :href => r } }
56
-
57
- respond_for_index :collection => api_routes, :template => 'resource_list'
58
49
  end
59
50
  end
60
51
  end
@@ -8,7 +8,6 @@ module Katello
8
8
  bulk_params = ActiveSupport::JSON.decode(bulk_params).
9
9
  deep_symbolize_keys
10
10
  end
11
-
12
11
  bulk_params[:included] ||= {}
13
12
  bulk_params[:excluded] ||= {}
14
13
 
@@ -22,18 +21,9 @@ module Katello
22
21
  fail HttpErrors::BadRequest, _("Sending a list of included IDs is not allowed when all items are being selected.")
23
22
  end
24
23
 
25
- items = model_scope
26
- if bulk_params[:included][:ids]
27
- items = model_scope.where(key => bulk_params[:included][:ids])
28
- elsif bulk_params[:included][:search]
29
- items = model_scope.search_for(bulk_params[:included][:search])
30
- end
31
-
32
- if bulk_params[:excluded][:ids]
33
- items = items.where.not(key => bulk_params[:excluded][:ids])
34
- end
35
-
36
- items
24
+ ::Katello::BulkItemsHelper.new(bulk_params: bulk_params,
25
+ model_scope: model_scope,
26
+ key: key).fetch
37
27
  end
38
28
  end
39
29
  end
@@ -48,7 +48,7 @@ module Katello
48
48
 
49
49
  def inputs
50
50
  if feature_name == 'katello_errata_install'
51
- { :errata => errata_inputs }
51
+ { "Errata Search Query" => "errata_id ^ (#{errata_inputs.join(',')})" }
52
52
  elsif feature_name == 'katello_service_restart'
53
53
  { :helper => params[:name] }
54
54
  elsif feature_name == 'katello_module_stream_action'
@@ -3,6 +3,7 @@ module Actions
3
3
  module CapsuleContent
4
4
  class SyncCapsule < ::Actions::EntryAction
5
5
  include Actions::Katello::PulpSelector
6
+ # rubocop:disable Metrics/MethodLength
6
7
  def plan(smart_proxy, options = {})
7
8
  plan_self(:smart_proxy_id => smart_proxy.id)
8
9
  action_subject(smart_proxy)
@@ -17,11 +18,11 @@ module Actions
17
18
  repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
18
19
  concurrence do
19
20
  repo_batch.each do |repo|
20
- plan_pulp_action(
21
- [Actions::Pulp::Orchestration::Repository::SmartProxySync,
22
- Actions::Pulp3::CapsuleContent::Sync],
23
- repo, smart_proxy,
24
- skip_metadata_check: skip_metadata_check)
21
+ if smart_proxy.backend_service_type(repo) == Actions::Pulp3::Abstract::BACKEND_SERVICE_TYPE
22
+ plan_action(Actions::Pulp3::CapsuleContent::Sync,
23
+ repo, smart_proxy,
24
+ skip_metadata_check: skip_metadata_check)
25
+ end
25
26
  end
26
27
  end
27
28
 
@@ -39,6 +40,7 @@ module Actions
39
40
  end
40
41
  end
41
42
  end
43
+ # rubocop:enable Metrics/MethodLength
42
44
 
43
45
  def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
44
46
  smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
@@ -37,7 +37,7 @@ module Actions
37
37
  handle_redhat_content(repository) unless skip_environment_update
38
38
  else
39
39
  if destroy_content && !skip_environment_update
40
- handle_custom_content(repository)
40
+ handle_custom_content(repository, remove_from_content_view_versions)
41
41
  end
42
42
  end
43
43
  end
@@ -57,9 +57,9 @@ module Actions
57
57
  end
58
58
  end
59
59
 
60
- def handle_custom_content(repository)
60
+ def handle_custom_content(repository, remove_from_content_view_versions)
61
61
  #if this is the last instance of a custom repo, destroy the content
62
- if repository.root.repositories.where.not(id: repository.id).empty?
62
+ if remove_from_content_view_versions || repository.root.repositories.where.not(id: repository.id).empty?
63
63
  plan_action(::Actions::Katello::Product::ContentDestroy, repository.root)
64
64
  end
65
65
  end
@@ -77,8 +77,6 @@ module Actions
77
77
  Presenters::FileUnitPresenter.new(self)
78
78
  elsif repo.try(:docker?)
79
79
  Presenters::DockerPresenter.new(self)
80
- elsif repo.try(:ostree?)
81
- Presenters::OstreePresenter.new(self)
82
80
  elsif repo.try(:deb?)
83
81
  Presenters::DebPresenter.new(self)
84
82
  end
@@ -46,7 +46,7 @@ module Actions
46
46
  end
47
47
 
48
48
  def combined_tasks
49
- return nil if pulp_tasks.nil? || task_groups.nil?
49
+ return nil if pulp_tasks.nil? && task_groups.nil?
50
50
  pulp_tasks + task_groups
51
51
  end
52
52
 
@@ -120,11 +120,23 @@ module Actions
120
120
  end
121
121
 
122
122
  def external_task=(external_task_data)
123
- #currently we assume everything coming from invoke_external_task_methods are tasks
124
123
  tasks = transform_task_response(external_task_data)
125
- output[:pulp_tasks] = new_or_existing_objects(::Katello::Pulp3::Task, tasks)
124
+ output[:pulp_tasks] = [] if output[:pulp_tasks].nil?
125
+ output[:task_groups] = [] if output[:task_groups].nil?
126
+ if tasks.detect { |task| task['task'] || (task['pulp_href'] && !task['tasks']) }
127
+ output[:pulp_tasks] = new_or_existing_objects(::Katello::Pulp3::Task, tasks)
128
+ add_task_groups
129
+ else
130
+ output[:pulp_tasks] = []
131
+ tasks.each do |task|
132
+ if task['task_group']
133
+ output[:task_groups] << ::Katello::Pulp3::TaskGroup.new_from_href(smart_proxy, task['task_group'])
134
+ elsif task['pulp_href'] && task['tasks']
135
+ output[:task_groups] << ::Katello::Pulp3::TaskGroup.new_from_href(smart_proxy, task['pulp_href'])
136
+ end
137
+ end
138
+ end
126
139
 
127
- add_task_groups
128
140
  check_for_errors
129
141
  end
130
142
 
@@ -41,7 +41,12 @@ module Katello
41
41
  :ssl_ca_cert)
42
42
 
43
43
  if options[:ssl_ca_cert].present?
44
- ca_cert = OpenSSL::X509::Certificate.new(options[:ssl_ca_cert])
44
+ begin
45
+ ca_cert = OpenSSL::X509::Certificate.new(options[:ssl_ca_cert])
46
+ rescue
47
+ raise _("Invalid SSL CA certificate given for CDN")
48
+ end
49
+
45
50
  @cert_store = OpenSSL::X509::Store.new
46
51
  @cert_store.add_cert(ca_cert)
47
52
  end
@@ -112,6 +117,7 @@ module Katello
112
117
  net
113
118
  end
114
119
 
120
+ # rubocop:disable Metrics/MethodLength
115
121
  def get(path, _headers = {})
116
122
  net = http_downloader
117
123
  path = File.join(@uri.request_uri, path)
@@ -140,6 +146,8 @@ module Katello
140
146
  fail exception_class.new(nil, code)
141
147
  end
142
148
  end
149
+ rescue SocketError
150
+ raise _("Couldn't establish a connection to %s") % @uri
143
151
  rescue EOFError
144
152
  raise RestClient::ServerBrokeConnection
145
153
  rescue Timeout::Error
@@ -152,6 +160,7 @@ module Katello
152
160
  raise Errors::SecurityViolation, _("CDN loading error: access forbidden to %s") % used_url
153
161
  end
154
162
  end
163
+ # rubocop:enable Metrics/MethodLength
155
164
 
156
165
  def valid_path?(path, postfix)
157
166
  get(File.join(path, postfix)).present?
@@ -383,12 +383,15 @@ module Katello
383
383
  @traces_status_label ||= get_status(::Katello::TraceStatus).to_label(options)
384
384
  end
385
385
 
386
- def traces_helpers(ids = nil)
387
- traces = host_traces
388
- traces = host_traces.where(id: ids) if ids.present?
386
+ def traces_helpers(search:)
387
+ traces = host_traces.selectable.search_for(search)
389
388
  ::Katello::HostTracer.helpers_for(traces)
390
389
  end
391
390
 
391
+ def advisory_ids(search:)
392
+ ::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
393
+ end
394
+
392
395
  def valid_content_override_label?(content_label)
393
396
  available_content = subscription_facet.candlepin_consumer.available_product_content
394
397
  available_content.map(&:content).any? { |content| content.label == content_label }
@@ -411,7 +414,7 @@ end
411
414
  class ::Host::Managed::Jail < Safemode::Jail
412
415
  allow :content_source, :subscription_manager_configuration_url, :rhsm_organization_label,
413
416
  :host_collections, :pools, :hypervisor_host, :lifecycle_environment, :content_view,
414
- :installed_packages, :traces_helpers
417
+ :installed_packages, :traces_helpers, :advisory_ids
415
418
  end
416
419
 
417
420
  class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
@@ -423,7 +423,7 @@ module Katello
423
423
  repos = Katello::Repository
424
424
  repos = repos.in_environment(environment) if environment
425
425
  repos = repos.in_content_views([content_view]) if content_view
426
- repos
426
+ repos.respond_to?(:to_a) ? repos : repos.none
427
427
  end
428
428
 
429
429
  def repos_in_sync_history
@@ -444,7 +444,11 @@ module Katello
444
444
  end
445
445
 
446
446
  def rhsm_url
447
- if pulp_primary?
447
+ # Since Foreman 3.1 this setting is set
448
+ if (rhsm_url = setting(SmartProxy::PULP3_FEATURE, 'rhsm_url'))
449
+ rhsm_url
450
+ # Compatibility fall back
451
+ elsif pulp_primary?
448
452
  "https://#{URI.parse(url).host}/rhsm"
449
453
  elsif pulp_mirror?
450
454
  "https://#{URI.parse(url).host}:8443/rhsm"
@@ -314,10 +314,6 @@ module Katello
314
314
  FileUnit.in_repositories(archived_repos)
315
315
  end
316
316
 
317
- def ostree_branches
318
- OstreeBranch.in_repositories(archived_repos)
319
- end
320
-
321
317
  def docker_manifests
322
318
  DockerManifest.in_repositories(archived_repos)
323
319
  end
@@ -357,8 +353,7 @@ module Katello
357
353
  update_content_counts! if content_counts.blank?
358
354
  counts = Hash[content_counts.map { |key, value| ["#{key}_count", value] }]
359
355
  counts.merge("module_stream_count" => counts["modulemd_count"],
360
- "package_count" => counts["rpm_count"],
361
- "ostree_branch_count" => counts["ostree_count"])
356
+ "package_count" => counts["rpm_count"])
362
357
  end
363
358
 
364
359
  def check_ready_to_promote!(to_env)
@@ -90,8 +90,7 @@ module Katello
90
90
  errata.count != pulp_counts['erratum'].to_i ||
91
91
  package_groups.count != pulp_counts['package_group'].to_i ||
92
92
  docker_manifests.count != pulp_counts['docker_manifest'].to_i ||
93
- docker_tags.count != pulp_counts['docker_tag'].to_i ||
94
- ostree_branches.count != pulp_counts['ostree'].to_i
93
+ docker_tags.count != pulp_counts['docker_tag'].to_i
95
94
  end
96
95
 
97
96
  def empty_in_pulp?
@@ -5,10 +5,12 @@ module Katello
5
5
  belongs_to :host, :inverse_of => :host_traces, :class_name => '::Host::Managed'
6
6
 
7
7
  scope :reboot_required, -> { where(app_type: 'static') }
8
+ scope :selectable, -> { where.not(app_type: 'session') }
8
9
 
9
10
  validates :application, :length => {:maximum => 255}, :presence => true
10
11
  validates :app_type, :length => {:maximum => 255}, :presence => true
11
12
 
13
+ scoped_search :on => :id, :only_explicit => true
12
14
  scoped_search :on => :application, :complete_value => true
13
15
  scoped_search :on => :app_type, :complete_value => true
14
16
  scoped_search :on => :helper, :complete_value => true
@@ -79,9 +79,6 @@ module Katello
79
79
  has_many :repository_docker_meta_tags, :class_name => "Katello::RepositoryDockerMetaTag", :dependent => :delete_all
80
80
  has_many :docker_meta_tags, :through => :repository_docker_meta_tags
81
81
 
82
- has_many :repository_ostree_branches, :class_name => "Katello::RepositoryOstreeBranch", :dependent => :delete_all
83
- has_many :ostree_branches, :through => :repository_ostree_branches
84
-
85
82
  has_many :repository_debs, :class_name => "Katello::RepositoryDeb", :dependent => :delete_all
86
83
  has_many :debs, :through => :repository_debs
87
84
 
@@ -178,7 +175,7 @@ module Katello
178
175
  delegate :name, :created_at, :updated_at, :major, :minor, :gpg_key_id, :gpg_key, :arch, :label, :url, :unprotected,
179
176
  :content_type, :product_id, :checksum_type, :docker_upstream_name, :mirror_on_sync, :"mirror_on_sync?",
180
177
  :download_policy, :verify_ssl_on_sync, :"verify_ssl_on_sync?", :upstream_username, :upstream_password,
181
- :upstream_authentication_token, :ostree_upstream_sync_policy, :ostree_upstream_sync_depth, :deb_releases,
178
+ :upstream_authentication_token, :deb_releases,
182
179
  :deb_components, :deb_architectures, :ssl_ca_cert_id, :ssl_ca_cert, :ssl_client_cert, :ssl_client_cert_id,
183
180
  :ssl_client_key_id, :os_versions, :ssl_client_key, :ignorable_content, :description, :docker_tags_whitelist,
184
181
  :ansible_collection_requirements, :ansible_collection_auth_url, :ansible_collection_auth_token,
@@ -259,13 +256,7 @@ module Katello
259
256
  end
260
257
 
261
258
  def self.undisplayable_types
262
- ret = [::Katello::Repository::CANDLEPIN_DOCKER_TYPE]
263
-
264
- unless ::Katello::RepositoryTypeManager.enabled?(Repository::OSTREE_TYPE)
265
- ret << ::Katello::Repository::CANDLEPIN_OSTREE_TYPE
266
- end
267
-
268
- ret
259
+ [::Katello::Repository::CANDLEPIN_DOCKER_TYPE]
269
260
  end
270
261
 
271
262
  def self.in_organization(org)
@@ -693,10 +684,6 @@ module Katello
693
684
  end
694
685
  end
695
686
 
696
- def ostree_branch_names
697
- self.ostree_branches.map(&:name)
698
- end
699
-
700
687
  def units_for_removal(ids, type_class = nil)
701
688
  removable_unit_association = unit_type_for_removal(type_class)
702
689
  table_name = removable_unit_association.table_name
@@ -739,21 +726,6 @@ module Katello
739
726
  }
740
727
  end
741
728
 
742
- def check_duplicate_branch_names(branch_names)
743
- dupe_branch_checker = {}
744
- dupe_branch_checker.default = 0
745
- branch_names.each do |branch|
746
- dupe_branch_checker[branch] += 1
747
- end
748
-
749
- duplicate_branch_names = dupe_branch_checker.select { |_, value| value > 1 }.keys
750
-
751
- unless duplicate_branch_names.empty?
752
- fail ::Katello::Errors::ConflictException,
753
- _("Duplicate branches specified - %{branches}") % { branches: duplicate_branch_names.join(", ")}
754
- end
755
- end
756
-
757
729
  # deleteable? is already taken by the authorization mixin
758
730
  def destroyable?(remove_from_content_view_versions = false)
759
731
  if self.environment.try(:library?) && self.content_view.default?
@@ -18,18 +18,10 @@ module Katello
18
18
  IGNORABLE_CONTENT_UNIT_TYPES = %w(srpm).freeze
19
19
  CHECKSUM_TYPES = %w(sha1 sha256).freeze
20
20
 
21
- OSTREE_UPSTREAM_SYNC_POLICY_LATEST = "latest".freeze
22
- OSTREE_UPSTREAM_SYNC_POLICY_ALL = "all".freeze
23
- OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM = "custom".freeze
24
- OSTREE_UPSTREAM_SYNC_POLICIES = [OSTREE_UPSTREAM_SYNC_POLICY_LATEST, OSTREE_UPSTREAM_SYNC_POLICY_ALL, OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM].freeze
25
-
26
21
  SUBSCRIBABLE_TYPES = [Repository::YUM_TYPE, Repository::OSTREE_TYPE, Repository::DEB_TYPE].freeze
27
22
 
28
23
  CONTENT_ATTRIBUTE_RESTRICTIONS = {
29
- :ostree_upstream_sync_depth => [Repository::OSTREE_TYPE],
30
- :ostree_upstream_sync_policy => [Repository::OSTREE_TYPE],
31
24
  :download_policy => [Repository::YUM_TYPE, Repository::DEB_TYPE]
32
-
33
25
  }.freeze
34
26
 
35
27
  NO_DEFAULT_HTTP_PROXY = 'none'.freeze
@@ -43,7 +35,8 @@ module Katello
43
35
  RHEL6 = 'rhel-6'.freeze
44
36
  RHEL7 = 'rhel-7'.freeze
45
37
  RHEL8 = 'rhel-8'.freeze
46
- ALLOWED_OS_VERSIONS = [RHEL6, RHEL7, RHEL8].freeze
38
+ RHEL9 = 'rhel-9'.freeze
39
+ ALLOWED_OS_VERSIONS = [RHEL6, RHEL7, RHEL8, RHEL9].freeze
47
40
 
48
41
  belongs_to :product, :inverse_of => :root_repositories, :class_name => "Katello::Product"
49
42
  has_one :provider, :through => :product
@@ -59,8 +52,6 @@ module Katello
59
52
  has_many :repository_references, :class_name => 'Katello::Pulp3::RepositoryReference', :foreign_key => :root_repository_id,
60
53
  :dependent => :destroy, :inverse_of => :root_repository
61
54
 
62
- before_validation :update_ostree_upstream_sync_policy
63
-
64
55
  validates_lengths_from_database :except => [:label]
65
56
  validates_with Validators::KatelloLabelFormatValidator, :attributes => :label
66
57
  validates_with Validators::KatelloNameFormatValidator, :attributes => :name
@@ -86,9 +77,6 @@ module Katello
86
77
  validates :url, presence: true, if: :ostree?
87
78
  validates :checksum_type, :inclusion => {:in => CHECKSUM_TYPES}, :allow_blank => true
88
79
  validates :product_id, :presence => true
89
- validates :ostree_upstream_sync_policy, :inclusion => {:in => OSTREE_UPSTREAM_SYNC_POLICIES, :allow_blank => true}, :if => :ostree?
90
- validates :ostree_upstream_sync_depth, :presence => true, :numericality => { :only_integer => true },
91
- :if => proc { |r| r.ostree? && r.ostree_upstream_sync_policy == OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM }
92
80
  validates :content_type, :inclusion => {
93
81
  :in => ->(_) { Katello::RepositoryTypeManager.enabled_repository_types.keys },
94
82
  :allow_blank => false,
@@ -203,34 +191,6 @@ module Katello
203
191
  end
204
192
  end
205
193
 
206
- def update_ostree_upstream_sync_policy
207
- return unless ostree?
208
- if self.ostree_upstream_sync_policy.blank?
209
- self.ostree_upstream_sync_policy = OSTREE_UPSTREAM_SYNC_POLICY_LATEST
210
- end
211
-
212
- if self.ostree_upstream_sync_policy_changed? &&
213
- previous_changes[:ostree_upstream_sync_policy].present?
214
- self.ostree_upstream_sync_depth = nil unless self.ostree_upstream_sync_policy == OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM
215
- end
216
- end
217
-
218
- def compute_ostree_upstream_sync_depth
219
- if ostree_upstream_sync_policy == OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM
220
- ostree_upstream_sync_depth
221
- elsif ostree_upstream_sync_policy == OSTREE_UPSTREAM_SYNC_POLICY_ALL
222
- -1
223
- else
224
- 0
225
- end
226
- end
227
-
228
- def ensure_no_ostree_upstream_sync_policy
229
- if !ostree? && ostree_upstream_sync_policy.present?
230
- errors.add(:ostree_upstream_sync_policy, N_("cannot be set for non-ostree repositories."))
231
- end
232
- end
233
-
234
194
  def ensure_valid_ignorable_content
235
195
  return if ignorable_content.blank?
236
196
  if !yum?
@@ -372,7 +332,7 @@ module Katello
372
332
 
373
333
  def pulp_update_needed?
374
334
  changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirror_on_sync verify_ssl_on_sync
375
- upstream_username upstream_password ostree_upstream_sync_policy ostree_upstream_sync_depth ignorable_content
335
+ upstream_username upstream_password ignorable_content
376
336
  ssl_ca_cert_id ssl_client_cert_id ssl_client_key_id http_proxy_policy http_proxy_id download_concurrency)
377
337
  changeable_attributes += %w(name container_repository_name docker_tags_whitelist) if docker?
378
338
  changeable_attributes += %w(deb_releases deb_components deb_architectures gpg_key_id) if deb?
@@ -0,0 +1,21 @@
1
+ module Katello
2
+ class HostPackagePresenter < SimpleDelegator
3
+ attr_accessor :installed_package, :upgradable_version, :rpm_id
4
+
5
+ def initialize(installed_package, upgradable_version, rpm_id)
6
+ @installed_package = installed_package
7
+ @upgradable_version = upgradable_version
8
+ @rpm_id = rpm_id
9
+ super(@installed_package)
10
+ end
11
+
12
+ def self.with_latest(packages, host)
13
+ upgradable_packages_map = ::Katello::Rpm.installable_for_hosts([host]).select(:id, :name, :nvra, :evr).order(evr: :desc).all.group_by(&:name)
14
+ installed_packages_map = ::Katello::Rpm.where(nvra: packages.map(&:nvra)).select(:id, :name).group_by(&:name)
15
+
16
+ packages.map do |p|
17
+ HostPackagePresenter.new(p, upgradable_packages_map[p.name]&.first&.nvra, installed_packages_map[p.name]&.first&.id)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,35 @@
1
+ module Katello
2
+ class BulkItemsHelper
3
+ attr_reader :bulk_params, :model_scope, :key
4
+
5
+ def initialize(bulk_params:, model_scope:, key: :id)
6
+ @bulk_params = bulk_params
7
+
8
+ if @bulk_params.is_a?(String)
9
+ @bulk_params = ActiveSupport::JSON.decode(@bulk_params).
10
+ deep_symbolize_keys
11
+ end
12
+
13
+ @model_scope = model_scope
14
+ @key = key
15
+ end
16
+
17
+ def fetch
18
+ params = bulk_params
19
+ params[:included] ||= {}
20
+ params[:excluded] ||= {}
21
+
22
+ items = model_scope
23
+ if params[:included][:ids]
24
+ items = model_scope.where(key => params[:included][:ids])
25
+ elsif params[:included][:search]
26
+ items = model_scope.search_for(params[:included][:search])
27
+ end
28
+ if params[:excluded][:ids]
29
+ items = items.where.not(key => params[:excluded][:ids])
30
+ end
31
+
32
+ items
33
+ end
34
+ end
35
+ end
@@ -39,11 +39,20 @@ module Katello
39
39
  end
40
40
  end
41
41
 
42
- def repositories_available_to_capsule(environments, content_view)
42
+ def repositories_available_to_capsule(environments = nil, content_view = nil)
43
43
  environments = @smart_proxy.lifecycle_environments if environments.nil?
44
44
  yum_repos = Katello::Repository.in_environment(environments)
45
45
  yum_repos = yum_repos.in_content_views([content_view]) if content_view
46
46
  yum_repos.smart_proxy_syncable
47
47
  end
48
+
49
+ def unsyncable_content_types
50
+ unsyncable_content_types = ::Katello::RepositoryTypeManager.defined_repository_types.keys.collect do |type_name|
51
+ unless @smart_proxy.capabilities(::SmartProxy::PULP3_FEATURE).include?(::Katello::RepositoryTypeManager.defined_repository_types[type_name].pulp3_plugin)
52
+ type_name
53
+ end
54
+ end
55
+ unsyncable_content_types.compact & repositories_available_to_capsule.map(&:content_type)
56
+ end
48
57
  end
49
58
  end