katello 3.16.0.rc1.1 → 3.16.0.rc4

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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/api_controller.rb +8 -4
  3. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  4. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +13 -1
  5. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -0
  6. data/app/controllers/katello/remote_execution_controller.rb +1 -1
  7. data/app/lib/actions/katello/applicability/hosts/{generate.rb → bulk_generate.rb} +11 -2
  8. data/app/lib/actions/katello/applicability/repository/regenerate.rb +7 -2
  9. data/app/lib/actions/katello/host/generate_applicability.rb +7 -2
  10. data/app/lib/actions/katello/host/upload_profiles.rb +20 -11
  11. data/app/lib/actions/katello/repository/sync.rb +1 -2
  12. data/app/lib/actions/katello/repository/update.rb +12 -1
  13. data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +17 -0
  14. data/app/lib/actions/pulp3/ContentGuard/refresh.rb +19 -0
  15. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +6 -8
  16. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +1 -1
  17. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -0
  18. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -0
  19. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +3 -1
  20. data/app/lib/actions/pulp3/repository/save_version.rb +3 -1
  21. data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +15 -0
  22. data/app/lib/katello/concerns/base_template_scope_extensions.rb +5 -1
  23. data/app/lib/katello/errors.rb +25 -0
  24. data/app/lib/katello/logging.rb +14 -0
  25. data/app/lib/katello/resources/candlepin.rb +1 -1
  26. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  27. data/app/lib/katello/util/errata.rb +13 -0
  28. data/app/lib/katello/util/pulpcore_content_filters.rb +32 -0
  29. data/app/models/katello/concerns/host_managed_extensions.rb +7 -0
  30. data/app/models/katello/concerns/http_proxy_extensions.rb +30 -7
  31. data/app/models/katello/concerns/organization_extensions.rb +14 -0
  32. data/app/models/katello/concerns/pulp_database_unit.rb +2 -2
  33. data/app/models/katello/content_view_erratum_filter.rb +29 -0
  34. data/app/models/katello/content_view_package_filter.rb +16 -1
  35. data/app/models/katello/content_view_package_group_filter.rb +7 -0
  36. data/app/models/katello/events/generate_host_applicability.rb +6 -5
  37. data/app/models/katello/glue/candlepin/candlepin_object.rb +9 -5
  38. data/app/models/katello/glue/candlepin/pool.rb +8 -3
  39. data/app/models/katello/glue/provider.rb +11 -4
  40. data/app/models/katello/host/content_facet.rb +1 -1
  41. data/app/models/katello/host_queue_element.rb +4 -0
  42. data/app/models/katello/package_group.rb +2 -1
  43. data/app/models/katello/pool.rb +1 -1
  44. data/app/models/katello/pulp3/content_guard.rb +14 -0
  45. data/app/models/katello/rhsm_fact_parser.rb +4 -0
  46. data/app/models/katello/root_repository.rb +4 -1
  47. data/app/models/setting/content.rb +3 -1
  48. data/app/services/katello/applicable_host_queue.rb +21 -0
  49. data/app/services/katello/candlepin/message_handler.rb +2 -3
  50. data/app/services/katello/pulp/pulp_content_unit.rb +4 -0
  51. data/app/services/katello/pulp3/api/content_guard.rb +45 -0
  52. data/app/services/katello/pulp3/api/yum.rb +24 -0
  53. data/app/services/katello/pulp3/erratum.rb +4 -0
  54. data/app/services/katello/pulp3/pulp_content_unit.rb +4 -0
  55. data/app/services/katello/pulp3/repository.rb +29 -6
  56. data/app/services/katello/pulp3/repository/yum.rb +98 -3
  57. data/app/services/katello/pulp3/rpm.rb +3 -2
  58. data/app/services/katello/ui_notifications/subscriptions/manifest_expired_warning.rb +20 -8
  59. data/app/services/katello/upstream_connection_checker.rb +48 -0
  60. data/app/views/katello/api/v2/srpms/backend.json.rabl +11 -0
  61. data/app/views/katello/api/v2/srpms/base.json.rabl +5 -0
  62. data/app/views/katello/api/v2/srpms/compare.json.rabl +10 -0
  63. data/app/views/katello/api/v2/srpms/index.json.rabl +1 -1
  64. data/app/views/katello/api/v2/srpms/show.json.rabl +3 -3
  65. data/config/routes/api/v2.rb +2 -0
  66. data/db/migrate/20200407171926_create_content_guard.rb +10 -0
  67. data/db/migrate/20200511204005_create_katello_host_queue_elements.rb +12 -0
  68. data/db/migrate/20200526200422_encrypt_root_repository_upstream_password.rb +47 -0
  69. data/db/seeds.d/109-katello-notification-blueprints.rb +1 -1
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +1 -1
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-traces.html +1 -1
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +1 -1
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.factory.js +2 -2
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +367 -450
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +4046 -2509
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +4277 -2503
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +4372 -2591
  78. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +4013 -2500
  79. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +4127 -2630
  80. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +4024 -2530
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +4492 -2766
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +4293 -2667
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +4072 -2460
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +4004 -2442
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +10 -10
  86. data/lib/katello/permission_creator.rb +1 -1
  87. data/lib/katello/version.rb +1 -1
  88. data/locale/action_names.rb +51 -43
  89. data/locale/bn/katello.po +4015 -2558
  90. data/locale/cs/katello.po +3756 -2221
  91. data/locale/de/katello.po +4303 -3044
  92. data/locale/en/katello.po +3137 -1558
  93. data/locale/es/katello.po +4280 -3012
  94. data/locale/fr/katello.po +4302 -3080
  95. data/locale/gu/katello.po +4034 -2584
  96. data/locale/hi/katello.po +4034 -2575
  97. data/locale/it/katello.po +4291 -3040
  98. data/locale/ja/katello.po +4345 -2863
  99. data/locale/katello.pot +2631 -1460
  100. data/locale/kn/katello.po +4033 -2585
  101. data/locale/ko/katello.po +4320 -2815
  102. data/locale/mr/katello.po +3971 -2506
  103. data/locale/or/katello.po +4018 -2559
  104. data/locale/pa/katello.po +3985 -2514
  105. data/locale/pt/katello.po +3358 -1810
  106. data/locale/pt_BR/katello.po +4252 -2959
  107. data/locale/ru/katello.po +4308 -2902
  108. data/locale/ta/katello.po +4012 -2562
  109. data/locale/te/katello.po +4046 -2585
  110. data/locale/zh_CN/katello.po +4344 -2803
  111. data/locale/zh_TW/katello.po +4470 -2957
  112. data/package.json +3 -3
  113. data/webpack/components/Content/ContentTable.js +2 -0
  114. data/webpack/components/Content/Details/ContentDetails.js +3 -0
  115. data/webpack/global_test_setup.js +3 -0
  116. data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetails.js +3 -0
  117. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetails.js +3 -0
  118. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +2 -0
  119. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -0
  120. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +2 -0
  121. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +2 -0
  122. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js +2 -0
  123. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +2 -0
  124. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +2 -0
  125. data/webpack/scenes/Subscriptions/SubscriptionActions.js +19 -21
  126. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +3 -1
  127. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +15 -1
  128. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +66 -9
  129. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +11 -0
  130. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +15 -1
  131. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/{UpstreamSubscriptionsContstants.js → UpstreamSubscriptionsConstants.js} +3 -0
  132. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +2 -0
  133. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +1 -1
  134. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +1 -1
  135. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +10 -34
  136. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +17 -7
  137. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +2 -4
  138. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +6 -4
  139. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +26 -25
  140. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +0 -58
  141. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +10 -4
  142. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +1 -0
  143. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +1 -68
  144. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js +1 -1
  145. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/index.js +4 -4
  146. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +12 -10
  147. data/webpack/scenes/Subscriptions/index.js +11 -4
  148. data/webpack/scenes/Tasks/TaskActions.js +2 -1
  149. data/webpack/test-utils/nockWrapper.js +1 -1
  150. metadata +54 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49e88fab5fb43375d053afea798096a12e7141395144dfab26d48323e304fbac
4
- data.tar.gz: ee2095edb5cb2ce6f48966c9f7a7f73ee893f2d5c08e31930d080e8b07895321
3
+ metadata.gz: 590a33ff3016ad29aaeca6e8d5a0c967b9053a01cf3dbf8f28fcb68b63d056bd
4
+ data.tar.gz: e8c30ca9e88f472f3aabf89b7f2cc3c6122750706e9bdfbb9d1cfa8aa957d4a5
5
5
  SHA512:
6
- metadata.gz: 27d9a1ab44ddd37d5ec67ebdcb918be9a0f86cf179a02c5e93b1188cf461fcd31c3205cd4748c893aa24f940dfd0f599b8649abef5291161b02fbdaf9a99778e
7
- data.tar.gz: 9ecb92e8ff4000c0564762fc4eb2355a0c265e34f97e2ebe47c6e6636afc17d320519dfc0d73fe83d7e44ee7dd1d8a23f96e3e5a1fdcab8f0c1a9f62cabc4d83
6
+ metadata.gz: 2fbba71f828db21edacf4100aac226a638fa7c6dd59871f6d0f029846af27ff54914c803798fd6054463ae4f44bbfc29d9466fca8a19867e63c10486668ce30c
7
+ data.tar.gz: 17347500daf6bb1b2dd1ff7126b97e84f2120e1c12e23066036d2f30402cdb9018dc5c6cb1f74ceff441f069a2733dceb4e3a4958032237034eaff5783915b49
@@ -211,10 +211,14 @@ module Katello
211
211
  fail HttpErrors::BadRequest, _("Host has not been registered with subscription-manager") if @host.subscription_facet.nil?
212
212
  end
213
213
 
214
- def check_disconnected
215
- msg = "You are currently operating in disconnected mode where access to Red Hat Subcription Management " \
216
- "is prohibited. If you would like to change this, please update the content setting 'Disconnected mode'."
217
- fail HttpErrors::BadRequest, _(msg) if Setting[:content_disconnected]
214
+ def check_upstream_connection
215
+ checker = Katello::UpstreamConnectionChecker.new(@organization)
216
+
217
+ begin
218
+ checker.assert_connection
219
+ rescue => e
220
+ raise HttpErrors::BadRequest, e.message
221
+ end
218
222
  end
219
223
  end
220
224
  end
@@ -7,7 +7,7 @@ module Katello
7
7
  before_action :find_optional_organization, :only => [:index, :available, :show]
8
8
  before_action :find_organization, :only => [:upload, :delete_manifest,
9
9
  :refresh_manifest, :manifest_history]
10
- before_action :check_disconnected, only: [:refresh_manifest]
10
+ before_action :check_upstream_connection, only: [:refresh_manifest]
11
11
  before_action :find_provider
12
12
 
13
13
  skip_before_action :check_content_type, :only => [:upload]
@@ -1,6 +1,7 @@
1
1
  module Katello
2
2
  class Api::V2::UpstreamSubscriptionsController < Api::V2::ApiController
3
- before_action :check_disconnected
3
+ before_action :find_organization
4
+ before_action :check_upstream_connection
4
5
 
5
6
  resource_description do
6
7
  description "Red Hat subscriptions management platform."
@@ -65,6 +66,17 @@ module Katello
65
66
  respond_for_async resource: task
66
67
  end
67
68
 
69
+ api :GET, "/organizations/:organization_id/upstream_subscriptions/ping",
70
+ N_("Check if a connection can be made to Red Hat Subscription Management.")
71
+ def ping
72
+ # This API raises an error if:
73
+ # - Katello is in disconnected mode
74
+ # - There is no manifest imported
75
+ # - The local manifest identity certs have expired
76
+ # - The manifest has been deleted upstream
77
+ render json: { status: 'OK' }
78
+ end
79
+
68
80
  private
69
81
 
70
82
  def update_params
@@ -18,6 +18,17 @@ module Katello
18
18
  included do
19
19
  prepend Overrides
20
20
 
21
+ def update_multiple_taxonomies(type)
22
+ registered_host = @hosts.detect { |host| host.subscription_facet }
23
+ unless registered_host.nil?
24
+ error _("Unregister host %s before assigning an organization") % registered_host.name
25
+ redirect_back_or_to hosts_path
26
+ return
27
+ end
28
+
29
+ super
30
+ end
31
+
21
32
  def destroy
22
33
  if Katello::RegistrationManager.unregister_host(@host, :unregistering => false)
23
34
  process_success redirection_url_on_host_deletion
@@ -43,7 +43,7 @@ module Katello
43
43
  end
44
44
 
45
45
  def errata_inputs
46
- if params[:install_all]
46
+ if ::Foreman::Cast.to_bool(params[:install_all])
47
47
  Erratum.installable_for_hosts(hosts).pluck(:errata_id).join(',')
48
48
  else
49
49
  params[:name]
@@ -2,17 +2,26 @@ module Actions
2
2
  module Katello
3
3
  module Applicability
4
4
  module Hosts
5
- class Generate < Actions::EntryAction
5
+ class BulkGenerate < Actions::EntryAction
6
6
  input_format do
7
7
  param :host_ids, Array
8
8
  end
9
9
 
10
10
  def run
11
11
  input[:host_ids].each do |host_id|
12
- ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, host_id)
12
+ content_facet = ::Host.find(host_id).content_facet
13
+ content_facet.calculate_and_import_applicability
13
14
  end
14
15
  end
15
16
 
17
+ def queue
18
+ ::Katello::HOST_TASKS_QUEUE
19
+ end
20
+
21
+ def resource_locks
22
+ :link
23
+ end
24
+
16
25
  def humanized_name
17
26
  _("Bulk generate applicability for hosts")
18
27
  end
@@ -11,9 +11,14 @@ module Actions
11
11
  end
12
12
 
13
13
  def run
14
- ::Katello::Repository.find(input[:repo_id]).content_facets.each do |facet|
15
- ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, facet.host.id)
14
+ host_ids = ::Katello::Repository.find(input[:repo_id]).hosts_with_applicability.pluck(:id)
15
+ return if host_ids.empty?
16
+
17
+ host_ids.each do |host_id|
18
+ ::Katello::ApplicableHostQueue.push_host(host_id)
16
19
  end
20
+
21
+ ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
17
22
  end
18
23
 
19
24
  def humanized_name
@@ -8,7 +8,7 @@ module Actions
8
8
 
9
9
  def plan(hosts, use_queue = true)
10
10
  if SETTINGS[:katello][:katello_applicability]
11
- plan_action(::Actions::Katello::Applicability::Hosts::Generate, host_ids: hosts.pluck(:id))
11
+ plan_self(:host_ids => hosts.map(&:id))
12
12
  else
13
13
  uuids = hosts.map { |host| host.content_facet.try(:uuid) }.compact
14
14
  unless uuids.empty?
@@ -19,7 +19,12 @@ module Actions
19
19
  end
20
20
 
21
21
  def finalize
22
- unless SETTINGS[:katello][:katello_applicability]
22
+ if SETTINGS[:katello][:katello_applicability]
23
+ input[:host_ids].each do |host_id|
24
+ ::Katello::ApplicableHostQueue.push_host(host_id)
25
+ end
26
+ ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
27
+ else
23
28
  input[:host_ids].each do |host_id|
24
29
  if input[:use_queue]
25
30
  ::Katello::EventQueue.push_event(::Katello::Events::ImportHostApplicability::EVENT_TYPE, host_id)
@@ -38,15 +38,18 @@ module Actions
38
38
  ::Katello::ModuleStream.where(profile.slice(:name, :stream))
39
39
  end
40
40
 
41
- query_name_streams = query_name_streams.inject(&:or)
41
+ updated_profiles = []
42
+ unless query_name_streams.empty?
43
+ query_name_streams = query_name_streams.inject(&:or)
42
44
 
43
- bound_library_instances = host.content_facet.bound_repositories.map(&:library_instance_or_self)
44
- query = ::Katello::ModuleStream.in_repositories(bound_library_instances).
45
- select(:name, :stream, :version, :context, :arch).
46
- merge(query_name_streams)
45
+ bound_library_instances = host.content_facet.bound_repositories.map(&:library_instance_or_self)
46
+ query = ::Katello::ModuleStream.in_repositories(bound_library_instances).
47
+ select(:name, :stream, :version, :context, :arch).
48
+ merge(query_name_streams)
47
49
 
48
- updated_profiles = query.map do |module_stream|
49
- module_stream.slice(:name, :stream, :version, :context, :arch)
50
+ updated_profiles = query.map do |module_stream|
51
+ module_stream.slice(:name, :stream, :version, :context, :arch)
52
+ end
50
53
  end
51
54
 
52
55
  # We also need to pass module streams that are not found in the ModuleStream table
@@ -55,10 +58,16 @@ module Actions
55
58
  updated_profiles.none? { |p| p[:name] == profile[:name] && p[:stream] == profile[:stream] }
56
59
  end
57
60
 
58
- ::Katello::Pulp::Consumer.new(host.content_facet.uuid).
59
- upload_module_stream_profile(updated_profiles + unassociated_profiles)
60
- rescue RestClient::ResourceNotFound
61
- Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
61
+ module_stream_profile = updated_profiles + unassociated_profiles
62
+
63
+ unless module_stream_profile.empty?
64
+ begin
65
+ ::Katello::Pulp::Consumer.new(host.content_facet.uuid).
66
+ upload_module_stream_profile(module_stream_profile)
67
+ rescue RestClient::ResourceNotFound
68
+ Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
69
+ end
70
+ end
62
71
  end
63
72
 
64
73
  def import_module_streams(payload, host)
@@ -26,8 +26,7 @@ module Actions
26
26
  incremental = options.fetch(:incremental, false)
27
27
  validate_contents = options.fetch(:validate_contents, false)
28
28
  skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && repo.yum?)
29
- # TODO: Remove the check for Pulp 3 once Pulp 3 errata is working fully
30
- generate_applicability = repo.yum? && !SmartProxy.pulp_master.pulp3_support?(repo)
29
+ generate_applicability = repo.yum?
31
30
 
32
31
  fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
33
32
  fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
@@ -10,6 +10,8 @@ module Actions
10
10
  action_subject root.library_instance
11
11
 
12
12
  repo_params[:url] = nil if repo_params[:url] == ''
13
+ update_cv_cert_protected = (repo_params[:unprotected] != repository.unprotected)
14
+
13
15
  root.update!(repo_params)
14
16
 
15
17
  if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
@@ -44,15 +46,24 @@ module Actions
44
46
  ::Actions::Pulp3::Orchestration::Repository::Update],
45
47
  repository,
46
48
  SmartProxy.pulp_master)
47
- plan_self(:repository_id => root.library_instance.id)
49
+ plan_self(:repository_id => root.library_instance.id, :update_cv_cert_protected => update_cv_cert_protected)
48
50
  end
49
51
  end
50
52
 
51
53
  def run
52
54
  repository = ::Katello::Repository.find(input[:repository_id])
55
+ output[:repository_id] = input[:repository_id]
56
+ output[:update_cv_cert_protected] = input[:update_cv_cert_protected]
53
57
  ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository)
54
58
  end
55
59
 
60
+ def finalize
61
+ repository = ::Katello::Repository.find(output[:repository_id])
62
+ if output[:update_cv_cert_protected]
63
+ ForemanTasks.async_task(::Actions::Katello::Repository::UpdateCVRepoCertGuard, repository, SmartProxy.pulp_master)
64
+ end
65
+ end
66
+
56
67
  private
57
68
 
58
69
  def update_content?(repository)
@@ -0,0 +1,17 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class UpdateCVRepoCertGuard < Actions::Base
5
+ include Actions::Katello::PulpSelector
6
+
7
+ def plan(repository, smart_proxy)
8
+ plan_optional_pulp_action([::Actions::Pulp3::Repository::UpdateCVRepositoryCertGuard], repository, smart_proxy)
9
+ end
10
+
11
+ def humanized_name
12
+ _("Updating repository authentication configuration")
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Actions
2
+ module Pulp3
3
+ module ContentGuard
4
+ class Refresh < Pulp3::Abstract
5
+ def plan(smart_proxy, options = {})
6
+ return if (::Katello::Pulp3::ContentGuard.count > 0 || options.try(:[], :update))
7
+ content_guard_api = ::Katello::Pulp3::Api::ContentGuard.new(smart_proxy)
8
+ if options.try(:[], :update)
9
+ content_guard_href = ::Katello::Pulp3::ContentGuard.first.href
10
+ content_guard_api.partial_update content_guard_href
11
+ else
12
+ content_guard_api.create
13
+ ::Katello::Pulp3::ContentGuard.import(smart_proxy)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -13,25 +13,23 @@ module Actions
13
13
  if filter_ids.present? || rpm_filenames.present? || source_repositories.length > 1
14
14
  sequence do
15
15
  if filter_ids.present? || rpm_filenames.present?
16
- copy_action = plan_action(Actions::Pulp3::Repository::CopyContent,
17
- source_repositories.first, smart_proxy, target_repo,
16
+ copy_action = plan_action(Actions::Pulp3::Repository::CopyContent, source_repositories.first, smart_proxy, target_repo,
18
17
  filter_ids: filter_ids, solve_dependencies: solve_dependencies,
19
18
  rpm_filenames: rpm_filenames)
20
-
21
- plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_action.output[:pulp_tasks])
19
+ plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
20
+ repository_details: { latest_version_href: copy_action.output[:latest_version_href] }, tasks: copy_action.output[:pulp_tasks])
22
21
  else
23
22
  #if we are not filtering, copy the version to the cv repository, and the units for each additional repo
24
23
  action = plan_action(Actions::Pulp3::Repository::CopyVersion, source_repositories.first, smart_proxy, target_repo)
25
- plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: action.output[:pulp_tasks])
24
+ plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
25
+ repository_details: { latest_version_href: action.output[:latest_version_output] }, tasks: action.output[:pulp_tasks])
26
26
  copy_actions = []
27
27
  #since we're creating a new version from the first repo, start copying at the 2nd
28
28
  source_repositories[1..-1].each do |source_repo|
29
- copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent,
30
- source_repo, smart_proxy, target_repo,
29
+ copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent, source_repo, smart_proxy, target_repo,
31
30
  filter_ids: filter_ids, solve_dependencies: solve_dependencies,
32
31
  rpm_filenames: rpm_filenames)
33
32
  end
34
-
35
33
  plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_actions.last.output[:pulp_tasks])
36
34
  end
37
35
  end
@@ -12,7 +12,7 @@ module Actions
12
12
  elsif publication_content_type
13
13
  plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options)
14
14
  end
15
-
15
+ plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
16
16
  plan_action(Actions::Pulp3::Repository::RefreshDistribution, repository, smart_proxy, :contents_changed => options[:contents_changed]) if repository.environment
17
17
  end
18
18
  end
@@ -11,6 +11,7 @@ module Actions
11
11
  def invoke_external_task
12
12
  source = ::Katello::Repository.find(input[:source_repository_id])
13
13
  target = ::Katello::Repository.find(input[:target_repository_id] || input[:target_repository])
14
+ output[:latest_version_href] = target.backend_service(smart_proxy).read.latest_version_href
14
15
  output[:pulp_tasks] = target.backend_service(smart_proxy).copy_content_for_source(source, input)
15
16
  end
16
17
  end
@@ -9,6 +9,7 @@ module Actions
9
9
  sequence do
10
10
  options = {:repository_id => repository.id, :smart_proxy_id => smart_proxy.id}
11
11
  options[:contents_changed] if options.key?(:contents_changed)
12
+ plan_action(::Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
12
13
  action = plan_self(options)
13
14
  plan_action(SaveDistributionReferences, repository, smart_proxy,
14
15
  action.output, :contents_changed => options[:contents_changed])
@@ -12,9 +12,11 @@ module Actions
12
12
  if input[:tasks] && input[:tasks][:pulp_tasks] && input[:tasks][:pulp_tasks].first
13
13
  distribution_hrefs = input[:tasks][:pulp_tasks].map { |task| task[:created_resources].first }
14
14
  distribution_hrefs.compact!
15
+ repo = ::Katello::Repository.find(input[:repository_id])
15
16
  if distribution_hrefs.any?
16
- repo = ::Katello::Repository.find(input[:repository_id])
17
17
  repo.backend_service(smart_proxy).save_distribution_references(distribution_hrefs)
18
+ else
19
+ repo.backend_service(smart_proxy).update_distribution
18
20
  end
19
21
  end
20
22
  end
@@ -11,7 +11,9 @@ module Actions
11
11
 
12
12
  if input[:tasks]
13
13
  version_href = input[:tasks].last[:created_resources].first
14
- elsif input[:repository_details]
14
+ end
15
+
16
+ if !version_href && input[:repository_details]
15
17
  version_href = input[:repository_details][:latest_version_href]
16
18
  end
17
19
 
@@ -0,0 +1,15 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Repository
4
+ class UpdateCVRepositoryCertGuard < Pulp3::Abstract
5
+ def plan(repository, _smart_proxy)
6
+ root = repository.root
7
+ cv_repositories = root.repositories - [root.library_instance]
8
+ cv_repositories.each do |repo|
9
+ plan_action(::Actions::Pulp3::Repository::RefreshDistribution, repo, SmartProxy.pulp_master)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -9,7 +9,7 @@ module Katello
9
9
  :host_latest_applicable_rpm_version, :load_pools, :load_errata_applications, :host_content_facet,
10
10
  :host_sla, :host_products, :sub_name, :sub_sku, :registered_through, :last_checkin, :host_collections,
11
11
  :host_subscriptions_names, :host_subscriptions, :host_products_names, :host_collections_names,
12
- :host_redhat_subscription_names]
12
+ :host_redhat_subscription_names, :registered_at]
13
13
  end
14
14
  end
15
15
 
@@ -76,6 +76,10 @@ module Katello
76
76
  host_subscription_facet(host)&.registered_through
77
77
  end
78
78
 
79
+ def registered_at(host)
80
+ host_subscription_facet(host)&.registered_at
81
+ end
82
+
79
83
  def host_applicable_errata_ids(host)
80
84
  host.applicable_errata.map(&:errata_id)
81
85
  end
@@ -39,6 +39,12 @@ module Katello
39
39
  end
40
40
  end
41
41
 
42
+ class HostRegisteredException < StandardError
43
+ def message
44
+ _("Content host must be unregistered before performing this action.")
45
+ end
46
+ end
47
+
42
48
  class EmptyBulkActionException < StandardError
43
49
  def message
44
50
  _("No hosts registered with subscription-manager found in selection.")
@@ -154,5 +160,24 @@ module Katello
154
160
  _("No URL found for a container registry. Please check the configuration.")
155
161
  end
156
162
  end
163
+
164
+ class DisconnectedMode < StandardError
165
+ def message
166
+ _("You are currently operating in disconnected mode where access to Red Hat Subcription Management " \
167
+ "is prohibited. If you would like to change this, please update the content setting 'Disconnected mode'.")
168
+ end
169
+ end
170
+
171
+ class NoManifestImported < StandardError
172
+ def message
173
+ _("Current organization has no manifest imported.")
174
+ end
175
+ end
176
+
177
+ class ManifestExpired < StandardError
178
+ def message
179
+ _("This Organization's subscription manifest has expired. Please import a new manifest.")
180
+ end
181
+ end
157
182
  end
158
183
  end