katello 3.16.0.rc3.1 → 3.16.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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  4. data/app/controllers/katello/api/v2/api_controller.rb +9 -4
  5. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
  6. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
  7. data/app/controllers/katello/api/v2/content_views_controller.rb +7 -0
  8. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  9. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +13 -1
  10. data/app/controllers/katello/concerns/api/v2/associations_permission_check.rb +67 -0
  11. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -0
  12. data/app/helpers/katello/content_view_helper.rb +15 -0
  13. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +4 -0
  14. data/app/lib/actions/katello/capsule_content/sync.rb +0 -4
  15. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +16 -16
  16. data/app/lib/actions/katello/content_view/incremental_updates.rb +8 -1
  17. data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +2 -1
  18. data/app/lib/actions/katello/content_view/publish.rb +55 -16
  19. data/app/lib/actions/katello/content_view_version/incremental_update.rb +120 -26
  20. data/app/lib/actions/katello/host/attach_subscriptions.rb +5 -1
  21. data/app/lib/actions/katello/repository/multi_clone_contents.rb +66 -0
  22. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
  23. data/app/lib/actions/katello/sync_plan/run.rb +1 -1
  24. data/app/lib/actions/pulp/abstract_async_task.rb +1 -0
  25. data/app/lib/actions/pulp/consumer/sync_capsule.rb +8 -0
  26. data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +2 -2
  27. data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
  28. data/app/lib/actions/pulp3/content_migration.rb +4 -0
  29. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +1 -2
  30. data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
  31. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
  32. data/app/lib/actions/pulp3/repository/multi_copy_units.rb +55 -0
  33. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -1
  34. data/app/lib/actions/pulp3/repository/save_version.rb +11 -3
  35. data/app/lib/actions/pulp3/repository/save_versions.rb +73 -0
  36. data/app/lib/katello/concerns/base_template_scope_extensions.rb +0 -14
  37. data/app/lib/katello/errors.rb +26 -15
  38. data/app/lib/katello/resources/candlepin.rb +1 -1
  39. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  40. data/app/models/katello/concerns/host_managed_extensions.rb +7 -0
  41. data/app/models/katello/concerns/organization_extensions.rb +14 -0
  42. data/app/models/katello/content_view.rb +18 -6
  43. data/app/models/katello/content_view_erratum_filter.rb +13 -0
  44. data/app/models/katello/content_view_filter.rb +4 -0
  45. data/app/models/katello/content_view_module_stream_filter.rb +30 -3
  46. data/app/models/katello/glue/pulp/repo.rb +1 -0
  47. data/app/models/katello/host/content_facet.rb +10 -5
  48. data/app/models/katello/module_stream.rb +1 -1
  49. data/app/models/katello/pulp3/content_guard.rb +1 -1
  50. data/app/models/katello/repository.rb +11 -0
  51. data/app/models/setting/content.rb +3 -1
  52. data/app/presenters/katello/sync_status_presenter.rb +4 -2
  53. data/app/services/katello/candlepin/message_handler.rb +2 -3
  54. data/app/services/katello/pulp/repository/yum.rb +2 -1
  55. data/app/services/katello/pulp3/api/core.rb +4 -0
  56. data/app/services/katello/pulp3/erratum.rb +3 -1
  57. data/app/services/katello/pulp3/migration.rb +9 -4
  58. data/app/services/katello/pulp3/migration_plan.rb +6 -6
  59. data/app/services/katello/pulp3/repository.rb +17 -1
  60. data/app/services/katello/pulp3/repository/yum.rb +187 -25
  61. data/app/services/katello/pulp3/task.rb +100 -0
  62. data/app/services/katello/pulp3/task_group.rb +79 -0
  63. data/app/services/katello/ui_notifications/subscriptions/manifest_expired_warning.rb +20 -8
  64. data/app/services/katello/upstream_connection_checker.rb +48 -0
  65. data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
  66. data/app/views/katello/api/v2/srpms/backend.json.rabl +11 -0
  67. data/app/views/katello/api/v2/srpms/base.json.rabl +5 -0
  68. data/app/views/katello/api/v2/srpms/compare.json.rabl +10 -0
  69. data/app/views/katello/api/v2/srpms/index.json.rabl +1 -1
  70. data/app/views/katello/api/v2/srpms/show.json.rabl +3 -3
  71. data/config/routes/api/v2.rb +2 -0
  72. data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
  73. data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
  74. data/db/seeds.d/109-katello-notification-blueprints.rb +1 -1
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
  78. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.routes.js +1 -1
  79. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
  80. data/lib/katello/engine.rb +0 -1
  81. data/lib/katello/permission_creator.rb +1 -1
  82. data/lib/katello/plugin.rb +2 -0
  83. data/lib/katello/tasks/reports.rake +16 -0
  84. data/lib/katello/version.rb +1 -1
  85. data/package.json +3 -3
  86. data/webpack/components/Content/ContentTable.js +2 -0
  87. data/webpack/components/Content/Details/ContentDetails.js +3 -0
  88. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  89. data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetails.js +3 -0
  90. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetails.js +3 -0
  91. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +2 -0
  92. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -0
  93. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +2 -0
  94. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +2 -0
  95. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js +2 -0
  96. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +2 -0
  97. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +2 -0
  98. data/webpack/scenes/Subscriptions/SubscriptionActions.js +8 -8
  99. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +3 -1
  100. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +15 -1
  101. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +54 -7
  102. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  103. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +15 -1
  104. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/{UpstreamSubscriptionsContstants.js → UpstreamSubscriptionsConstants.js} +3 -0
  105. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +2 -0
  106. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +1 -1
  107. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +1 -1
  108. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +0 -13
  109. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +6 -1
  110. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +6 -4
  111. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +26 -25
  112. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +0 -58
  113. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +10 -4
  114. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +1 -0
  115. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +1 -68
  116. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js +1 -1
  117. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/index.js +4 -4
  118. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +12 -10
  119. data/webpack/scenes/Subscriptions/index.js +6 -3
  120. metadata +44 -27
@@ -3,20 +3,6 @@ module Katello
3
3
  module BaseTemplateScopeExtensions
4
4
  extend ActiveSupport::Concern
5
5
 
6
- module Overrides
7
- def allowed_helpers
8
- super + [:errata, :host_subscriptions, :host_applicable_errata_ids, :host_applicable_errata_filtered,
9
- :host_latest_applicable_rpm_version, :load_pools, :load_errata_applications, :host_content_facet,
10
- :host_sla, :host_products, :sub_name, :sub_sku, :registered_through, :last_checkin, :host_collections,
11
- :host_subscriptions_names, :host_subscriptions, :host_products_names, :host_collections_names,
12
- :host_redhat_subscription_names, :registered_at]
13
- end
14
- end
15
-
16
- included do
17
- prepend Overrides
18
- end
19
-
20
6
  def errata(id)
21
7
  Katello::Erratum.in_repositories(Katello::Repository.readable).with_identifiers(id).map(&:attributes).first.slice!('created_at', 'updated_at')
22
8
  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.")
@@ -106,21 +112,7 @@ module Katello
106
112
  end
107
113
  end
108
114
 
109
- class Pulp3Error < StandardError
110
- def self.from_task(task)
111
- if task[:state] == 'canceled'
112
- self.new(_("Task canceled"))
113
- elsif task[:state] == 'failed'
114
- message = if task[:error][:description].blank?
115
- _("Pulp task error")
116
- else
117
- task[:error][:description]
118
- end
119
- self.new(message)
120
- end
121
- end
122
- end
123
-
115
+ class Pulp3Error < StandardError; end
124
116
  class Pulp3MigrationError < StandardError; end
125
117
 
126
118
  class PulpError < StandardError
@@ -154,5 +146,24 @@ module Katello
154
146
  _("No URL found for a container registry. Please check the configuration.")
155
147
  end
156
148
  end
149
+
150
+ class DisconnectedMode < StandardError
151
+ def message
152
+ _("You are currently operating in disconnected mode where access to Red Hat Subcription Management " \
153
+ "is prohibited. If you would like to change this, please update the content setting 'Disconnected mode'.")
154
+ end
155
+ end
156
+
157
+ class NoManifestImported < StandardError
158
+ def message
159
+ _("Current organization has no manifest imported.")
160
+ end
161
+ end
162
+
163
+ class ManifestExpired < StandardError
164
+ def message
165
+ _("This Organization's subscription manifest has expired. Please import a new manifest.")
166
+ end
167
+ end
157
168
  end
158
169
  end
@@ -142,7 +142,7 @@ module Katello
142
142
  def upstream_consumer
143
143
  fail _("Current organization not set.") unless Organization.current
144
144
  upstream_consumer = Organization.current.owner_details['upstreamConsumer']
145
- fail _("Current organization has no manifest imported.") unless upstream_consumer
145
+ fail Katello::Errors::NoManifestImported unless upstream_consumer
146
146
 
147
147
  upstream_consumer
148
148
  end
@@ -9,6 +9,12 @@ module Katello
9
9
  super(id)
10
10
  end
11
11
 
12
+ def ping
13
+ resource.head
14
+ rescue RestClient::Unauthorized, RestClient::Gone
15
+ raise ::Katello::Errors::UpstreamConsumerGone
16
+ end
17
+
12
18
  # Overrides the HttpResource get method to check if the upstream
13
19
  # consumer exists.
14
20
  def get(params)
@@ -50,6 +50,7 @@ module Katello
50
50
 
51
51
  before_save :correct_puppet_environment
52
52
  before_validation :correct_kickstart_repository
53
+ before_update :check_host_registration, :if => proc { organization_id_changed? }
53
54
 
54
55
  scope :with_pools_expiring_in_days, ->(days) { joins(:pools).merge(Katello::Pool.expiring_in_days(days)).distinct }
55
56
 
@@ -76,6 +77,12 @@ module Katello
76
77
  end
77
78
  end
78
79
 
80
+ def check_host_registration
81
+ if subscription_facet
82
+ fail ::Katello::Errors::HostRegisteredException
83
+ end
84
+ end
85
+
79
86
  def correct_kickstart_repository
80
87
  return unless content_facet
81
88
 
@@ -82,6 +82,20 @@ module Katello
82
82
  self.providers.anonymous.first
83
83
  end
84
84
 
85
+ def manifest_imported?
86
+ owner_details['upstreamConsumer'].present?
87
+ end
88
+
89
+ def manifest_expired?
90
+ manifest_expiry = owner_details.dig(:upstreamConsumer, :idCert, :serial, :expiration)
91
+
92
+ if manifest_expiry
93
+ DateTime.parse(manifest_expiry) < DateTime.now
94
+ else
95
+ false
96
+ end
97
+ end
98
+
85
99
  def manifest_history
86
100
  imports.map { |i| OpenStruct.new(i) }
87
101
  end
@@ -289,9 +289,21 @@ module Katello
289
289
  where("#{Katello::ContentViewVersion.table_name}.content_view_id" => self.id)
290
290
  end
291
291
 
292
- def repositories_to_publish
292
+ def repositories_to_publish(override_components = nil)
293
293
  if composite?
294
- ids = components.flat_map { |version| version.repositories.archived }.map(&:id)
294
+ components_to_publish = []
295
+ components.each do |component|
296
+ override_component = override_components&.detect do |override_cvv|
297
+ override_cvv.content_view == component.content_view
298
+ end
299
+
300
+ if override_component
301
+ components_to_publish << override_component
302
+ else
303
+ components_to_publish << component
304
+ end
305
+ end
306
+ ids = components_to_publish.flat_map { |version| version.repositories.archived }.map(&:id)
295
307
  Repository.where(:id => ids)
296
308
  else
297
309
  repositories
@@ -302,11 +314,11 @@ module Katello
302
314
  composite? ? repositories_to_publish.pluck(&:id) : repository_ids
303
315
  end
304
316
 
305
- def repositories_to_publish_by_library_instance
317
+ def repositories_to_publish_by_library_instance(override_components = nil)
306
318
  # retrieve the list of repositories in a hash, where the key
307
319
  # is the library instance id, and the value is an array
308
320
  # of the repositories for that instance.
309
- repositories_to_publish.inject({}) do |result, repo|
321
+ repositories_to_publish(override_components).inject({}) do |result, repo|
310
322
  result[repo.library_instance] ||= []
311
323
  result[repo.library_instance] << repo
312
324
  result
@@ -326,8 +338,8 @@ module Katello
326
338
  component_composites.where(latest: true).joins(:composite_content_view).where(self.class.table_name => {auto_publish: true})
327
339
  end
328
340
 
329
- def publish_repositories
330
- repositories = composite? ? repositories_to_publish_by_library_instance.values : repositories_to_publish
341
+ def publish_repositories(override_components = nil)
342
+ repositories = composite? ? repositories_to_publish_by_library_instance(override_components).values : repositories_to_publish
331
343
  repositories.each do |repos|
332
344
  if repos.is_a? Array
333
345
  yield repos
@@ -30,6 +30,7 @@ module Katello
30
30
  if filter_by_id?
31
31
  errata_ids = erratum_rules.map(&:errata_id)
32
32
  errata_pulp_ids = errata_package_pulp_ids_from_errata_ids(repo, errata_ids)
33
+ errata_pulp_ids += errata_module_stream_pulp_ids_from_errata_ids(errata_ids)
33
34
  else
34
35
  clauses = []
35
36
  clauses << errata_from
@@ -37,7 +38,9 @@ module Katello
37
38
  clauses << types_clause
38
39
  package_filenames = Erratum.list_filenames_by_clauses(repo, clauses.compact)
39
40
  errata_pulp_ids = errata_package_pulp_ids_from_package_filenames(repo, package_filenames)
41
+ errata_pulp_ids += errata_module_stream_pulp_ids_from_clauses(repo, clauses.compact)
40
42
  end
43
+
41
44
  errata_pulp_ids
42
45
  end
43
46
 
@@ -48,10 +51,20 @@ module Katello
48
51
  repo.rpms.where("filename ILIKE ANY ( array[?] )", query_params)
49
52
  end
50
53
 
54
+ def errata_module_stream_pulp_ids_from_clauses(repo, clauses)
55
+ module_streams = Erratum.list_modular_streams_by_clauses(repo, clauses)
56
+ module_streams.pluck(:pulp_id)
57
+ end
58
+
51
59
  def errata_package_pulp_ids_from_package_filenames(repo, package_filenames)
52
60
  rpms_by_filename(repo, package_filenames).pluck(:pulp_id)
53
61
  end
54
62
 
63
+ def errata_module_stream_pulp_ids_from_errata_ids(errata_ids)
64
+ module_streams = Katello::Erratum.where(:errata_id => errata_ids).map(&:module_streams).compact.flatten
65
+ module_streams.pluck(:pulp_id)
66
+ end
67
+
55
68
  def errata_package_pulp_ids_from_errata_ids(repo, errata_ids)
56
69
  package_filenames = Katello::ErratumPackage.joins(:erratum).where("#{Erratum.table_name}.errata_id" => errata_ids).pluck(:filename)
57
70
  rpms_by_filename(repo, package_filenames).pluck(:pulp_id)
@@ -182,6 +182,10 @@ module Katello
182
182
  fail "setting original_packages not supported for #{self.class.name}"
183
183
  end
184
184
 
185
+ def original_module_streams=(_include_original)
186
+ fail "setting original_module_streams not supported for #{self.class.name}"
187
+ end
188
+
185
189
  protected
186
190
 
187
191
  def validate_repos
@@ -6,9 +6,36 @@ module Katello
6
6
 
7
7
  validates_lengths_from_database
8
8
 
9
- def generate_clauses(_repo)
10
- return if module_stream_rules.blank?
11
- module_stream_rules.map(&:module_stream_id)
9
+ def generate_clauses(repo)
10
+ rules = module_stream_rules || []
11
+ ids = rules.map(&:module_stream_id)
12
+ if self.original_module_streams
13
+ ids.concat(repo.module_streams_without_errata.map(&:id))
14
+ end
15
+ ids
16
+ end
17
+
18
+ def original_module_streams=(value)
19
+ self[:original_module_streams] = value
20
+ end
21
+
22
+ def content_unit_pulp_ids(repo, dependents = false)
23
+ content_unit_ids = []
24
+ module_ids = []
25
+
26
+ self.module_stream_rules.each do |rule|
27
+ module_ids << rule.module_stream_id
28
+ end
29
+ if self.original_module_streams
30
+ module_ids.concat(repo.module_streams_without_errata.map(&:id))
31
+ end
32
+ modules_streams = ModuleStream.where(id: module_ids).includes(:rpms)
33
+ content_unit_ids += modules_streams.pluck(:pulp_id).flatten.uniq
34
+ if dependents && !modules_streams.empty?
35
+ rpms = modules_streams.map(&:rpms).flatten
36
+ content_unit_ids += rpms.pluck(:pulp_id).flatten.uniq
37
+ end
38
+ content_unit_ids.uniq
12
39
  end
13
40
  end
14
41
  end
@@ -90,6 +90,7 @@ module Katello
90
90
  def pulp_counts_differ?
91
91
  pulp_counts = pulp_repo_facts[:content_unit_counts]
92
92
  rpms.count != pulp_counts['rpm'].to_i ||
93
+ srpms.count != pulp_counts['srpm'].to_i ||
93
94
  errata.count != pulp_counts['erratum'].to_i ||
94
95
  package_groups.count != pulp_counts['package_group'].to_i ||
95
96
  puppet_modules.count != pulp_counts['puppet_module'].to_i ||
@@ -47,11 +47,13 @@ module Katello
47
47
  bindable_paths = bindable_types
48
48
  relative_paths = []
49
49
 
50
- paths.each do |path|
50
+ # paths == ["/pulp/repos/Default_Organization/Library/custom/Test_product/test2",
51
+ # "/pulp/repos/Default_Organization/Library/custom/Test_product/My_repo"]
52
+ paths.each do |absolute_path|
51
53
  bindable_paths.each do |supported|
52
- relative_path = path.gsub(supported[:matcher], '')
53
- relative_paths << relative_path
54
- if path.starts_with?(supported[:matcher])
54
+ relative_path = absolute_path.gsub(supported[:matcher], '') # remove e.g. '/pulp/repos/' from beginning of string
55
+ relative_paths << relative_path unless relative_path == absolute_path
56
+ if absolute_path.starts_with?(supported[:matcher])
55
57
  supported[:paths] << relative_path
56
58
  break
57
59
  end
@@ -60,10 +62,12 @@ module Katello
60
62
 
61
63
  repos = bindable_paths.flat_map do |supported|
62
64
  repos = Repository.joins(:root).where(RootRepository.table_name => {content_type: supported[:type]}, relative_path: supported[:paths])
63
- relative_paths -= repos.pluck(:relative_path)
65
+ relative_paths -= repos.pluck(:relative_path) # remove relative paths that match our repos
64
66
  repos
65
67
  end
66
68
 
69
+ # Any leftover relative paths do not match the repos we've just retrieved from the db,
70
+ # so we should log warnings about them.
67
71
  relative_paths.each do |repo_path|
68
72
  Rails.logger.warn("System #{self.host.name} (#{self.host.id}) requested binding to unknown repo #{repo_path}")
69
73
  end
@@ -121,6 +125,7 @@ module Katello
121
125
  ::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::Rpm, bound_repos).calculate_and_import
122
126
  ::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::Erratum, bound_repos).calculate_and_import
123
127
  ::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::ModuleStream, bound_repos).calculate_and_import
128
+ update_applicability_counts
124
129
  end
125
130
 
126
131
  def import_applicability(partial = false)
@@ -65,7 +65,7 @@ module Katello
65
65
  end
66
66
 
67
67
  def module_spec_hash
68
- {:name => name, :stream => stream, :version => version, :context => context, :arch => arch, :id => id}.compact
68
+ {:name => name, :stream => stream, :version => version, :context => context, :arch => arch, :pulp_id => pulp_id, :id => id}.compact
69
69
  end
70
70
 
71
71
  def self.parse_module_spec(module_spec)
@@ -5,7 +5,7 @@ module Katello
5
5
  return unless (count == 0 || force)
6
6
  content_guard_api = Katello::Pulp3::Api::ContentGuard.new(smart_proxy)
7
7
  content_guard = content_guard_api.list&.results&.first
8
- fail _("No Content Guard configured!") unless content_guard
8
+ return unless content_guard
9
9
  katello_content_guard = self.new(name: content_guard.name, pulp_href: content_guard.pulp_href)
10
10
  katello_content_guard.save!
11
11
  end
@@ -469,6 +469,17 @@ module Katello
469
469
  end
470
470
  end
471
471
 
472
+ def module_streams_without_errata
473
+ module_stream_errata = Katello::ModuleStreamErratumPackage.joins(:erratum_package => {:erratum => :repository_errata})
474
+ .where("#{RepositoryErratum.table_name}.repository_id" => self.id)
475
+ .pluck("#{Katello::ModuleStreamErratumPackage.table_name}.module_stream_id")
476
+ if module_stream_errata.any?
477
+ self.module_streams.where("#{ModuleStream.table_name}.id NOT in (?)", module_stream_errata)
478
+ else
479
+ self.module_streams
480
+ end
481
+ end
482
+
472
483
  def self.with_errata(errata)
473
484
  joins(:repository_errata).where("#{Katello::RepositoryErratum.table_name}.erratum_id" => errata)
474
485
  end
@@ -2,7 +2,7 @@ class Setting::Content < Setting
2
2
  #rubocop:disable Metrics/MethodLength
3
3
  #rubocop:disable Metrics/AbcSize
4
4
 
5
- validate :content_default_http_proxy, if: proc { |s| s.name == 'content_default_http_proxy' }
5
+ validate :content_default_http_proxy, if: proc { |s| s.name == 'content_default_http_proxy' && HttpProxy.table_exists? }
6
6
 
7
7
  after_save :add_organizations_and_locations_if_global_http_proxy
8
8
 
@@ -91,6 +91,8 @@ class Setting::Content < Setting
91
91
  false, N_('Restrict Composite Content View promotion')),
92
92
  self.set('check_services_before_actions', N_("Whether or not to check the status of backend services such as pulp and candlepin prior to performing some actions."),
93
93
  true, N_('Check services before actions')),
94
+ self.set('foreman_proxy_content_batch_size', N_("How many repositories should be synced concurrently on the capsule. A smaller number may lead to longer sync times. A larger number will increase dynflow load."),
95
+ 25, N_('Batch size to sync repositories in.')),
94
96
  self.set('foreman_proxy_content_auto_sync', N_("Whether or not to auto sync the Smart Proxies after a Content View promotion."),
95
97
  true, N_('Sync Smart Proxies after Content View promotion')),
96
98
  self.set('default_download_policy', N_("Default download policy for custom repositories (either 'immediate', 'on_demand', or 'background')"), "immediate",
@@ -19,6 +19,8 @@ module Katello
19
19
  def sync_progress
20
20
  return {:state => nil} unless @repo
21
21
  return empty_task(@repo) unless @task
22
+ display_output = @task.humanized[:output]
23
+ display_output = display_output.split("\n")[0] if (display_output && @repo.version_href)
22
24
  {
23
25
  :id => @repo.id,
24
26
  :product_id => @repo.product.id,
@@ -29,8 +31,8 @@ module Katello
29
31
  :start_time => format_date(@task.started_at),
30
32
  :finish_time => format_date(@task.ended_at),
31
33
  :duration => format_duration(@task.ended_at, @task.started_at),
32
- :display_size => @task.humanized[:output],
33
- :size => @task.humanized[:output],
34
+ :display_size => display_output,
35
+ :size => display_output,
34
36
  :is_running => @task.pending && @task.state != 'paused',
35
37
  :error_details => @task.errors
36
38
  }
@@ -81,9 +81,8 @@ module Katello
81
81
  end
82
82
 
83
83
  def delete_pool
84
- if pool
85
- Rails.logger.info "deleting pool #{pool.id} from Katello"
86
- pool.destroy!
84
+ if Katello::Pool.where(:cp_id => pool_id).destroy_all.any?
85
+ Rails.logger.info "deleted pool #{pool_id} from Katello"
87
86
  end
88
87
  end
89
88
  end
@@ -246,7 +246,8 @@ module Katello
246
246
  remove = clause_gen.remove_clause
247
247
  remove_clauses = {filters: {unit: remove}} if remove
248
248
  else
249
- copy_clauses = {}
249
+ non_modular_rpms = ::Katello::Rpm.in_repositories(repo).non_modular.pluck(:filename)
250
+ copy_clauses = non_modular_rpms.blank? ? nil : {filters: {unit: ContentViewPackageFilter.generate_rpm_clauses(non_modular_rpms)}}
250
251
  remove_clauses = nil
251
252
  end
252
253
 
@@ -74,6 +74,10 @@ module Katello
74
74
  PulpcoreClient::TasksApi.new(core_api_client)
75
75
  end
76
76
 
77
+ def task_groups_api
78
+ PulpcoreClient::TaskGroupsApi.new(core_api_client)
79
+ end
80
+
77
81
  def upload_class
78
82
  PulpcoreClient::Upload
79
83
  end