katello 3.9.1 → 3.10.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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +28 -12
  3. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +12 -3
  4. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +4 -13
  5. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
  6. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +6 -4
  8. data/app/controllers/katello/api/v2/content_views_controller.rb +8 -3
  9. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +2 -1
  10. data/app/controllers/katello/api/v2/host_module_streams_controller.rb +39 -0
  11. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +20 -11
  12. data/app/controllers/katello/api/v2/module_streams_controller.rb +2 -1
  13. data/app/controllers/katello/api/v2/repository_sets_controller.rb +17 -8
  14. data/app/controllers/katello/application_controller.rb +0 -2
  15. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +5 -2
  16. data/app/lib/actions/candlepin/consumer/attach_subscription.rb +0 -2
  17. data/app/lib/actions/candlepin/consumer/remove_subscription.rb +0 -2
  18. data/app/lib/actions/katello/capsule_content/create_repos.rb +1 -25
  19. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  20. data/app/lib/actions/katello/content_view/promote.rb +2 -5
  21. data/app/lib/actions/katello/content_view/promote_to_environment.rb +2 -5
  22. data/app/lib/actions/katello/content_view/publish.rb +1 -4
  23. data/app/lib/actions/katello/content_view_puppet_environment/create.rb +6 -10
  24. data/app/lib/actions/katello/content_view_version/export.rb +0 -2
  25. data/app/lib/actions/katello/content_view_version/incremental_update.rb +19 -1
  26. data/app/lib/actions/katello/environment/publish_repositories.rb +2 -1
  27. data/app/lib/actions/katello/gpg_key/update.rb +17 -0
  28. data/app/lib/actions/katello/host/attach_subscriptions.rb +0 -2
  29. data/app/lib/actions/katello/host/erratum/install.rb +6 -0
  30. data/app/lib/actions/katello/host/generate_applicability.rb +0 -2
  31. data/app/lib/actions/katello/host/hypervisors_update.rb +11 -6
  32. data/app/lib/actions/katello/host/package/install.rb +6 -0
  33. data/app/lib/actions/katello/host/package/remove.rb +6 -0
  34. data/app/lib/actions/katello/host/package/update.rb +7 -1
  35. data/app/lib/actions/katello/host/package_group/install.rb +6 -0
  36. data/app/lib/actions/katello/host/package_group/remove.rb +6 -0
  37. data/app/lib/actions/katello/host/recalculate_errata_status.rb +0 -2
  38. data/app/lib/actions/katello/host/remove_subscriptions.rb +0 -2
  39. data/app/lib/actions/katello/host/update.rb +1 -0
  40. data/app/lib/actions/katello/host/update_content_overrides.rb +0 -2
  41. data/app/lib/actions/katello/host/upload_package_profile.rb +13 -12
  42. data/app/lib/actions/katello/host/upload_profiles.rb +70 -0
  43. data/app/lib/actions/katello/product/reindex_subscriptions.rb +0 -2
  44. data/app/lib/actions/katello/product/repositories_certs_reset.rb +4 -4
  45. data/app/lib/actions/katello/product/repositories_gpg_reset.rb +2 -2
  46. data/app/lib/actions/katello/repository/check_matching_content.rb +18 -6
  47. data/app/lib/actions/katello/repository/clone_deb_content.rb +1 -1
  48. data/app/lib/actions/katello/repository/clone_to_environment.rb +3 -5
  49. data/app/lib/actions/katello/repository/clone_to_version.rb +2 -3
  50. data/app/lib/actions/katello/repository/clone_yum_content.rb +1 -2
  51. data/app/lib/actions/katello/repository/clone_yum_metadata.rb +2 -2
  52. data/app/lib/actions/katello/repository/create.rb +1 -31
  53. data/app/lib/actions/katello/repository/destroy.rb +1 -2
  54. data/app/lib/actions/katello/repository/export.rb +0 -2
  55. data/app/lib/actions/katello/repository/fetch_pxe_files.rb +0 -2
  56. data/app/lib/actions/katello/repository/filtered_index_content.rb +0 -2
  57. data/app/lib/actions/katello/repository/finish_upload.rb +0 -2
  58. data/app/lib/actions/katello/repository/import_upload.rb +0 -2
  59. data/app/lib/actions/katello/repository/index_content.rb +0 -1
  60. data/app/lib/actions/katello/repository/index_package_groups.rb +0 -2
  61. data/app/lib/actions/katello/repository/instance_update.rb +21 -0
  62. data/app/lib/actions/katello/repository/remove_content.rb +0 -2
  63. data/app/lib/actions/katello/repository/sync.rb +0 -1
  64. data/app/lib/actions/katello/repository/update.rb +0 -2
  65. data/app/lib/actions/katello/upstream_subscriptions/bind_entitlement.rb +0 -2
  66. data/app/lib/actions/katello/upstream_subscriptions/bind_entitlements.rb +0 -2
  67. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlement.rb +0 -1
  68. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb +0 -2
  69. data/app/lib/actions/katello/upstream_subscriptions/update_entitlement.rb +0 -1
  70. data/app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb +0 -2
  71. data/app/lib/actions/pulp/abstract.rb +13 -14
  72. data/app/lib/actions/pulp/repository/create.rb +13 -211
  73. data/app/lib/actions/pulp/repository/create_in_plan.rb +4 -18
  74. data/app/lib/actions/pulp/repository/refresh.rb +7 -70
  75. data/app/lib/actions/pulp/repository/sync.rb +1 -2
  76. data/app/lib/katello/capsule_content.rb +3 -3
  77. data/app/lib/katello/resources/candlepin/consumer.rb +1 -1
  78. data/app/lib/katello/resources/candlepin/product.rb +1 -1
  79. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +1 -1
  80. data/app/models/katello/available_module_stream.rb +11 -0
  81. data/app/models/katello/concerns/content_facet_host_extensions.rb +1 -0
  82. data/app/models/katello/concerns/host_managed_extensions.rb +56 -0
  83. data/app/models/katello/concerns/hostgroup_extensions.rb +17 -0
  84. data/app/models/katello/concerns/redhat_extensions.rb +20 -6
  85. data/app/models/katello/concerns/search_by_repository_name.rb +0 -1
  86. data/app/models/katello/concerns/smart_proxy_extensions.rb +26 -12
  87. data/app/models/katello/content_facet_applicable_module_stream.rb +7 -0
  88. data/app/models/katello/content_view_puppet_environment.rb +14 -35
  89. data/app/models/katello/erratum.rb +54 -24
  90. data/app/models/katello/erratum_package.rb +6 -0
  91. data/app/models/katello/glue/pulp/repo.rb +5 -228
  92. data/app/models/katello/gpg_key.rb +1 -0
  93. data/app/models/katello/host/content_facet.rb +38 -83
  94. data/app/models/katello/host_available_module_stream.rb +47 -0
  95. data/app/models/katello/module_stream.rb +18 -0
  96. data/app/models/katello/module_stream_erratum_package.rb +6 -0
  97. data/app/models/katello/product.rb +0 -2
  98. data/app/models/katello/product_content.rb +1 -0
  99. data/app/models/katello/repository.rb +15 -6
  100. data/app/models/katello/root_repository.rb +1 -1
  101. data/app/models/katello/rpm.rb +5 -17
  102. data/app/services/katello/applicable_content_helper.rb +111 -0
  103. data/app/services/katello/managed_content_medium_provider.rb +7 -0
  104. data/app/services/katello/pulp/consumer.rb +13 -7
  105. data/app/services/katello/pulp/repository.rb +157 -4
  106. data/app/services/katello/pulp/repository/deb.rb +47 -0
  107. data/app/services/katello/pulp/repository/docker.rb +43 -0
  108. data/app/services/katello/pulp/repository/file.rb +31 -0
  109. data/app/services/katello/pulp/repository/ostree.rb +40 -0
  110. data/app/services/katello/pulp/repository/puppet.rb +43 -0
  111. data/app/services/katello/pulp/repository/yum.rb +61 -0
  112. data/app/services/katello/repository_type.rb +1 -1
  113. data/app/views/katello/api/v2/content_facet/base.json.rabl +1 -0
  114. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +0 -1
  115. data/app/views/katello/api/v2/errata/_counts.json.rabl +0 -1
  116. data/app/views/katello/api/v2/errata/show.json.rabl +9 -3
  117. data/app/views/katello/api/v2/host_collections/delta_activation_keys.rabl +0 -1
  118. data/app/views/katello/api/v2/host_module_streams/base.json.rabl +8 -0
  119. data/app/views/katello/api/v2/host_module_streams/index.json.rabl +7 -0
  120. data/app/views/katello/api/v2/packages/backend.json.rabl +0 -1
  121. data/app/views/katello/api/v2/repositories/show.json.rabl +6 -6
  122. data/app/views/katello/layouts/react.html.erb +2 -2
  123. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +0 -1
  124. data/config/routes/api/rhsm.rb +1 -0
  125. data/config/routes/overrides.rb +4 -0
  126. data/db/migrate/20181008201422_add_modules_to_errata_packages.rb +29 -0
  127. data/db/migrate/20181017181806_available_module_streams.rb +34 -0
  128. data/db/migrate/20181027014323_add_applicable_modules.rb +24 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/module-stream-actions.service.js +2 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/details/views/content-credential-info.html +1 -1
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-credentials/new/views/new-content-credential.html +1 -0
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +2 -2
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +37 -22
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +4 -1
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +27 -7
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +29 -0
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/errata-details.html +15 -1
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +1 -1
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-promotion.controller.js +0 -1
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-publish.controller.js +1 -2
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-versions.controller.js +3 -1
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.controller.js +1 -1
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-promotion.html +0 -15
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +0 -14
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/erratum.controller.js +19 -0
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-info.html +0 -12
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-packages.html +36 -0
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum.html +7 -0
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.routes.js +9 -0
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-module-streams.factory.js +18 -0
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -2
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
  153. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +13 -0
  154. data/lib/katello/permissions/host_permissions.rb +3 -0
  155. data/lib/katello/repository_types/deb.rb +3 -1
  156. data/lib/katello/repository_types/docker.rb +3 -1
  157. data/lib/katello/repository_types/file.rb +1 -0
  158. data/lib/katello/repository_types/ostree.rb +3 -1
  159. data/lib/katello/repository_types/puppet.rb +3 -1
  160. data/lib/katello/repository_types/yum.rb +3 -1
  161. data/lib/katello/tasks/delete_orphaned_content.rake +1 -1
  162. data/lib/katello/tasks/reset.rake +1 -0
  163. data/lib/katello/tasks/test.rake +14 -0
  164. data/lib/katello/tasks/unify_hosts.rake +2 -0
  165. data/lib/katello/tasks/virt_who_report.rake +2 -1
  166. data/lib/katello/version.rb +1 -1
  167. data/locale/Makefile +52 -17
  168. data/locale/update-i18n +22 -0
  169. data/package.json +11 -1
  170. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +8 -0
  171. data/webpack/move_to_foreman/components/common/table/components/Table.js +2 -1
  172. data/webpack/move_to_pf/react-bootstrap-select/index.js +4 -2
  173. data/webpack/move_to_pf/test-utils/testHelpers.js +9 -0
  174. data/webpack/redux/OrganizationProducts/OrganizationProductsActions.js +24 -0
  175. data/webpack/redux/OrganizationProducts/OrganizationProductsConstants.js +5 -0
  176. data/webpack/redux/OrganizationProducts/OrganizationProductsReducer.js +38 -0
  177. data/webpack/redux/OrganizationProducts/OrganizationProductsSelectors.js +7 -0
  178. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsActions.test.js +47 -0
  179. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsReducer.test.js +33 -0
  180. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsSelectors.test.js +19 -0
  181. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsActions.test.js.snap +49 -0
  182. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsReducer.test.js.snap +36 -0
  183. data/webpack/redux/OrganizationProducts/__tests__/__snapshots__/OrganizationProductsSelectors.test.js.snap +9 -0
  184. data/webpack/redux/OrganizationProducts/index.js +13 -0
  185. data/webpack/redux/actions/RedHatRepositories/enabled.js +7 -1
  186. data/webpack/redux/actions/RedHatRepositories/helpers.js +4 -0
  187. data/webpack/redux/actions/RedHatRepositories/sets.js +2 -0
  188. data/webpack/redux/reducers/RedHatRepositories/enabled.fixtures.js +8 -2
  189. data/webpack/redux/reducers/RedHatRepositories/enabled.js +1 -1
  190. data/webpack/redux/reducers/RedHatRepositories/sets.fixtures.js +12 -3
  191. data/webpack/redux/reducers/index.js +2 -0
  192. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +68 -33
  193. data/webpack/scenes/RedHatRepositories/index.js +13 -2
  194. data/webpack/scenes/RedHatRepositories/index.scss +26 -0
  195. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -1
  196. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +1 -1
  197. data/webpack/scenes/Subscriptions/SubscriptionActions.js +18 -2
  198. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +8 -0
  199. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +15 -0
  200. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +22 -14
  201. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +39 -90
  202. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +14 -0
  203. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +1 -3
  204. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +0 -1
  205. data/webpack/scenes/Subscriptions/__tests__/SubscriptionHelpers.test.js +84 -0
  206. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +26 -1
  207. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +5 -0
  208. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +177 -75
  209. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +29 -0
  210. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionHelpers.test.js.snap +31 -0
  211. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +32 -0
  212. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +18 -96
  213. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +511 -0
  214. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +26 -0
  215. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +6 -1
  216. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +3 -21
  217. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +113 -0
  218. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.test.js +47 -0
  219. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +504 -0
  220. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/index.js +1 -0
  221. data/webpack/scenes/Subscriptions/index.js +15 -4
  222. metadata +59 -14
  223. data/app/lib/actions/pulp/repository/associate_distributor.rb +0 -20
  224. data/app/lib/actions/pulp/repository/associate_importer.rb +0 -23
  225. data/app/lib/actions/pulp/repository/delete_distributor.rb +0 -18
  226. data/app/lib/actions/pulp/repository/refresh_distributor.rb +0 -19
  227. data/app/lib/actions/pulp/repository/update_importer.rb +0 -33
  228. data/app/lib/katello/bulk_actions.rb +0 -63
  229. data/webpack/move_to_foreman/components/common/EmptyState/index.js +0 -68
@@ -11,6 +11,7 @@ module Actions
11
11
  consumer_uuid: host.content_facet.uuid,
12
12
  type: 'package_group',
13
13
  args: groups)
14
+ plan_self(:host_id => host.id)
14
15
  end
15
16
 
16
17
  def humanized_name
@@ -29,6 +30,11 @@ module Actions
29
30
  def rescue_strategy
30
31
  Dynflow::Action::Rescue::Skip
31
32
  end
33
+
34
+ def finalize
35
+ host = ::Host.find_by(:id => input[:host_id])
36
+ host.update(audit_comment: _("Removal of package group(s) requested: %{groups}") % {groups: input[:groups].join(", ")})
37
+ end
32
38
  end
33
39
  end
34
40
  end
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Host
4
4
  class RecalculateErrataStatus < Actions::Base
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  def run
8
6
  ::Host.unscoped.find_each do |host|
9
7
  begin
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Host
4
4
  class RemoveSubscriptions < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  def plan(host, pools_with_quantities_params)
8
6
  action_subject(host)
9
7
  pool_ids = []
@@ -5,6 +5,7 @@ module Actions
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
7
  def plan(host, consumer_params = nil)
8
+ input[:hostname] = host.name
8
9
  action_subject host
9
10
  sequence do
10
11
  host.content_facet.save! if host.content_facet
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Host
4
4
  class UpdateContentOverrides < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  def plan(host, content_override_params, prune_invalid_content_overrides = true)
8
6
  action_subject(host)
9
7
  fail _("This Host is not currently registered with subscription-manager.") unless host.subscription_facet
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Host
4
4
  class UploadPackageProfile < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  def plan(host, profile_string)
8
6
  action_subject host
9
7
 
@@ -29,28 +27,31 @@ module Actions
29
27
  Dynflow::Action::Rescue::Skip
30
28
  end
31
29
 
32
- def run
33
- profile = JSON.parse(input[:profile_string])
34
- #free the huge string from the memory
35
- input[:profile_string] = 'TRIMMED'.freeze
36
-
37
- host = ::Host.find_by(:id => input[:host_id])
30
+ def self.upload(host_id, profile)
31
+ host = ::Host.find_by(:id => host_id)
38
32
  if host.nil?
39
- Rails.logger.warn("Host with ID %s not found, continuing" % input[:host_id])
33
+ Rails.logger.warn("Host with ID %s not found, continuing" % host_id)
40
34
  elsif host.content_facet.nil? || host.content_facet.uuid.nil?
41
- Rails.logger.warn("Host with ID %s has no content facet, continuing" % input[:host_id])
35
+ Rails.logger.warn("Host with ID %s has no content facet, continuing" % host_id)
42
36
  else
43
37
  begin
44
38
  ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_package_profile(profile)
45
39
  simple_packages = profile.map { |item| ::Katello::Pulp::SimplePackage.new(item) }
46
40
  host.import_package_profile(simple_packages)
47
41
  rescue RestClient::ResourceNotFound
48
- Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % input[:host_id])
42
+ Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host_id)
49
43
  rescue ActiveRecord::InvalidForeignKey # this happens if the host gets deleted in between the "find_by" and "import_package_profile"
50
- Rails.logger.warn("Host installed package list with ID %s was not able to be written to the DB (host likely is deleted), continuing" % input[:host_id])
44
+ Rails.logger.warn("Host installed package list with ID %s was not able to be written to the DB (host likely is deleted), continuing" % host_id)
51
45
  end
52
46
  end
53
47
  end
48
+
49
+ def run
50
+ profile = JSON.parse(input[:profile_string])
51
+ #free the huge string from the memory
52
+ input[:profile_string] = 'TRIMMED'.freeze
53
+ UploadPackageProfile.upload(input[:host_id], profile)
54
+ end
54
55
  end
55
56
  end
56
57
  end
@@ -0,0 +1,70 @@
1
+ module Actions
2
+ module Katello
3
+ module Host
4
+ class UploadProfiles < Actions::EntryAction
5
+ middleware.use Actions::Middleware::KeepCurrentUser
6
+
7
+ def plan(host, profile_string)
8
+ action_subject host
9
+
10
+ sequence do
11
+ plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
12
+ plan_action(GenerateApplicability, [host])
13
+ end
14
+ end
15
+
16
+ def humanized_name
17
+ if input.try(:[], :hostname)
18
+ _("Combined Profile Update for %s") % input[:hostname]
19
+ else
20
+ _('Combined Profile Update')
21
+ end
22
+ end
23
+
24
+ def resource_locks
25
+ :link
26
+ end
27
+
28
+ def rescue_strategy
29
+ Dynflow::Action::Rescue::Skip
30
+ end
31
+
32
+ def import_module_streams(payload, host)
33
+ enabled_payload = payload.map do |profile|
34
+ profile.slice("name", "stream", "version", "context", "arch") if profile["status"] == "enabled"
35
+ end
36
+ enabled_payload.compact!
37
+
38
+ ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_module_stream_profile(enabled_payload)
39
+ host.import_module_streams(payload)
40
+ rescue RestClient::ResourceNotFound
41
+ Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % input[:host_id])
42
+ end
43
+
44
+ def run
45
+ profiles = JSON.parse(input[:profile_string])
46
+ #free the huge string from the memory
47
+ input[:profile_string] = 'TRIMMED'.freeze
48
+ host = ::Host.find_by(:id => input[:host_id])
49
+ if host.nil?
50
+ Rails.logger.warn("Host with ID %s not found, continuing" % input[:host_id])
51
+ elsif host.content_facet.nil? || host.content_facet.uuid.nil?
52
+ Rails.logger.warn("Host with ID %s has no content facet, continuing" % input[:host_id])
53
+ else
54
+ profiles.each do |profile|
55
+ payload = profile["profile"]
56
+ case profile["content_type"]
57
+ when "rpm"
58
+ UploadPackageProfile.upload(input[:host_id], payload)
59
+ when "enabled_repos"
60
+ host.import_enabled_repositories(payload)
61
+ else
62
+ import_module_streams(payload, host)
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Product
4
4
  class ReindexSubscriptions < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  input_format do
8
6
  param :id
9
7
  end
@@ -8,11 +8,11 @@ module Actions
8
8
  ssl_client_key_id = product.ssl_client_key_id
9
9
  # Plan Repository::Update only for repositories which have different certs key
10
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)
11
+ if (repo.root.ssl_ca_cert_id != ssl_ca_cert_id ||
12
+ repo.root.ssl_client_cert_id != ssl_client_cert_id ||
13
+ repo.root.ssl_client_key_id != ssl_client_key_id)
14
14
  plan_action(::Actions::Katello::Repository::Update,
15
- repo,
15
+ repo.root,
16
16
  :ssl_ca_cert_id => ssl_ca_cert_id,
17
17
  :ssl_client_cert_id => ssl_client_cert_id,
18
18
  :ssl_client_key_id => ssl_client_key_id)
@@ -6,9 +6,9 @@ module Actions
6
6
  key_id = product.gpg_key_id
7
7
  # Plan Repository::Update only for repositories which have different gpg key
8
8
  product.repositories.each do |repo|
9
- if repo.gpg_key_id != key_id
9
+ if repo.root.gpg_key_id != key_id
10
10
  plan_action(::Actions::Katello::Repository::Update,
11
- repo,
11
+ repo.root,
12
12
  :gpg_key_id => key_id)
13
13
  end
14
14
  end
@@ -14,13 +14,25 @@ module Actions
14
14
  source_repo = ::Katello::Repository.find(input[:source_repo_id])
15
15
  target_repo = ::Katello::Repository.find(input[:target_repo_id])
16
16
 
17
- srpms_match = srpms_match?(source_repo, target_repo)
18
- rpms = rpms_match?(source_repo, target_repo)
19
- errata = errata_match?(source_repo, target_repo)
20
- package_groups = package_groups_match?(source_repo, target_repo)
21
- distributions = distributions_match?(source_repo, target_repo)
17
+ if source_repo.content_type == ::Katello::Repository::YUM_TYPE
18
+ srpms_match = srpms_match?(source_repo, target_repo)
19
+ rpms = rpms_match?(source_repo, target_repo)
20
+ errata = errata_match?(source_repo, target_repo)
21
+ package_groups = package_groups_match?(source_repo, target_repo)
22
+ distributions = distributions_match?(source_repo, target_repo)
22
23
 
23
- output[:matching_content] = srpms_match && rpms && errata && package_groups && distributions && target_repo.published?
24
+ output[:matching_content] = srpms_match && rpms && errata && package_groups && distributions && target_repo.published?
25
+ end
26
+
27
+ if source_repo.content_type == ::Katello::Repository::DEB_TYPE
28
+ debs = debs_match?(source_repo, target_repo)
29
+
30
+ output[:matching_content] = debs && target_repo.published?
31
+ end
32
+ end
33
+
34
+ def debs_match?(source_repo, target_repo)
35
+ source_repo.deb_ids.sort == target_repo.deb_ids.sort
24
36
  end
25
37
 
26
38
  def srpms_match?(source_repo, target_repo)
@@ -33,7 +33,7 @@ module Actions
33
33
  # Check for matching content before indexing happens, the content in pulp is
34
34
  # actually updated, but it is not reflected in the database yet.
35
35
  output = {}
36
- if target_repo.environment && !options[:force_yum_metadata_regeneration]
36
+ if target_repo.environment
37
37
  output = plan_action(Katello::Repository::CheckMatchingContent,
38
38
  :source_repo_id => source_repo.id,
39
39
  :target_repo_id => target_repo.id).output
@@ -4,7 +4,7 @@ module Actions
4
4
  # Clones the contnet of the repository into the environment
5
5
  # effectively promotion the repository to the environment
6
6
  class CloneToEnvironment < Actions::Base
7
- def plan(repository, environment, options = {})
7
+ def plan(repository, environment)
8
8
  clone = find_or_build_environment_clone(repository, environment)
9
9
 
10
10
  sequence do
@@ -20,11 +20,9 @@ module Actions
20
20
  end
21
21
 
22
22
  if repository.yum?
23
- plan_action(Repository::CloneYumMetadata, repository, clone,
24
- :force_yum_metadata_regeneration => options[:force_yum_metadata_regeneration])
23
+ plan_action(Repository::CloneYumMetadata, repository, clone)
25
24
  elsif repository.deb?
26
- plan_action(Repository::CloneDebContent, repository, clone, [], false,
27
- :force_yum_metadata_regeneration => options[:force_yum_metadata_regeneration])
25
+ plan_action(Repository::CloneDebContent, repository, clone, [], false)
28
26
  elsif repository.docker?
29
27
  plan_action(Repository::CloneDockerContent, repository, clone, [])
30
28
  elsif repository.ostree?
@@ -2,7 +2,7 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class CloneToVersion < Actions::Base
5
- # allows accessing the build object from the superior action
5
+ # allows accessing the built object from the superior action
6
6
  attr_accessor :new_repository
7
7
 
8
8
  def plan(repositories, content_view_version, options = {})
@@ -20,8 +20,7 @@ module Actions
20
20
 
21
21
  if new_repository.link?
22
22
  fail "Cannot clone metadata if more than one repository" if repositories.count > 1
23
- plan_action(Repository::CloneYumMetadata, repositories[0], new_repository,
24
- :force_yum_metadata_regeneration => true)
23
+ plan_action(Repository::CloneYumMetadata, repositories[0], new_repository)
25
24
  else
26
25
  clone_repository_content(repositories, new_repository, filters, incremental, rpm_filenames)
27
26
  end
@@ -4,7 +4,6 @@ module Actions
4
4
  class CloneYumContent < Actions::Base
5
5
  # rubocop:disable MethodLength
6
6
  # rubocop:disable Metrics/CyclomaticComplexity TODO: refactor to push everything into options hash
7
- # rubocop:disable Metrics/PerceivedComplexity
8
7
  def plan(source_repo, target_repo, filters, options = {})
9
8
  generate_metadata = options.fetch(:generate_metadata, true)
10
9
  index_content = options.fetch(:index_content, true)
@@ -62,7 +61,7 @@ module Actions
62
61
  # Check for matching content before indexing happens, the content in pulp is
63
62
  # actually updated, but it is not reflected in the database yet.
64
63
  output = {}
65
- if target_repo.environment && !options[:force_yum_metadata_regeneration]
64
+ if target_repo.environment
66
65
  output = plan_action(Katello::Repository::CheckMatchingContent,
67
66
  :source_repo_id => source_repo.id,
68
67
  :target_repo_id => target_repo.id).output
@@ -2,13 +2,13 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class CloneYumMetadata < Actions::Base
5
- def plan(source_repo, target_repo, options = {})
5
+ def plan(source_repo, target_repo)
6
6
  sequence do
7
7
  # Check for matching content before indexing happens, the content in pulp is
8
8
  # actually updated, but it is not reflected in the database yet.
9
9
  output = {}
10
10
  if !target_repo.root.previous_changes.include?(:unprotected) &&
11
- target_repo.environment && !options[:force_yum_metadata_regeneration]
11
+ target_repo.environment
12
12
  output = plan_action(Katello::Repository::CheckMatchingContent,
13
13
  :source_repo_id => source_repo.id,
14
14
  :target_repo_id => target_repo.id).output
@@ -2,7 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class Create < Actions::EntryAction
5
- # rubocop:disable MethodLength
6
5
  def plan(repository, clone = false, plan_create = false)
7
6
  repository.save!
8
7
  root = repository.root
@@ -10,38 +9,9 @@ module Actions
10
9
  action_subject(repository)
11
10
 
12
11
  org = repository.organization
13
- path = repository.relative_path unless repository.puppet?
14
-
15
12
  create_action = plan_create ? Actions::Pulp::Repository::CreateInPlan : Actions::Pulp::Repository::Create
16
13
  sequence do
17
- certs = repository.importer_connection_options
18
- create_action = plan_action(create_action,
19
- content_type: repository.content_type,
20
- pulp_id: repository.pulp_id,
21
- name: repository.name,
22
- docker_upstream_name: repository.docker_upstream_name,
23
- docker_tags_whitelist: root.docker_tags_whitelist,
24
- feed: repository.url,
25
- ssl_ca_cert: certs[:ssl_ca_cert],
26
- ssl_client_cert: certs[:ssl_client_cert],
27
- ssl_client_key: certs[:ssl_client_key],
28
- unprotected: repository.unprotected,
29
- checksum_type: repository.saved_checksum_type || repository.checksum_type,
30
- path: path,
31
- download_policy: repository.download_policy,
32
- ostree_upstream_sync_depth: root.compute_ostree_upstream_sync_depth,
33
- ostree_publish_depth: root.compute_ostree_upstream_sync_depth,
34
- deb_releases: repository.deb_releases,
35
- deb_components: repository.deb_components,
36
- deb_architectures: repository.deb_architectures,
37
- with_importer: true,
38
- mirror_on_sync: repository.mirror_on_sync?,
39
- ssl_validation: certs[:ssl_validation],
40
- upstream_username: repository.upstream_username,
41
- upstream_password: repository.upstream_password,
42
- repo_registry_id: repository.container_repository_name,
43
- proxy_host: repository.proxy_host_value,
44
- ignorable_content: repository.ignorable_content)
14
+ create_action = plan_action(create_action, repository)
45
15
 
46
16
  return if create_action.error
47
17
 
@@ -3,7 +3,6 @@ module Actions
3
3
  module Repository
4
4
  class Destroy < Actions::EntryAction
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
- middleware.use ::Actions::Middleware::KeepCurrentUser
7
6
 
8
7
  # options:
9
8
  # skip_environment_update - defaults to false. skips updating the CP environment
@@ -26,7 +25,7 @@ module Actions
26
25
  sequence do
27
26
  delete_record(repository) if planned_destroy
28
27
  if repository.redhat?
29
- handle_redhat_content(repository)
28
+ handle_redhat_content(repository) unless skip_environment_update
30
29
  else
31
30
  handle_custom_content(repository) unless skip_environment_update
32
31
  end
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class Export < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  input_format do
8
6
  param :id, Integer
9
7
  param :export_result, Hash
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class FetchPxeFiles < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  input_format do
8
6
  param :id, Integer
9
7
  param :capsule_id, Integer
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class FilteredIndexContent < Actions::EntryAction
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  input_format do
8
6
  param :id, Integer
9
7
  param :filter
@@ -2,8 +2,6 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class FinishUpload < Actions::Base
5
- middleware.use Actions::Middleware::KeepCurrentUser
6
-
7
5
  def plan(repository, options = {})
8
6
  dependency = options.fetch(:dependency, nil)
9
7
  generate_metadata = options.fetch(:generate_metadata, true)