katello 3.17.0.rc2.2 → 3.17.0

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +9 -1
  3. data/app/controllers/katello/api/v2/host_tracer_controller.rb +16 -36
  4. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +12 -1
  5. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +23 -0
  6. data/app/lib/actions/katello/content_view/promote.rb +2 -2
  7. data/app/lib/actions/katello/content_view/promote_to_environment.rb +12 -3
  8. data/app/lib/actions/katello/content_view/publish.rb +18 -2
  9. data/app/lib/actions/katello/content_view_version/import.rb +36 -0
  10. data/app/lib/actions/katello/content_view_version/incremental_update.rb +1 -1
  11. data/app/lib/actions/katello/organization/create.rb +1 -1
  12. data/app/lib/actions/katello/organization/simple_content_access/disable.rb +8 -0
  13. data/app/lib/actions/katello/organization/simple_content_access/enable.rb +8 -0
  14. data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +16 -2
  15. data/app/lib/actions/katello/repository/multi_clone_contents.rb +8 -6
  16. data/app/lib/actions/pulp3/abstract_async_task.rb +1 -0
  17. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +20 -0
  18. data/app/lib/actions/pulp3/content_view_version/destroy_importer.rb +16 -0
  19. data/app/lib/actions/pulp3/content_view_version/import.rb +21 -0
  20. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +25 -0
  21. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +9 -1
  22. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +41 -0
  23. data/app/lib/actions/pulp3/repository/copy_content.rb +6 -1
  24. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +1 -1
  25. data/app/lib/katello/resources/cdn.rb +3 -2
  26. data/app/lib/katello/util/cdn_var_substitutor.rb +9 -7
  27. data/app/models/katello/content_view.rb +6 -0
  28. data/app/models/katello/content_view_version.rb +10 -1
  29. data/app/models/katello/glue/pulp/repo.rb +1 -1
  30. data/app/models/katello/root_repository.rb +5 -1
  31. data/app/overrides/add_organization_attributes.rb +12 -0
  32. data/app/services/katello/host_trace_manager.rb +38 -0
  33. data/app/services/katello/pulp3/content_view_version/export.rb +25 -29
  34. data/app/services/katello/pulp3/content_view_version/import.rb +87 -0
  35. data/app/services/katello/pulp3/content_view_version/import_export_common.rb +44 -0
  36. data/app/services/katello/pulp3/repository/yum.rb +72 -4
  37. data/app/services/katello/pulp3/task.rb +4 -4
  38. data/app/services/katello/pulp3/task_group.rb +6 -0
  39. data/app/services/katello/ui_notifications/subscriptions/sca_disable_error.rb +13 -0
  40. data/app/services/katello/ui_notifications/subscriptions/sca_disable_success.rb +13 -0
  41. data/app/services/katello/ui_notifications/subscriptions/sca_enable_error.rb +13 -0
  42. data/app/services/katello/ui_notifications/subscriptions/sca_enable_success.rb +13 -0
  43. data/app/views/overrides/organizations/_edit_override.html.erb +10 -1
  44. data/app/views/overrides/organizations/_index_header_override.html.erb +3 -0
  45. data/app/views/overrides/organizations/_index_row_override.html.erb +3 -0
  46. data/config/routes/api/v2.rb +1 -6
  47. data/config/routes/overrides.rb +4 -0
  48. data/db/seeds.d/109-katello-notification-blueprints.rb +24 -0
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +2 -5
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-repository-sets.controller.js +4 -3
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-subscriptions.controller.js +2 -4
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +1 -1
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-traces-modal.controller.js +3 -4
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +2 -4
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-repository-sets.controller.js +4 -3
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +2 -4
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-repository-sets.html +1 -1
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
  61. data/lib/katello/permission_creator.rb +1 -1
  62. data/lib/katello/permissions/host_permissions.rb +1 -0
  63. data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
  64. data/lib/katello/tasks/reimport.rake +1 -1
  65. data/lib/katello/version.rb +1 -1
  66. data/webpack/index.js +0 -1
  67. metadata +19 -5
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-traces-resolve.factory.js +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd31f846e3b9c24a2a5881eb6f7c0a43e5cd3f7d05272d4dae99cb04dcc579e9
4
- data.tar.gz: 75d49f944d6d534c49f1e65394ddf1cfee2d3b97aab81032389e2bc815505bd6
3
+ metadata.gz: 45f65da0c274cbc6976755a23d58f5eb77979dceea6cdcb118c1d6445f20b8ad
4
+ data.tar.gz: c5c8d2e9e58744b2389f9910daadc9656040d37364edfb12f48f5f1f06bf1743
5
5
  SHA512:
6
- metadata.gz: 025b2f29030816a1195035f52c39cd3557e6d54c4ccd7adac54c5dff865a856a8754956bb79622fdc8d0e3ada7ebbce8c758c8f181076b1ceb4f23ba32b1a3a6
7
- data.tar.gz: 11cf4ac7f7ee8b40f8138a52bc979685a57f7fe2b522a8a52d00399635e4e9f4e8c704d617e3739985feabf78a9848c4db507f31d8309269f43ede60c5938bf3
6
+ metadata.gz: 5ac6853c42e650e0a410e0f60b5c5a5f58d6d046142fb846fd39a37124a1a43222d0d22377881cf111c3a7984454ddc937f0fc0eeef6b5fb08fc3ac61630b80e
7
+ data.tar.gz: 0c87277e1d4a316b374c2f30b86154a607e4619ee5069c1157f0fe3aa07126e6645591e7eba301eca661b230892f66c7d0bc21c3446ea4fb262b1622c8c4865e
@@ -99,7 +99,7 @@ module Katello
99
99
  :template => '../../../api/v2/content_view_version_export_histories/index')
100
100
  end
101
101
 
102
- api :POST, "/content_view_versions/:id/export", N_("Export a content view version"), :deprecated => true
102
+ api :POST, "/content_view_versions/:id/export", N_("Export a content view version")
103
103
  param :id, :number, :desc => N_("Content view version identifier"), :required => true
104
104
  param :destination_server, String, :desc => N_("Destination Server name, required for Pulp3")
105
105
  param :export_to_iso, :bool, :desc => N_("Export to ISO format. Relevant only for Pulp 2 repositories"), :required => false
@@ -143,6 +143,14 @@ module Katello
143
143
  respond_for_async :resource => task
144
144
  end
145
145
 
146
+ api :POST, "/content_view_versions/import", N_("Import a content view version")
147
+ param :content_view_id, :number, :desc => N_("Content view identifier"), :required => true
148
+ param :path, String, :desc => N_("Import path"), :required => true
149
+ def import
150
+ task = async_task(::Actions::Katello::ContentViewVersion::Import, @view, path: params[:path])
151
+ respond_for_async :resource => task
152
+ end
153
+
146
154
  api :DELETE, "/content_view_versions/:id", N_("Remove content view version")
147
155
  param :id, :number, :desc => N_("Content view version identifier"), :required => true
148
156
  def destroy
@@ -1,6 +1,11 @@
1
1
  module Katello
2
2
  class Api::V2::HostTracerController < Api::V2::ApiController
3
- before_action :find_host, :only => :index
3
+ before_action :find_host
4
+
5
+ resource_description do
6
+ api_version 'v2'
7
+ api_base_url "/api"
8
+ end
4
9
 
5
10
  api :GET, "/hosts/:host_id/traces", N_("List services that need restarting on the host")
6
11
  param :host_id, :number, :required => true, :desc => N_("ID of the host")
@@ -9,43 +14,18 @@ module Katello
9
14
  respond_for_index(:collection => collection)
10
15
  end
11
16
 
12
- api :PUT, "/traces/resolve", N_("Resolve Traces")
17
+ api :PUT, "/hosts/:host_id/traces/resolve", N_("Resolve Traces")
18
+ param :host_id, :number, :required => true, :desc => N_("ID of the host")
13
19
  param :trace_ids, Array, :required => true, :desc => N_("Array of Trace IDs")
14
20
  def resolve
15
- traces = Katello::HostTracer.resolvable.where(id: params[:trace_ids])
16
-
17
- traces.each do |trace|
18
- if trace.reboot_required?
19
- trace.helper = 'reboot'
20
- end
21
- end
22
-
23
- traces_by_host_id = traces.group_by(&:host_id)
24
- traces_by_helper = traces.group_by(&:helper)
25
-
26
- composers = []
27
-
28
- if traces_by_host_id.size < traces_by_helper.size
29
- traces_by_host_id.each do |host_id, trace|
30
- needed_traces = trace.map(&:helper).join(',')
31
- joined_helpers = { :helper => needed_traces }
32
- composers << JobInvocationComposer.for_feature(:katello_service_restart, [host_id], joined_helpers)
33
- end
34
- else
35
- traces_by_helper.each do |helper, trace|
36
- helpers = { :helper => helper }
37
- composers << JobInvocationComposer.for_feature(:katello_service_restart, trace.map(&:host_id), helpers)
38
- end
39
- end
40
-
41
- job_invocations = []
42
-
43
- composers.each do |composer|
44
- composer.trigger
45
- job_invocations << composer.job_invocation
46
- end
47
-
48
- render json: job_invocations
21
+ traces = @host.host_traces.resolvable.where(id: params[:trace_ids])
22
+ fail HttpErrors::BadRequest, _("The requested traces were not found for this host") if traces.empty?
23
+
24
+ result = Katello::HostTraceManager.resolve_traces(traces)
25
+
26
+ task = ForemanTasks::Task.find(result.first.task_id)
27
+
28
+ respond_for_async(resource: task)
49
29
  end
50
30
 
51
31
  protected
@@ -1,4 +1,5 @@
1
1
  module Katello
2
+ # rubocop:disable Metrics/ClassLength
2
3
  class Api::V2::HostsBulkActionsController < Api::V2::ApiController
3
4
  include Concerns::Api::V2::BulkHostsExtensions
4
5
  include Katello::Concerns::Api::V2::ContentOverridesController
@@ -6,7 +7,7 @@ module Katello
6
7
  before_action :find_host_collections, :only => [:bulk_add_host_collections, :bulk_remove_host_collections]
7
8
  before_action :find_environment, :only => [:environment_content_view]
8
9
  before_action :find_content_view, :only => [:environment_content_view]
9
- before_action :find_editable_hosts, :except => [:destroy_hosts, :applicable_errata, :installable_errata]
10
+ before_action :find_editable_hosts, :except => [:destroy_hosts, :applicable_errata, :installable_errata, :resolve_traces]
10
11
  before_action :find_deletable_hosts, :only => [:destroy_hosts]
11
12
  before_action :find_readable_hosts, :only => [:applicable_errata, :installable_errata, :available_incremental_updates]
12
13
  before_action :find_errata, :only => [:available_incremental_updates]
@@ -236,6 +237,16 @@ module Katello
236
237
  respond_for_index(:collection => collection, :template => '../../../api/v2/host_tracer/index')
237
238
  end
238
239
 
240
+ api :PUT, "/hosts/bulk/resolve_traces", N_("Resolve traces for one or more hosts")
241
+ param_group :bulk_params
242
+ param :trace_ids, Array, :required => true, :desc => N_("Array of Trace IDs")
243
+ def resolve_traces
244
+ traces = Katello::HostTracer.resolvable.where(id: params[:trace_ids])
245
+ result = Katello::HostTraceManager.resolve_traces(traces)
246
+
247
+ render json: result
248
+ end
249
+
239
250
  api :POST, "/hosts/bulk/available_incremental_updates", N_("Given a set of hosts and errata, lists the content view versions" \
240
251
  " and environments that need updating.")
241
252
  param_group :bulk_params
@@ -3,8 +3,14 @@ module Katello
3
3
  module OrganizationsControllerExtensions
4
4
  extend ActiveSupport::Concern
5
5
  include ForemanTasks::Triggers
6
+ include Foreman::Controller::Flash
6
7
 
7
8
  module Overrides
9
+ def edit
10
+ @can_toggle_sca = Katello::UpstreamConnectionChecker.new(@taxonomy).can_connect?
11
+ super
12
+ end
13
+
8
14
  def destroy
9
15
  if @taxonomy.is_a?(Organization)
10
16
  begin
@@ -42,6 +48,23 @@ module Katello
42
48
  end
43
49
  end
44
50
 
51
+ def update
52
+ super # we run super first here so that flash messages won't be in a confusing order
53
+ return if params[:simple_content_access].nil?
54
+ sca_param = ::Foreman::Cast.to_bool(params[:simple_content_access])
55
+ if sca_param && !@taxonomy.simple_content_access?
56
+ # user has requested SCA enable
57
+ task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Enable, params[:id])
58
+ info "Enabling Simple Content Access for organization #{@taxonomy.name}.",
59
+ link: { text: "View progress on the Tasks page", href: "/foreman_tasks/tasks/#{task&.id}" }
60
+ elsif !sca_param && @taxonomy.simple_content_access?
61
+ # user has requested SCA disable
62
+ task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Disable, params[:id])
63
+ info "Disabling Simple Content Access for organization #{@taxonomy.name}.",
64
+ link: { text: "View progress on the Tasks page", href: "/foreman_tasks/tasks/#{task&.id}" }
65
+ end
66
+ end
67
+
45
68
  included do
46
69
  prepend Overrides
47
70
  end
@@ -2,7 +2,7 @@ module Actions
2
2
  module Katello
3
3
  module ContentView
4
4
  class Promote < Actions::EntryAction
5
- def plan(version, environments, is_force = false, description = nil)
5
+ def plan(version, environments, is_force = false, description = nil, incremental_update = false)
6
6
  action_subject(version.content_view)
7
7
  version.check_ready_to_promote!(environments)
8
8
 
@@ -13,7 +13,7 @@ module Actions
13
13
  environments.each do |environment|
14
14
  sequence do
15
15
  plan_action(Katello::ContentViewVersion::BeforePromoteHook, :id => version.id)
16
- plan_action(ContentView::PromoteToEnvironment, version, environment, description)
16
+ plan_action(ContentView::PromoteToEnvironment, version, environment, description, incremental_update)
17
17
  plan_action(Katello::ContentViewVersion::AfterPromoteHook, :id => version.id)
18
18
  end
19
19
  end
@@ -3,7 +3,7 @@ module Actions
3
3
  module Katello
4
4
  module ContentView
5
5
  class PromoteToEnvironment < Actions::EntryAction
6
- def plan(version, environment, description)
6
+ def plan(version, environment, description, incremental_update = false)
7
7
  history = ::Katello::ContentViewHistory.create!(:content_view_version => version, :user => ::User.current.login,
8
8
  :environment => environment, :task => self.task,
9
9
  :status => ::Katello::ContentViewHistory::IN_PROGRESS,
@@ -29,8 +29,13 @@ module Actions
29
29
  plan_action(Candlepin::Environment::SetContent, version.content_view, environment, version.content_view.content_view_environment(environment))
30
30
  plan_action(Katello::Foreman::ContentUpdate, environment, version.content_view)
31
31
  plan_action(ContentView::ErrataMail, version.content_view, environment)
32
+
33
+ if incremental_update && sync_proxies?(environment)
34
+ plan_action(ContentView::CapsuleSync, version.content_view, environment)
35
+ end
36
+
32
37
  plan_self(history_id: history.id, environment_id: environment.id, user_id: ::User.current.id,
33
- environment_name: environment.name, content_view_id: version.content_view.id)
38
+ environment_name: environment.name, content_view_id: version.content_view.id, incremental_update: incremental_update)
34
39
  end
35
40
  end
36
41
 
@@ -55,7 +60,7 @@ module Actions
55
60
  history.save!
56
61
  environment = ::Katello::KTEnvironment.find(input[:environment_id])
57
62
 
58
- if ::SmartProxy.sync_needed?(environment) && Setting[:foreman_proxy_content_auto_sync]
63
+ if !input[:incremental_update] && sync_proxies?(environment)
59
64
  ForemanTasks.async_task(ContentView::CapsuleSync,
60
65
  ::Katello::ContentView.find(input[:content_view_id]),
61
66
  environment)
@@ -65,6 +70,10 @@ module Actions
65
70
 
66
71
  private
67
72
 
73
+ def sync_proxies?(environment)
74
+ Setting[:foreman_proxy_content_auto_sync] && ::SmartProxy.sync_needed?(environment)
75
+ end
76
+
68
77
  def repos_to_delete(version, environment)
69
78
  archived_library_instance_ids = version.archived_repos.collect { |archived| archived.library_instance_id }
70
79
  version.content_view.repos(environment).find_all do |repo|
@@ -8,7 +8,9 @@ module Actions
8
8
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
9
9
  def plan(content_view, description = "", options = {})
10
10
  action_subject(content_view)
11
- content_view.check_ready_to_publish!
11
+ import_only = options.fetch(:import_only, false)
12
+ path = options[:path]
13
+ content_view.check_ready_to_publish! unless import_only
12
14
 
13
15
  if options[:repos_units].present?
14
16
  valid_labels_from_cv = content_view.repositories.map(&:label)
@@ -51,7 +53,11 @@ module Actions
51
53
 
52
54
  if separated_repo_map[:pulp3_yum].keys.flatten.present? &&
53
55
  SmartProxy.pulp_primary.pulp3_support?(separated_repo_map[:pulp3_yum].keys.flatten.first)
54
- plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
56
+ if import_only
57
+ handle_import(version, path)
58
+ else
59
+ plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
60
+ end
55
61
  end
56
62
 
57
63
  concurrence do
@@ -181,6 +187,16 @@ module Actions
181
187
  content_view.create_new_version
182
188
  end
183
189
  end
190
+
191
+ def handle_import(version, path)
192
+ plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Import, version, path: path)
193
+ plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
194
+ concurrence do
195
+ version.importable_repositories.pluck(:id).each do |id|
196
+ plan_action(Katello::Repository::IndexContent, id: id)
197
+ end
198
+ end
199
+ end
184
200
  end
185
201
  end
186
202
  end
@@ -0,0 +1,36 @@
1
+ module Actions
2
+ module Katello
3
+ module ContentViewVersion
4
+ class Import < Actions::EntryAction
5
+ PULP_USER = 'pulp'.freeze
6
+
7
+ def plan(content_view, path:)
8
+ content_view.check_ready_to_import!
9
+ unless SmartProxy.pulp_primary.pulp3_repository_type_support?(::Katello::Repository::YUM_TYPE)
10
+ fail HttpErrors::BadRequest, _("This API endpoint is only valid for Pulp 3 repositories.")
11
+ end
12
+ ::Katello::Pulp3::ContentViewVersion::Import.check_permissions!(path)
13
+ metadata = ::Katello::Pulp3::ContentViewVersion::Import.metadata(path)
14
+ major = metadata[:content_view_version][:major]
15
+ minor = metadata[:content_view_version][:minor]
16
+
17
+ if ::Katello::ContentViewVersion.where(major: major, minor: minor, content_view: content_view).exists?
18
+ cvv_name = "#{content_view.name} #{major}.#{minor}"
19
+ fail _("Content View Version specified in the metadata - '%{name}' already exists. "\
20
+ "If you wish to replace the existing version, delete %{name} and try again. " % { name: cvv_name })
21
+ end
22
+
23
+ plan_action(::Actions::Katello::ContentView::Publish, content_view, '',
24
+ path: path,
25
+ import_only: true,
26
+ major: major,
27
+ minor: minor)
28
+ end
29
+
30
+ def humanized_name
31
+ _("Import Content View Version")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -335,7 +335,7 @@ module Actions
335
335
  end
336
336
 
337
337
  def promote(new_version, environments)
338
- plan_action(Katello::ContentView::Promote, new_version, environments, true)
338
+ plan_action(Katello::ContentView::Promote, new_version, environments, true, nil, true)
339
339
  end
340
340
 
341
341
  def copy_deb_content(new_repo, dep_solve, deb_ids)
@@ -17,7 +17,7 @@ module Actions
17
17
  label: organization.label,
18
18
  name: organization.name)
19
19
  end
20
- plan_action(Environment::LibraryCreate, organization.library)
20
+ plan_action(Katello::Environment::LibraryCreate, organization.library)
21
21
  end
22
22
  if cp_create
23
23
  action_subject organization, label: cp_create.output[:response][:key]
@@ -10,6 +10,14 @@ module Actions
10
10
  def humanized_name
11
11
  N_("Disable Simple Content Access")
12
12
  end
13
+
14
+ def task_success_notification
15
+ ::Katello::UINotifications::Subscriptions::SCADisableSuccess
16
+ end
17
+
18
+ def task_error_notification
19
+ ::Katello::UINotifications::Subscriptions::SCADisableError
20
+ end
13
21
  end
14
22
  end
15
23
  end
@@ -10,6 +10,14 @@ module Actions
10
10
  def humanized_name
11
11
  N_("Enable Simple Content Access")
12
12
  end
13
+
14
+ def task_success_notification
15
+ ::Katello::UINotifications::Subscriptions::SCAEnableSuccess
16
+ end
17
+
18
+ def task_error_notification
19
+ ::Katello::UINotifications::Subscriptions::SCAEnableError
20
+ end
13
21
  end
14
22
  end
15
23
  end
@@ -4,6 +4,7 @@ module Actions
4
4
  module SimpleContentAccess
5
5
  class Toggle < Actions::AbstractAsyncTask
6
6
  middleware.use Actions::Middleware::PropagateCandlepinErrors
7
+ include Helpers::Notifications
7
8
 
8
9
  SIMPLE_CONTENT_ACCESS_DISABLED_VALUE = "entitlement".freeze
9
10
  SIMPLE_CONTENT_ACCESS_ENABLED_VALUE = "org_environment".freeze
@@ -12,7 +13,7 @@ module Actions
12
13
 
13
14
  def plan(organization_id)
14
15
  @organization = ::Organization.find(organization_id)
15
-
16
+ action_subject organization
16
17
  ::Katello::Resources::Candlepin::UpstreamConsumer.update(
17
18
  "#{consumer['apiUrl']}#{consumer['uuid']}",
18
19
  consumer['idCert']['cert'],
@@ -24,10 +25,23 @@ module Actions
24
25
  plan_action(::Actions::Katello::Organization::ManifestRefresh, organization)
25
26
  end
26
27
 
28
+ def failure_notification(plan)
29
+ task_error_notification.deliver!(
30
+ :subject => subject_organization,
31
+ :task => get_foreman_task(plan)
32
+ )
33
+ end
34
+
35
+ def success_notification(_plan)
36
+ task_success_notification.deliver!(
37
+ subject_organization
38
+ )
39
+ end
40
+
27
41
  private
28
42
 
29
43
  def consumer
30
- @consumer ||= ::Katello::Resources::Candlepin::UpstreamCandlepinResource.upstream_consumer
44
+ @consumer ||= @organization.owner_details['upstreamConsumer']
31
45
  end
32
46
  end
33
47
  end
@@ -16,14 +16,16 @@ module Actions
16
16
  solve_dependencies: solve_dependencies)
17
17
  end
18
18
 
19
- extended_repo_mapping.each do |source_repos, dest_repo_map|
20
- if generate_metadata
21
- metadata_generate(source_repos, dest_repo_map[:dest_repo], dest_repo_map[:filters])
19
+ concurrence do
20
+ extended_repo_mapping.each do |source_repos, dest_repo_map|
21
+ if generate_metadata
22
+ metadata_generate(source_repos, dest_repo_map[:dest_repo], dest_repo_map[:filters])
23
+ end
22
24
  end
23
- end
24
25
 
25
- extended_repo_mapping.values.each do |dest_repo_map|
26
- plan_action(Katello::Repository::IndexContent, id: dest_repo_map[:dest_repo].id)
26
+ extended_repo_mapping.values.each do |dest_repo_map|
27
+ plan_action(Katello::Repository::IndexContent, id: dest_repo_map[:dest_repo].id)
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -74,6 +74,7 @@ module Actions
74
74
 
75
75
  def cancel
76
76
  pulp_tasks.each { |task| task.cancel }
77
+ task_groups.each { |task_group| task_group.cancel }
77
78
  end
78
79
 
79
80
  def rescue_external_task(error)
@@ -0,0 +1,20 @@
1
+ module Actions
2
+ module Pulp3
3
+ module ContentViewVersion
4
+ class CreateImporter < Pulp3::Abstract
5
+ input_format do
6
+ param :smart_proxy_id, Integer
7
+ param :content_view_version_id, Integer
8
+ param :path, String
9
+ end
10
+
11
+ def run
12
+ cvv = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
13
+ output[:importer_data] = ::Katello::Pulp3::ContentViewVersion::Import.new(smart_proxy: smart_proxy,
14
+ content_view_version: cvv,
15
+ path: input[:path]).create_importer
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end