katello 3.7.0.rc1 → 3.7.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 (189) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_views_controller.rb +5 -2
  3. data/app/controllers/katello/api/v2/environments_controller.rb +8 -3
  4. data/app/controllers/katello/api/v2/host_tracer_controller.rb +1 -1
  5. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +4 -4
  6. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +5 -22
  7. data/app/lib/actions/katello/host/update_content_overrides.rb +1 -0
  8. data/app/lib/actions/katello/product/content_create.rb +1 -0
  9. data/app/lib/actions/katello/product/repositories_certs_reset.rb +25 -0
  10. data/app/lib/actions/katello/product/update.rb +6 -0
  11. data/app/lib/katello/resources/candlepin/activation_key.rb +8 -4
  12. data/app/lib/katello/resources/candlepin/product.rb +2 -1
  13. data/app/lib/katello/util/cdn_var_substitutor.rb +5 -3
  14. data/app/lib/katello/util/package.rb +21 -13
  15. data/app/lib/katello/util/package_filter.rb +33 -31
  16. data/app/lib/katello/validators/prior_validator.rb +6 -10
  17. data/app/models/katello/concerns/host_managed_extensions.rb +2 -0
  18. data/app/models/katello/concerns/organization_extensions.rb +1 -0
  19. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +10 -6
  20. data/app/models/katello/content.rb +23 -2
  21. data/app/models/katello/content_view_docker_filter.rb +1 -1
  22. data/app/models/katello/content_view_puppet_module.rb +3 -3
  23. data/app/models/katello/content_view_version.rb +4 -0
  24. data/app/models/katello/environment_prior.rb +7 -0
  25. data/app/models/katello/glue/candlepin/candlepin_object.rb +2 -2
  26. data/app/models/katello/glue/candlepin/pool.rb +10 -13
  27. data/app/models/katello/glue/candlepin/product.rb +19 -9
  28. data/app/models/katello/glue/candlepin/repository.rb +16 -0
  29. data/app/models/katello/glue/candlepin/subscription.rb +1 -1
  30. data/app/models/katello/glue/provider.rb +15 -81
  31. data/app/models/katello/host/subscription_facet.rb +1 -1
  32. data/app/models/katello/kt_environment.rb +39 -8
  33. data/app/models/katello/pool.rb +2 -1
  34. data/app/models/katello/rpm.rb +144 -2
  35. data/app/models/katello/upstream_pool.rb +7 -10
  36. data/app/services/katello/candlepin/pool_service.rb +18 -3
  37. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +13 -16
  38. data/app/views/dashboard/_content_views_widget.html.erb +3 -3
  39. data/app/views/dashboard/_errata_widget.html.erb +2 -2
  40. data/app/views/dashboard/_host_collection_widget.html.erb +3 -3
  41. data/app/views/dashboard/_subscription_status_widget.html.erb +2 -2
  42. data/app/views/dashboard/_subscription_widget.html.erb +1 -1
  43. data/app/views/dashboard/_sync_widget.html.erb +3 -3
  44. data/app/views/katello/api/v2/subscriptions/base.json.rabl +1 -1
  45. data/app/views/katello/api/v2/upstream_subscriptions/base.json.rabl +2 -6
  46. data/app/views/katello/layouts/react.html.erb +3 -3
  47. data/config/katello.yaml +89 -0
  48. data/config/routes.rb +3 -0
  49. data/db/migrate/20160302091113_change_environment_prior.rb +9 -0
  50. data/db/migrate/20180410140909_add_organization_id_to_pool.rb +2 -1
  51. data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +10 -0
  52. data/db/migrate/20180612164926_add_content_org_id.rb +39 -0
  53. data/db/migrate/20180612165011_remove_content_fields_from_host.rb +7 -0
  54. data/db/migrate/20180626160422_add_upstream_pool_id_to_katello_pool.rb +9 -0
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -1
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +1 -1
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/environment-content.controller.js +2 -3
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment.html +4 -2
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.controller.js +19 -14
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js +18 -5
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js +51 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/new-environment.html +16 -3
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +1 -1
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.routes.js +3 -3
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks.module.js +1 -6
  67. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
  68. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -1
  69. data/lib/katello/plugin.rb +2 -11
  70. data/lib/katello/scheduled_jobs.rb +2 -14
  71. data/lib/katello/tasks/clean_backend_objects.rake +2 -0
  72. data/lib/katello/tasks/repository.rake +11 -2
  73. data/lib/katello/tasks/upgrades/3.7/import_pools.rake +12 -0
  74. data/lib/katello/version.rb +1 -1
  75. data/package.json +4 -3
  76. data/webpack/components/PaginationRow/index.js +6 -2
  77. data/webpack/containers/Application/config.js +7 -2
  78. data/webpack/index.js +3 -5
  79. data/webpack/move_to_foreman/common/helpers.js +5 -24
  80. data/webpack/move_to_foreman/components/common/emptyState/index.js +12 -7
  81. data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.js +31 -0
  82. data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.test.js +16 -0
  83. data/webpack/move_to_foreman/components/common/table/components/Table.js +76 -0
  84. data/webpack/move_to_foreman/components/common/table/components/Table.test.js +31 -0
  85. data/webpack/move_to_foreman/components/common/table/components/TableBody.js +27 -0
  86. data/webpack/move_to_foreman/components/common/table/components/TableBody.test.js +18 -0
  87. data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.js +18 -0
  88. data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.test.js +12 -0
  89. data/webpack/move_to_foreman/components/common/table/components/TableFixtures.js +14 -0
  90. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.js +39 -0
  91. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.test.js +16 -0
  92. data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.js +34 -0
  93. data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.test.js +14 -0
  94. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +19 -0
  95. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/Table.test.js.snap +167 -0
  96. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBody.test.js.snap +28 -0
  97. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBodyMessage.test.js.snap +13 -0
  98. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +16 -0
  99. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +15 -0
  100. data/webpack/move_to_foreman/components/common/table/components/index.js +6 -0
  101. data/webpack/move_to_foreman/components/common/table/formatters/cellFormatter.js +4 -0
  102. data/webpack/move_to_foreman/components/common/table/formatters/collapseableAndSelectionCellFormatter.js +18 -0
  103. data/webpack/move_to_foreman/components/common/table/formatters/ellipsisCellFormatter.js +5 -0
  104. data/webpack/move_to_foreman/components/common/table/formatters/headerFormatter.js +4 -0
  105. data/webpack/move_to_foreman/components/common/table/formatters/index.js +6 -0
  106. data/webpack/move_to_foreman/components/common/table/formatters/selectionCellFormatter.js +17 -0
  107. data/webpack/move_to_foreman/components/common/table/formatters/selectionHeaderCellFormatter.js +10 -0
  108. data/webpack/move_to_foreman/components/common/table/index.js +2 -88
  109. data/webpack/move_to_pf/LoadingState/LoadingState.js +35 -0
  110. data/webpack/move_to_pf/LoadingState/LoadingState.scss +12 -0
  111. data/webpack/move_to_pf/LoadingState/LoadingState.test.js +28 -0
  112. data/webpack/move_to_pf/LoadingState/__snapshots__/LoadingState.test.js.snap +20 -0
  113. data/webpack/move_to_pf/LoadingState/index.js +3 -0
  114. data/webpack/move_to_pf/test-utils/testHelpers.js +71 -0
  115. data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -1
  116. data/webpack/redux/actions/RedHatRepositories/helpers.js +34 -9
  117. data/webpack/redux/actions/RedHatRepositories/sets.js +28 -6
  118. data/webpack/redux/consts.js +1 -0
  119. data/webpack/redux/reducers/RedHatRepositories/sets.fixtures.js +12 -2
  120. data/webpack/redux/reducers/RedHatRepositories/sets.js +34 -27
  121. data/webpack/redux/reducers/RedHatRepositories/sets.test.js +10 -2
  122. data/webpack/redux/reducers/index.js +2 -0
  123. data/webpack/scenes/Organizations/OrganizationActions.js +3 -3
  124. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.js +44 -0
  125. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.scss +16 -0
  126. data/webpack/scenes/RedHatRepositories/components/RepositorySet.js +8 -2
  127. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +5 -3
  128. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +4 -2
  129. data/webpack/scenes/RedHatRepositories/components/Search.js +1 -1
  130. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -1
  131. data/webpack/scenes/RedHatRepositories/components/__tests__/RecommendedRepositorySetsToggler.test.js +17 -0
  132. data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +37 -0
  133. data/webpack/scenes/RedHatRepositories/helpers.js +1 -1
  134. data/webpack/scenes/RedHatRepositories/index.js +17 -7
  135. data/webpack/scenes/RedHatRepositories/index.scss +16 -4
  136. data/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +17 -0
  137. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +28 -0
  138. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +47 -0
  139. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailConstants.js +3 -0
  140. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js +65 -0
  141. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +20 -0
  142. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +37 -0
  143. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +58 -0
  144. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js +47 -0
  145. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailAssociations.test.js +16 -0
  146. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailInfo.test.js +15 -0
  147. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProducts.test.js +16 -0
  148. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +39 -0
  149. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +28 -0
  150. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailAssociations.test.js.snap +53 -0
  151. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap +185 -0
  152. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProducts.test.js.snap +77 -0
  153. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +432 -0
  154. data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +167 -0
  155. data/webpack/scenes/Subscriptions/Details/index.js +19 -0
  156. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +58 -12
  157. data/webpack/scenes/Subscriptions/Manifest/Manifest.scss +6 -1
  158. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +4 -4
  159. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +7 -7
  160. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +6 -9
  161. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -2
  162. data/webpack/scenes/Subscriptions/SubscriptionActions.js +5 -6
  163. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +2 -3
  164. data/webpack/scenes/Subscriptions/SubscriptionValidations.js +1 -1
  165. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +46 -30
  166. data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +38 -0
  167. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +3 -3
  168. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +7 -6
  169. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +17 -14
  170. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +12 -15
  171. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +4 -4
  172. data/webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js +5 -0
  173. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +2 -2
  174. data/webpack/scenes/Subscriptions/{EntitlementsInlineEditFormatter.js → components/SubscriptionsTable/EntitlementsInlineEditFormatter.js} +7 -7
  175. data/webpack/scenes/Subscriptions/{SubscriptionsTable.js → components/SubscriptionsTable/SubscriptionsTable.js} +75 -47
  176. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +60 -0
  177. data/webpack/scenes/Subscriptions/{SubscriptionsTableSchema.js → components/SubscriptionsTable/SubscriptionsTableSchema.js} +37 -26
  178. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +56 -0
  179. data/webpack/scenes/Subscriptions/{__tests__ → components/SubscriptionsTable/__tests__}/__snapshots__/SubscriptionsTable.test.js.snap +16 -5
  180. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/index.js +2 -0
  181. data/webpack/scenes/Subscriptions/index.js +2 -2
  182. data/webpack/scenes/Tasks/TaskActions.js +18 -11
  183. data/webpack/scenes/Tasks/__tests__/TaskActions.test.js +92 -9
  184. data/webpack/scenes/Tasks/__tests__/task.fixtures.js +19 -9
  185. data/webpack/services/api/index.js +2 -2
  186. data/webpack/test_setup.js +1 -0
  187. metadata +79 -10
  188. data/webpack/scenes/Subscriptions/Subscriptions.scss +0 -14
  189. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsTable.test.js +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147daad6f060ba123d7cb4ccf889e33540fd1224
4
- data.tar.gz: 0a970ddfacc20136330150f3d535fb06473210c4
3
+ metadata.gz: 9a4f6bd736dcb2608d0f0eb09fc42a3365633e81
4
+ data.tar.gz: d4d554bed1a2b7d416f8c57cf6e786fc2188aaa5
5
5
  SHA512:
6
- metadata.gz: a577fcdf1949cd2b761cb098dc2cdf809c39daf235ba45e1e27f1d5c9fb101a63bd47280eaca2ecfffff8a42e98e082216ab50383572d4fab3090e0913d7461e
7
- data.tar.gz: a7bd9315164c9fac9f35c07e81f33ec3095f944392412d1fe17decc664aa707017fe8b5694e5249126bcb79ea5fdd2393633ce0b08bbc685dc3cbeabc93dc87b
6
+ metadata.gz: b4e75ade9c719b6f7ba594591fdef8e7665440bf5781802ad5c80dc42d413bb8c2ce71ab17c7805665dfef6dc56e270d30227cbc6127e3f0db3956a0b5ea45d5
7
+ data.tar.gz: 3318e9625546af01d1f72dc7dc30f998d0213f124189cdb2cc4572652a644648d84935fc114e5d98c1c8368f979319929bb29b033a2c8f05519e717cbaeea9ce
@@ -208,9 +208,12 @@ module Katello
208
208
  end
209
209
 
210
210
  def view_params
211
- attrs = [:name, :description, :force_puppet_environment, {:repository_ids => []}, {:component_ids => []}]
211
+ attrs = [:name, :description, :force_puppet_environment, {:component_ids => []}]
212
212
  attrs.push(:label, :composite) if action_name == "create"
213
- attrs.push(:component_ids, :repository_ids, :auto_publish) # For deep_munge; Remove for Rails 5
213
+ attrs.push(:component_ids, :auto_publish) # For deep_munge; Remove for Rails 5
214
+ if (!@view || !@view.composite?)
215
+ attrs.push({:repository_ids => []}, :repository_ids)
216
+ end
214
217
  params.require(:content_view).permit(*attrs).to_h
215
218
  end
216
219
 
@@ -13,7 +13,7 @@ module Katello
13
13
 
14
14
  ## Chains
15
15
 
16
- Environments are ordered into chains and their content (propducts,
16
+ Environments are ordered into chains and their content (products,
17
17
  repositories, tempaltes, packages) can be moved to an environment only from its
18
18
  prior environment. You can have for example chain like:
19
19
 
@@ -39,6 +39,7 @@ module Katello
39
39
  before_action :find_prior, :only => [:create]
40
40
  before_action :find_environment, :only => [:show, :update, :destroy, :repositories]
41
41
  before_action :find_content_view, :only => [:repositories]
42
+ before_action :find_path, :only => [:create]
42
43
 
43
44
  wrap_parameters :include => (KTEnvironment.attribute_names + %w(prior prior_id new_name))
44
45
 
@@ -83,8 +84,7 @@ module Katello
83
84
  create_params = environment_params
84
85
  create_params[:label] = labelize_params(create_params)
85
86
  create_params[:organization] = @organization
86
- create_params[:prior] = @prior
87
- @environment = KTEnvironment.create!(create_params)
87
+ @environment = @prior.insert_successor(create_params, @path)
88
88
  respond
89
89
  end
90
90
 
@@ -168,6 +168,11 @@ module Katello
168
168
  @prior
169
169
  end
170
170
 
171
+ def find_path
172
+ path = params[:environment][:path_id] || params[:path_id]
173
+ path ? @path = KTEnvironment.readable.find(path).path : @path = nil
174
+ end
175
+
171
176
  def environment_params
172
177
  if @environment && @environment.library?
173
178
  attrs = [:registry_name_pattern]
@@ -9,7 +9,7 @@ module Katello
9
9
  api_base_url "/api"
10
10
  end
11
11
 
12
- api :GET, "/hosts/:host_id/tracer", N_("List servises that need restarting on the host")
12
+ api :GET, "/hosts/:host_id/traces", N_("List services that need restarting on the host")
13
13
  param :host_id, :number, :required => true, :desc => N_("ID of the host")
14
14
  def index
15
15
  collection = scoped_search(index_relation, :application, :asc, :resource_class => ::Katello::HostTracer)
@@ -18,7 +18,7 @@ module Katello
18
18
  N_("List available subscriptions from Red Hat Subscription Management")
19
19
  param :organization_id, :number, :desc => N_("Organization ID"), :required => true
20
20
  param_group :cp_search
21
- param :pool_ids, Array, desc: N_("Return only the upstream pools which map to the given local pool IDs")
21
+ param :pool_ids, Array, desc: N_("Return only the upstream pools which map to the given Katello pool IDs")
22
22
  param :quantities_only, :bool, desc: N_("Only returns id and quantity fields")
23
23
  param :attachable, :bool, desc: N_("Return only subscriptions which can be attached to the upstream allocation")
24
24
  def index
@@ -35,7 +35,7 @@ module Katello
35
35
  N_("Update the quantity of one or more subscriptions on an upstream allocation")
36
36
  param :organization_id, :number, :desc => N_("Organization ID"), :required => true
37
37
  param :pools, Array, desc: N_("Array of Pools to be updated. Only pools originating upstream are accepted."), required: true do
38
- param :id, String, desc: N_("ID of local pool to update"), required: true
38
+ param :id, String, desc: N_("Katello ID of local pool to update"), required: true
39
39
  param :quantity, Integer, desc: N_("Desired quantity of the pool"), required: true
40
40
  end
41
41
  def update
@@ -55,7 +55,7 @@ module Katello
55
55
  api :POST, "/organizations/:organization_id/upstream_subscriptions",
56
56
  N_("Add subscriptions consumed by a manifest from Red Hat Subscription Management")
57
57
  param :pools, Array, desc: N_("Array of pools to add"), required: true do
58
- param :id, String, desc: N_("Pool ID"), required: true
58
+ param :id, String, desc: N_("Candlepin ID of pool to add"), required: true
59
59
  param :quantity, :number, desc: N_("Quantity of entitlements to bind"), required: true
60
60
  end
61
61
  param :organization_id, :number, :desc => N_("Organization ID"), :required => true
@@ -74,7 +74,7 @@ module Katello
74
74
  def upstream_pool_params
75
75
  upstream_params = params.permit(:page, :per_page, :order, :sort_by, :quantities_only, :attachable, pool_ids: []).to_h
76
76
 
77
- if params[:full_result]
77
+ if params[:full_result] || !upstream_params[:pool_ids].empty?
78
78
  upstream_params.delete(:per_page)
79
79
  upstream_params.delete(:page)
80
80
  elsif !params[:per_page]
@@ -14,14 +14,6 @@ module Katello
14
14
  %(<option data-id="#{inherited_value}" value="">#{blank_or_inherit_f(f, attr)}</option>)
15
15
  end
16
16
 
17
- def content_view(host)
18
- if host.is_a?(Hostgroup)
19
- host.content_view
20
- else
21
- host.content_facet.try(:content_view)
22
- end
23
- end
24
-
25
17
  def organizations(host)
26
18
  if host.is_a?(Hostgroup)
27
19
  host.organizations
@@ -30,14 +22,6 @@ module Katello
30
22
  end
31
23
  end
32
24
 
33
- def lifecycle_environment(host)
34
- if host.is_a?(Hostgroup)
35
- host.lifecycle_environment
36
- else
37
- host.content_facet.try(:lifecycle_environment)
38
- end
39
- end
40
-
41
25
  def use_install_media(host, options = {})
42
26
  return true if host && host.errors && host.errors.include?(:medium_id)
43
27
  kickstart_repository_id(host, options).blank?
@@ -77,20 +61,19 @@ module Katello
77
61
  end
78
62
 
79
63
  def fetch_lifecycle_environment(host, options = {})
64
+ return host.lifecycle_environment if host.lifecycle_environment.present?
80
65
  selected_host_group = options.fetch(:selected_host_group, nil)
81
- return lifecycle_environment(selected_host_group) if selected_host_group.present?
82
- selected_env = lifecycle_environment(host)
83
- return selected_env if selected_env.present?
66
+ return selected_host_group.lifecycle_environment if selected_host_group.present?
84
67
  end
85
68
 
86
69
  def fetch_content_view(host, options = {})
70
+ return host.content_view if host.content_view.present?
87
71
  selected_host_group = options.fetch(:selected_host_group, nil)
88
- return content_view(selected_host_group) if selected_host_group.present?
89
- content_view(host)
72
+ return selected_host_group.content_view if selected_host_group.present?
90
73
  end
91
74
 
92
75
  def accessible_lifecycle_environments(org, host)
93
- selected = lifecycle_environment(host)
76
+ selected = host.lifecycle_environment
94
77
  envs = org.kt_environments.readable
95
78
  envs |= [selected] if selected.present? && org == selected.organization
96
79
  envs
@@ -6,6 +6,7 @@ module Actions
6
6
 
7
7
  def plan(host, content_override_params, prune_invalid_content_overrides = true)
8
8
  action_subject(host)
9
+ fail _("This Host is not currently registered with subscription-manager.") unless host.subscription_facet
9
10
  plan_self(:host_id => host.id, :host_name => host.name, :content_overrides => content_override_params,
10
11
  :prune_invalid_content_overrides => prune_invalid_content_overrides)
11
12
  end
@@ -45,6 +45,7 @@ module Actions
45
45
  repository.save!
46
46
 
47
47
  content = ::Katello::Content.create!(name: repository.name,
48
+ organization_id: repository.product.organization_id,
48
49
  cp_content_id: repository.content_id,
49
50
  content_type: repository.content_type,
50
51
  label: repository.custom_content_label,
@@ -0,0 +1,25 @@
1
+ module Actions
2
+ module Katello
3
+ module Product
4
+ class RepositoriesCertsReset < Actions::AbstractAsyncTask
5
+ def plan(product)
6
+ ssl_ca_cert_id = product.ssl_ca_cert_id
7
+ ssl_client_cert_id = product.ssl_client_cert_id
8
+ ssl_client_key_id = product.ssl_client_key_id
9
+ # Plan Repository::Update only for repositories which have different certs key
10
+ product.repositories.each do |repo|
11
+ if (repo.ssl_ca_cert_id != ssl_ca_cert_id ||
12
+ repo.ssl_client_cert_id != ssl_client_cert_id ||
13
+ repo.ssl_client_key_id != ssl_client_key_id)
14
+ plan_action(::Actions::Katello::Repository::Update,
15
+ repo,
16
+ :ssl_ca_cert_id => ssl_ca_cert_id,
17
+ :ssl_client_cert_id => ssl_client_cert_id,
18
+ :ssl_client_key_id => ssl_client_key_id)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -8,7 +8,13 @@ module Actions
8
8
  if product.previous_changes.key?('gpg_key_id')
9
9
  plan_action(::Actions::Katello::Product::RepositoriesGpgReset, product)
10
10
  end
11
+ if (product.previous_changes.key?('ssl_ca_cert_id') ||
12
+ product.previous_changes.key?('ssl_client_cert_id') ||
13
+ product.previous_changes.key?('ssl_client_key_id'))
14
+ plan_action(::Actions::Katello::Product::RepositoriesCertsReset, product)
15
+ end
11
16
 
17
+ product.reload
12
18
  plan_action(::Actions::Pulp::Repos::Update, product) if ::SETTINGS[:katello][:use_pulp]
13
19
  end
14
20
  end
@@ -3,8 +3,8 @@ module Katello
3
3
  module Candlepin
4
4
  class ActivationKey < CandlepinResource
5
5
  class << self
6
- def get(id = nil, params = '')
7
- akeys_json = super(path(id) + params, self.default_headers).body
6
+ def get(id = nil, params = '', owner = nil)
7
+ akeys_json = super(path(id, owner) + params, self.default_headers).body
8
8
  akeys = JSON.parse(akeys_json)
9
9
  akeys = [akeys] unless id.nil?
10
10
  ::Katello::Util::Data.array_with_indifferent_access akeys
@@ -91,8 +91,12 @@ module Katello
91
91
  ::Katello::Util::Data.array_with_indifferent_access(JSON.parse(result || '{}'))
92
92
  end
93
93
 
94
- def path(id = nil)
95
- "/candlepin/activation_keys/#{id}"
94
+ def path(id = nil, owner_id = nil)
95
+ if owner_id
96
+ "/candlepin/owners/#{owner_id}/activation_keys/#{id}"
97
+ else
98
+ "/candlepin/activation_keys/#{id}"
99
+ end
96
100
  end
97
101
  end
98
102
  end
@@ -4,7 +4,8 @@ module Katello
4
4
  class Product < CandlepinResource
5
5
  class << self
6
6
  def all(owner_label, included = [])
7
- JSON.parse(Candlepin::CandlepinResource.get(path(owner_label) + "?#{included_list(included)}", self.default_headers).body)
7
+ products = JSON.parse(Candlepin::CandlepinResource.get(path(owner_label) + "?#{included_list(included)}", self.default_headers).body)
8
+ ::Katello::Util::Data.array_with_indifferent_access products
8
9
  end
9
10
 
10
11
  def find_for_stacking_id(owner_key, stacking_id)
@@ -28,9 +28,11 @@ module Katello
28
28
  needed_substitutions = PathWithSubstitutions.new(real_path, {}).substitutions_needed
29
29
 
30
30
  if unused_substitutions.any?
31
- fail Errors::CdnSubstitutionError, _("%{unused_substitutes} cannot be specified for %{content_name}"\
32
- " as that information is not substitutable in %{content_url} ") %
33
- { unaccepted_substitutions: unused_substitutions, content_name: content.name, content_url: content.content_url }
31
+ fail Errors::CdnSubstitutionError, _("%{unused_substitutions} cannot be specified for %{content_name}"\
32
+ " as that information is not substitutable in %{content_url} ") %
33
+ { unused_substitutions: unused_substitutions.join(','),
34
+ content_name: content.name,
35
+ content_url: content.content_url }
34
36
  end
35
37
 
36
38
  if needed_substitutions.any?
@@ -3,12 +3,22 @@ module Katello
3
3
  module Package
4
4
  SUFFIX_RE = /\.(rpm)$/
5
5
  ARCH_RE = /\.([^.\-]*)$/
6
- EPOCH_RE = /([0-9]+):/
7
- NVRE_RE = /^(?:([0-9]+):)?(.*)-([^-]*)-([^-]*)$/
6
+ NVRE_RE = /^(.*)-(?:([0-9]+):)?([^-]*)-([^-]*)$/
7
+ EVR_RE = /^(?:([0-9]+):)?(.*?)(?:-([^-]*))?$/
8
8
  SUPPORTED_ARCHS = %w(noarch i386 i686 ppc64 s390x x86_64 ia64).freeze
9
9
 
10
+ # is able to take both nvre and nvrea and parse it correctly
11
+ def self.parse_nvrea_nvre(name)
12
+ package = self.parse_nvrea(name)
13
+ if package && SUPPORTED_ARCHS.include?(package[:arch])
14
+ return package
15
+ else
16
+ return self.parse_nvre(name)
17
+ end
18
+ end
19
+
10
20
  #parses package nvrea and stores it in a hash
11
- #epoch:name-ve.rs.ion-rel.e.ase.arch.rpm
21
+ #name-epoch:ve.rs.ion-rel.e.ase.arch.rpm
12
22
  def self.parse_nvrea(name)
13
23
  name, suffix = extract_suffix(name)
14
24
  name, arch = extract_arch(name)
@@ -20,26 +30,24 @@ module Katello
20
30
  end
21
31
 
22
32
  #parses package nvre and stores it in a hash
23
- #epoch:name-ve.rs.ion-rel.e.ase.rpm
33
+ #name-epoch:ve.rs.ion-rel.e.ase.rpm
24
34
  def self.parse_nvre(name)
25
35
  name, suffix = extract_suffix(name)
26
36
 
27
37
  if (match = NVRE_RE.match(name))
28
38
  {:suffix => suffix,
29
- :epoch => match[1],
30
- :name => match[2],
39
+ :name => match[1],
40
+ :epoch => match[2],
31
41
  :version => match[3],
32
42
  :release => match[4]}.delete_if { |_k, v| v.nil? }
33
43
  end
34
44
  end
35
45
 
36
- # is able to take both nvre and nvrea and parse it correctly
37
- def self.parse_nvrea_nvre(name)
38
- package = self.parse_nvrea(name)
39
- if package && SUPPORTED_ARCHS.include?(package[:arch])
40
- return package
41
- else
42
- return self.parse_nvre(name)
46
+ def self.parse_evr(evr)
47
+ if (match = EVR_RE.match(evr))
48
+ {:epoch => match[1],
49
+ :version => match[2],
50
+ :release => match[3]}.delete_if { |_k, v| v.nil? }
43
51
  end
44
52
  end
45
53
 
@@ -15,53 +15,55 @@ module Katello
15
15
  end
16
16
 
17
17
  def extract_epoch_version_release(evr)
18
- match = case evr
19
- when /\A(\d+):(.*)-(.*)\z/
20
- evr.match(/\A(?<epoch>\d+):(?<version>.*)-(?<release>.*)\z/)
21
- when /\A(\d+):(.*)\z/
22
- evr.match(/\A(?<epoch>\d+):(?<version>.*)\z/)
23
- when /\A(.*)-(.*)\z/
24
- evr.match(/\A(?<version>.*)-(?<release>.*)\z/)
25
- else
26
- evr.match(/\A(?<version>.*)\z/)
27
- end
28
- self.version = Package.sortable_version(match[:version])
29
- self.epoch = match[:epoch] rescue nil
30
- self.release = (match[:release] rescue nil) ? Package.sortable_version(match[:release]) : nil
18
+ parsed = Package.parse_evr(evr)
19
+ self.epoch = parsed[:epoch].to_i # nil or blank becomes 0
20
+ v = parsed[:version]
21
+ self.version = (v.nil? || v.blank?) ? '' : Package.sortable_version(v)
22
+ r = parsed[:release]
23
+ self.release = (r.nil? || r.blank?) ? '' : Package.sortable_version(r)
31
24
  end
32
25
 
33
26
  def results
34
- version_clause = "#{convert(:version_sortable)} #{operator} #{convert(':version')}"
35
- version_clause = add_release_clause(version_clause) unless release.blank?
36
- version_clause = add_epoch_clause(version_clause) unless epoch.blank?
27
+ if operator == EQUAL
28
+ conditions = epoch_clause(operator)
29
+ conditions += ' AND ' + version_clause(operator) unless version.blank?
30
+ conditions += ' AND ' + release_clause(operator) unless release.blank?
31
+ else
32
+ conditions = ''
33
+ unless version.blank?
34
+ unless release.blank?
35
+ conditions = " OR (#{version_clause('=')} AND #{release_clause(operator)})"
36
+ end
37
+ conditions = " OR (#{epoch_clause('=')} AND (#{version_clause(operator)}#{conditions}))"
38
+ end
39
+ conditions = "#{epoch_clause(operator)}#{conditions}"
40
+ end
37
41
 
38
- self.relation.where(version_clause, :version => version, :release => release, :epoch => epoch)
42
+ self.relation.where(conditions, :version => version, :release => release, :epoch => epoch)
39
43
  end
40
44
 
41
- def add_release_clause(version_clause)
42
- clause = "(#{convert(:version_sortable)} = #{convert(':version')} AND #{convert(:release_sortable)} #{operator} #{convert(':release')})"
45
+ def epoch_clause(op)
46
+ "CAST(epoch AS INT) #{op} :epoch"
47
+ end
43
48
 
44
- # if we're using EQUAL, match: version = X AND release = Y
45
- # else if we're using something like greater than, we need:
46
- # (version > X) OR (version = X AND release > Y)
47
- if operator == EQUAL
48
- clause
49
+ def version_clause(op)
50
+ if op == '='
51
+ "version_sortable = :version"
49
52
  else
50
- "#{version_clause} OR #{clause}"
53
+ "#{convert(:version_sortable)} #{op} #{convert(':version')}"
51
54
  end
52
55
  end
53
56
 
54
- def add_epoch_clause(version_clause)
55
- if operator == EQUAL
56
- clause = "(epoch = :epoch AND (%s))"
57
+ def release_clause(op)
58
+ if op == '='
59
+ "release_sortable = :release"
57
60
  else
58
- clause = "epoch #{operator} :epoch OR (epoch = :epoch AND (%s))"
61
+ "#{convert(:release_sortable)} #{op} #{convert(':release')}"
59
62
  end
60
- clause % version_clause
61
63
  end
62
64
 
63
65
  def convert(name = '?')
64
- "convert_to(#{name}, 'SQL_ASCII')"
66
+ "#{name} COLLATE \"C\""
65
67
  end
66
68
  end
67
69
  end
@@ -2,18 +2,14 @@ module Katello
2
2
  module Validators
3
3
  class PriorValidator < ActiveModel::Validator
4
4
  def validate(record)
5
- #need to ensure that prior
6
- #environment already does not have a successor
7
- #this is because in v1.0 we want
5
+ # need to ensure that prior
6
+ # environment already does not have a successor
7
+ # this is because in v1.0 we want
8
8
  # prior to have only one child (unless its the Library)
9
- has_no_prior = true
10
- if record.organization
11
- has_no_prior = record.organization.kt_environments.reject { |env| env == record || env.prior != record.prior || env.prior == env.organization.library }.empty?
9
+ ancestor = record.prior
10
+ if ancestor && !ancestor.library?
11
+ record.errors[:prior] << _("prior environment can only have one child") if ancestor.successors.count == 1 && !ancestor.successors.include?(record)
12
12
  end
13
- record.errors[:prior] << _("environment can only have one child") unless has_no_prior
14
-
15
- # only Library can have prior=nil
16
- record.errors[:prior] << _("environment required") unless !record.prior.nil? || record.library?
17
13
  end
18
14
  end
19
15
  end