katello 3.17.0.rc2 → 3.17.2

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +1 -2
  3. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +9 -1
  4. data/app/controllers/katello/api/v2/host_tracer_controller.rb +16 -36
  5. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +12 -1
  6. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +23 -0
  7. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
  8. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +6 -2
  9. data/app/lib/actions/katello/content_view/promote.rb +2 -2
  10. data/app/lib/actions/katello/content_view/promote_to_environment.rb +12 -3
  11. data/app/lib/actions/katello/content_view/publish.rb +18 -2
  12. data/app/lib/actions/katello/content_view_version/import.rb +36 -0
  13. data/app/lib/actions/katello/content_view_version/incremental_update.rb +4 -3
  14. data/app/lib/actions/katello/host/hypervisors_update.rb +18 -0
  15. data/app/lib/actions/katello/organization/create.rb +1 -1
  16. data/app/lib/actions/katello/organization/simple_content_access/disable.rb +8 -0
  17. data/app/lib/actions/katello/organization/simple_content_access/enable.rb +8 -0
  18. data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +16 -2
  19. data/app/lib/actions/katello/repository/multi_clone_contents.rb +8 -6
  20. data/app/lib/actions/pulp3/abstract_async_task.rb +1 -0
  21. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  22. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +20 -0
  23. data/app/lib/actions/pulp3/content_view_version/destroy_importer.rb +16 -0
  24. data/app/lib/actions/pulp3/content_view_version/import.rb +21 -0
  25. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +25 -0
  26. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +9 -1
  27. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +41 -0
  28. data/app/lib/actions/pulp3/repository/copy_content.rb +6 -1
  29. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  30. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +1 -1
  31. data/app/lib/katello/resources/cdn.rb +3 -2
  32. data/app/lib/katello/util/cdn_var_substitutor.rb +9 -7
  33. data/app/models/katello/concerns/redhat_extensions.rb +2 -2
  34. data/app/models/katello/concerns/smart_proxy_extensions.rb +3 -1
  35. data/app/models/katello/content_view.rb +6 -0
  36. data/app/models/katello/content_view_version.rb +10 -1
  37. data/app/models/katello/glue/pulp/repo.rb +1 -1
  38. data/app/models/katello/root_repository.rb +5 -1
  39. data/app/overrides/add_organization_attributes.rb +12 -0
  40. data/app/services/katello/applicability/applicable_content_helper.rb +12 -1
  41. data/app/services/katello/host_trace_manager.rb +38 -0
  42. data/app/services/katello/pulp3/content_view_version/export.rb +25 -29
  43. data/app/services/katello/pulp3/content_view_version/import.rb +87 -0
  44. data/app/services/katello/pulp3/content_view_version/import_export_common.rb +44 -0
  45. data/app/services/katello/pulp3/migration.rb +1 -1
  46. data/app/services/katello/pulp3/repository.rb +8 -4
  47. data/app/services/katello/pulp3/repository/yum.rb +71 -4
  48. data/app/services/katello/pulp3/task.rb +4 -4
  49. data/app/services/katello/pulp3/task_group.rb +6 -0
  50. data/app/services/katello/ui_notifications/subscriptions/sca_disable_error.rb +13 -0
  51. data/app/services/katello/ui_notifications/subscriptions/sca_disable_success.rb +13 -0
  52. data/app/services/katello/ui_notifications/subscriptions/sca_enable_error.rb +13 -0
  53. data/app/services/katello/ui_notifications/subscriptions/sca_enable_success.rb +13 -0
  54. data/app/views/overrides/organizations/_edit_override.html.erb +10 -1
  55. data/app/views/overrides/organizations/_index_header_override.html.erb +3 -0
  56. data/app/views/overrides/organizations/_index_row_override.html.erb +3 -0
  57. data/config/routes/api/v2.rb +1 -6
  58. data/config/routes/overrides.rb +4 -0
  59. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  60. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +5 -2
  61. data/db/seeds.d/109-katello-notification-blueprints.rb +24 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +2 -5
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-repository-sets.controller.js +4 -3
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-subscriptions.controller.js +2 -4
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +1 -1
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-traces-modal.controller.js +3 -4
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +2 -4
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-repository-sets.controller.js +4 -3
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +2 -4
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-repository-sets.html +1 -1
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +1 -1
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
  77. data/lib/katello/permission_creator.rb +1 -1
  78. data/lib/katello/permissions/host_permissions.rb +1 -0
  79. data/lib/katello/tasks/pulp3_content_switchover.rake +3 -1
  80. data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
  81. data/lib/katello/tasks/reimport.rake +1 -1
  82. data/lib/katello/tasks/reports.rake +4 -1
  83. data/lib/katello/version.rb +1 -1
  84. data/webpack/index.js +0 -1
  85. metadata +26 -6
  86. 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: 3c7f446fd8f4d3af288f0bbbf1f5b56bdac0f903d0c55fc332221d2cf2830384
4
- data.tar.gz: 621fc49c5e82b6698a805c7a9b29143bad8b4b17690b94cd6cae3a65de1f33d9
3
+ metadata.gz: cd21c8de383c0f1eb036bb0591ecf77c27ffa30b8f9df1189b0a2da41abfdae4
4
+ data.tar.gz: bd0ec2cd3717b3b5237cc1af00c593a810493fb28866fa7e8344c49725563abc
5
5
  SHA512:
6
- metadata.gz: e88e27186ae85ae6787743e2295b1076e9b6af862a531fc6aec29de59c18a378aa377725b0f7687594fcb8e9d891e6dc3d19e03f26aed3f1e9009eb03c03877d
7
- data.tar.gz: 71d88ce6981546419a0f01f22a634727fdf36e11d164b69366aeabf00eb8ac1490935123c66e0733896ffc158b68b62d61817e4f03329f29cf6873fd1075da58
6
+ metadata.gz: fb2b4ce3ba4395eb68975bdb7d17ebd51fae70374742a0b06aab8c1e01e320a2c732bfd06e3ce0428c767604b864610a3e4480282725facb6e5451b0fbba86d2
7
+ data.tar.gz: 85a4321995088218ab2a92b05e015d8464529ccab3ca8e4ea3a704e28bb04682eede4cc7ea13b151364a7a254413269650af8e424515a476de8e1805e6accc52
@@ -39,8 +39,7 @@ module Katello
39
39
  end
40
40
 
41
41
  def deprecate_katello_agent
42
- ::Foreman::Deprecation.api_deprecation_warning("Remote actions using katello-agent are deprecated and will be removed in Katello 4.0. " \
43
- "You may consider switching to Remote Execution.")
42
+ ::Foreman::Deprecation.api_deprecation_warning("Katello-agent is deprecated and will be removed in a future release.")
44
43
  end
45
44
 
46
45
  def full_result_response(collection)
@@ -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
@@ -9,8 +9,12 @@ module Actions
9
9
 
10
10
  def run
11
11
  input[:host_ids].each do |host_id|
12
- content_facet = ::Host.find(host_id).content_facet
13
- content_facet.calculate_and_import_applicability
12
+ content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id)
13
+ if content_facet.present?
14
+ content_facet.calculate_and_import_applicability
15
+ else
16
+ Rails.logger.warn(_("Content Facet for host with id %s is non-existent. Skipping applicability calculation.") % host_id)
17
+ end
14
18
  end
15
19
  end
16
20
 
@@ -20,10 +20,14 @@ module Actions
20
20
  Actions::Pulp3::CapsuleContent::Sync],
21
21
  repo, smart_proxy,
22
22
  skip_metadata_check: skip_metadata_check)
23
+ end
24
+ end
23
25
 
26
+ concurrence do
27
+ repo_batch.each do |repo|
24
28
  if repo.is_a?(::Katello::Repository) &&
25
- repo.distribution_bootable? &&
26
- repo.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND
29
+ repo.distribution_bootable? &&
30
+ repo.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND
27
31
  plan_action(Katello::Repository::FetchPxeFiles,
28
32
  id: repo.id,
29
33
  capsule_id: smart_proxy.id)
@@ -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
@@ -266,8 +266,9 @@ module Actions
266
266
  history.status = ::Katello::ContentViewHistory::SUCCESSFUL
267
267
  history.save!
268
268
 
269
- unless SmartProxy.pulp_primary.pulp3_support?(version.repositories.first)
270
- version.repositories.each do |repo|
269
+ cvv_yum_repos = version.repositories.yum_type
270
+ unless cvv_yum_repos.empty? || SmartProxy.pulp_primary.pulp3_support?(cvv_yum_repos.first)
271
+ cvv_yum_repos.each do |repo|
271
272
  SmartProxy.pulp_primary.pulp_api.extensions.send(:module_default).
272
273
  copy(repo.library_instance.pulp_id,
273
274
  repo.pulp_id)
@@ -334,7 +335,7 @@ module Actions
334
335
  end
335
336
 
336
337
  def promote(new_version, environments)
337
- plan_action(Katello::ContentView::Promote, new_version, environments, true)
338
+ plan_action(Katello::ContentView::Promote, new_version, environments, true, nil, true)
338
339
  end
339
340
 
340
341
  def copy_deb_content(new_repo, dep_solve, deb_ids)
@@ -13,6 +13,8 @@ module Actions
13
13
  @hypervisors = input[:hypervisors]
14
14
  return unless @hypervisors
15
15
 
16
+ @duplicate_uuid_hypervisors = {}
17
+
16
18
  User.as_anonymous_admin do
17
19
  ActiveRecord::Base.transaction do
18
20
  load_resources
@@ -30,8 +32,16 @@ module Actions
30
32
  update_facts(uuid, host)
31
33
  end
32
34
  end
35
+
36
+ @duplicate_uuid_hypervisors.each do |hypervisor, existing_host|
37
+ fail _("Host creation was skipped for %s because it shares a BIOS UUID with %s. " \
38
+ "To report this hypervisor, override its dmi.system.uuid fact or set 'candlepin.use_system_uuid_for_matching' " \
39
+ "to 'true' in the Candlepin configuration." % [hypervisor[:name], existing_host.name])
40
+ end
33
41
  end
34
42
 
43
+ private
44
+
35
45
  def load_hosts_guests
36
46
  @hosts.each do |uuid, host|
37
47
  host.subscription_facet ||= host.build_subscription_facet(uuid: uuid)
@@ -81,6 +91,14 @@ module Actions
81
91
  @hypervisors.each do |hypervisor|
82
92
  next if @hosts.key?(hypervisor[:uuid])
83
93
 
94
+ created_host = new_hypervisors[hypervisor[:uuid]]
95
+ if created_host
96
+ # we've already created a host record for this duplicate hypervisor
97
+ # track it so we can message later, and continue processing the remaining hypervisors
98
+ @duplicate_uuid_hypervisors[hypervisor] = created_host
99
+ next
100
+ end
101
+
84
102
  duplicate_name, org = duplicate_name(hypervisor, @candlepin_attributes[hypervisor[:uuid]])
85
103
  new_hypervisors[hypervisor[:uuid]] = create_host_for_hypervisor(duplicate_name, org)
86
104
  end
@@ -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