katello 3.16.0.rc4 → 3.16.1
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.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -3
- data/app/controllers/katello/api/v2/api_controller.rb +1 -0
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
- data/app/controllers/katello/api/v2/content_views_controller.rb +7 -0
- data/app/controllers/katello/api/v2/host_tracer_controller.rb +0 -5
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +15 -0
- data/app/controllers/katello/api/v2/repositories_controller.rb +10 -1
- data/app/controllers/katello/concerns/api/v2/associations_permission_check.rb +67 -0
- data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -5
- data/app/helpers/katello/content_view_helper.rb +15 -0
- data/app/lib/actions/katello/capsule_content/refresh_repos.rb +5 -1
- data/app/lib/actions/katello/capsule_content/sync.rb +3 -6
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +31 -17
- data/app/lib/actions/katello/content_view/incremental_updates.rb +8 -1
- data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +2 -1
- data/app/lib/actions/katello/content_view/publish.rb +55 -16
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +120 -26
- data/app/lib/actions/katello/host/attach_subscriptions.rb +5 -1
- data/app/lib/actions/katello/product/destroy.rb +25 -4
- data/app/lib/actions/katello/repository/destroy.rb +5 -1
- data/app/lib/actions/katello/repository/multi_clone_contents.rb +62 -0
- data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
- data/app/lib/actions/katello/repository/sync.rb +35 -25
- data/app/lib/actions/katello/repository/update.rb +11 -16
- data/app/lib/actions/katello/repository/verify_checksum.rb +28 -0
- data/app/lib/actions/katello/sync_plan/run.rb +1 -1
- data/app/lib/actions/pulp/abstract_async_task.rb +1 -0
- data/app/lib/actions/pulp/consumer/sync_capsule.rb +8 -0
- data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
- data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +2 -2
- data/app/lib/actions/pulp/repository/sync.rb +2 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
- data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
- data/app/lib/actions/pulp3/capsule_content/sync.rb +3 -1
- data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
- data/app/lib/actions/pulp3/content_migration.rb +4 -0
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -4
- data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +3 -1
- data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +22 -0
- data/app/lib/actions/pulp3/repository/copy_content.rb +0 -1
- data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
- data/app/lib/actions/pulp3/repository/multi_copy_units.rb +55 -0
- data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -1
- data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +85 -0
- data/app/lib/actions/pulp3/repository/repair.rb +29 -0
- data/app/lib/actions/pulp3/repository/save_version.rb +20 -8
- data/app/lib/actions/pulp3/repository/save_versions.rb +73 -0
- data/app/lib/actions/pulp3/repository/sync.rb +1 -1
- data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +6 -2
- data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -14
- data/app/lib/katello/errors.rb +1 -15
- data/app/lib/katello/resources/cdn.rb +3 -2
- data/app/lib/katello/util/cdn_var_substitutor.rb +9 -6
- data/app/models/katello/concerns/smart_proxy_extensions.rb +14 -3
- data/app/models/katello/content_view.rb +18 -6
- data/app/models/katello/content_view_erratum_filter.rb +13 -0
- data/app/models/katello/content_view_filter.rb +4 -0
- data/app/models/katello/content_view_module_stream_filter.rb +30 -3
- data/app/models/katello/content_view_package_filter.rb +1 -1
- data/app/models/katello/glue/pulp/repo.rb +1 -0
- data/app/models/katello/host/content_facet.rb +11 -5
- data/app/models/katello/module_stream.rb +1 -1
- data/app/models/katello/ping.rb +1 -3
- data/app/models/katello/repository.rb +16 -0
- data/app/models/setting/content.rb +3 -1
- data/app/presenters/katello/sync_status_presenter.rb +4 -2
- data/app/services/cert/certs.rb +10 -2
- data/app/services/katello/pulp/repository/yum.rb +2 -1
- data/app/services/katello/pulp3/api/core.rb +4 -0
- data/app/services/katello/pulp3/erratum.rb +3 -1
- data/app/services/katello/pulp3/migration.rb +9 -4
- data/app/services/katello/pulp3/migration_plan.rb +6 -6
- data/app/services/katello/pulp3/repository.rb +13 -5
- data/app/services/katello/pulp3/repository/yum.rb +246 -25
- data/app/services/katello/pulp3/repository_mirror.rb +7 -2
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
- data/app/services/katello/pulp3/task.rb +100 -0
- data/app/services/katello/pulp3/task_group.rb +79 -0
- data/app/services/katello/smart_proxy_helper.rb +13 -16
- data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
- data/config/routes/api/rhsm.rb +1 -0
- data/config/routes/api/v2.rb +2 -0
- data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
- data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.routes.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +7 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +15 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
- data/lib/katello/engine.rb +0 -1
- data/lib/katello/permission_creator.rb +2 -2
- data/lib/katello/plugin.rb +2 -1
- data/lib/katello/tasks/reports.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -6
- metadata +37 -14
- data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
@@ -10,7 +10,7 @@ module Actions
|
|
10
10
|
|
11
11
|
def invoke_external_task
|
12
12
|
repo = ::Katello::Repository.find(input[:repo_id])
|
13
|
-
output[:pulp_tasks] = repo.backend_service(::SmartProxy.unscoped.find(input[:smart_proxy_id])).sync
|
13
|
+
output[:pulp_tasks] = repo.backend_service(::SmartProxy.unscoped.find(input[:smart_proxy_id])).sync(input[:options])
|
14
14
|
end
|
15
15
|
|
16
16
|
def external_task=(tasks)
|
@@ -2,13 +2,17 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
4
|
class UpdateCVRepositoryCertGuard < Pulp3::Abstract
|
5
|
-
def plan(repository,
|
5
|
+
def plan(repository, smart_proxy)
|
6
6
|
root = repository.root
|
7
7
|
cv_repositories = root.repositories - [root.library_instance]
|
8
8
|
cv_repositories.each do |repo|
|
9
|
-
plan_action(::Actions::Pulp3::Repository::RefreshDistribution, repo,
|
9
|
+
plan_action(::Actions::Pulp3::Repository::RefreshDistribution, repo, smart_proxy)
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def humanized_name
|
14
|
+
_("Updating repository authentication configuration")
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
@@ -25,7 +25,7 @@ module Actions
|
|
25
25
|
filechunk.flush
|
26
26
|
actual_chunk_size = File.size(filechunk)
|
27
27
|
response = uploads_api.update(upload_href, content_range(offset, offset + actual_chunk_size - 1, total_size), filechunk)
|
28
|
-
offset += actual_chunk_size
|
28
|
+
offset += actual_chunk_size
|
29
29
|
ensure
|
30
30
|
filechunk.close
|
31
31
|
filechunk.unlink
|
@@ -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
|
@@ -168,6 +154,10 @@ module Katello
|
|
168
154
|
end
|
169
155
|
# rubocop:enable Metrics/MethodLength
|
170
156
|
|
157
|
+
def sortable_version(version)
|
158
|
+
Util::Package.sortable_version(version)
|
159
|
+
end
|
160
|
+
|
171
161
|
private
|
172
162
|
|
173
163
|
def host_subscription_facet(host)
|
data/app/lib/katello/errors.rb
CHANGED
@@ -112,21 +112,7 @@ module Katello
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
class Pulp3Error < StandardError
|
116
|
-
def self.from_task(task)
|
117
|
-
if task[:state] == 'canceled'
|
118
|
-
self.new(_("Task canceled"))
|
119
|
-
elsif task[:state] == 'failed'
|
120
|
-
message = if task[:error][:description].blank?
|
121
|
-
_("Pulp task error")
|
122
|
-
else
|
123
|
-
task[:error][:description]
|
124
|
-
end
|
125
|
-
self.new(message)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
115
|
+
class Pulp3Error < StandardError; end
|
130
116
|
class Pulp3MigrationError < StandardError; end
|
131
117
|
|
132
118
|
class PulpError < StandardError
|
@@ -18,7 +18,7 @@ module Katello
|
|
18
18
|
class CdnResource
|
19
19
|
CDN_DOCKER_CONTAINER_LISTING = "CONTAINER_REGISTRY_LISTING".freeze
|
20
20
|
|
21
|
-
attr_reader :url, :product, :options
|
21
|
+
attr_reader :url, :product, :options, :proxy
|
22
22
|
|
23
23
|
def substitutor(logger = nil)
|
24
24
|
@logger = logger
|
@@ -26,6 +26,7 @@ module Katello
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def initialize(url, options = {})
|
29
|
+
@proxy = ::HttpProxy.default_global_content_proxy
|
29
30
|
@ssl_version = Setting[:cdn_ssl_version]
|
30
31
|
if @ssl_version && !SUPPORTED_SSL_VERSIONS.include?(@ssl_version)
|
31
32
|
fail("Invalid SSL version specified. Check the 'CDN SSL Version' setting")
|
@@ -140,7 +141,7 @@ module Katello
|
|
140
141
|
end
|
141
142
|
|
142
143
|
def net_http_class
|
143
|
-
if
|
144
|
+
if self.proxy
|
144
145
|
uri = URI(proxy.url) #Net::HTTP::Proxy ignores port as part of the url
|
145
146
|
Net::HTTP::Proxy("#{uri.host}#{uri.path}", uri.port, proxy.username, proxy.password)
|
146
147
|
else
|
@@ -59,14 +59,17 @@ module Katello
|
|
59
59
|
|
60
60
|
return resolved if to_resolve.empty?
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
to_resolve.in_groups_of(8) do |group|
|
63
|
+
futures = group.map do |path_with_substitution|
|
64
|
+
Concurrent::Promises.future do
|
65
|
+
path_with_substitution.resolve_substitutions(@resource)
|
66
|
+
end
|
65
67
|
end
|
66
|
-
end
|
67
68
|
|
68
|
-
|
69
|
-
|
69
|
+
futures.each do |future|
|
70
|
+
resolved << future.value
|
71
|
+
Rails.logger.error("Failed at scanning for repository: #{future.reason}") if future.rejected?
|
72
|
+
end
|
70
73
|
end
|
71
74
|
|
72
75
|
find_substitutions(resolved.compact.flatten)
|
@@ -120,8 +120,7 @@ module Katello
|
|
120
120
|
uri = pulp3_uri!
|
121
121
|
config.host = uri.host
|
122
122
|
config.scheme = uri.scheme
|
123
|
-
config
|
124
|
-
config.ssl_client_key = ::Cert::Certs.ssl_client_key
|
123
|
+
pulp3_ssl_configuration(config)
|
125
124
|
config.debugging = true
|
126
125
|
config.logger = ::Foreman::Logging.logger('katello/pulp_rest')
|
127
126
|
config.username = self.setting(PULP3_FEATURE, 'username')
|
@@ -129,6 +128,18 @@ module Katello
|
|
129
128
|
end
|
130
129
|
end
|
131
130
|
|
131
|
+
def pulp3_ssl_configuration(config)
|
132
|
+
if Faraday.default_adapter == :excon
|
133
|
+
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename
|
134
|
+
config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename
|
135
|
+
elsif Faraday.default_adapter == :net_http
|
136
|
+
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
|
137
|
+
config.ssl_client_key = ::Cert::Certs.ssl_client_key
|
138
|
+
else
|
139
|
+
fail "Unexpected faraday default_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
132
143
|
def backend_service_type(repository)
|
133
144
|
if pulp3_support?(repository)
|
134
145
|
Actions::Pulp3::Abstract::BACKEND_SERVICE_TYPE
|
@@ -142,7 +153,7 @@ module Katello
|
|
142
153
|
end
|
143
154
|
|
144
155
|
def pulp3_support?(repository)
|
145
|
-
pulp3_repository_type_support?(repository.content_type)
|
156
|
+
repository ? pulp3_repository_type_support?(repository.try(:content_type)) : false
|
146
157
|
end
|
147
158
|
|
148
159
|
def pulp2_preferred_for_type?(repository_type)
|
@@ -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
|
-
|
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(
|
10
|
-
|
11
|
-
|
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
|
@@ -37,7 +37,7 @@ module Katello
|
|
37
37
|
self.package_rules.each do |rule|
|
38
38
|
package_filenames.concat(query_rpms(repo, rule))
|
39
39
|
end
|
40
|
-
|
40
|
+
package_filenames.concat(repo.packages_without_errata.map(&:filename)) if self.original_packages
|
41
41
|
rpms = Rpm.in_repositories(repo)
|
42
42
|
rpms.where(filename: package_filenames).where(:modular => false).pluck(:pulp_id).flatten.uniq
|
43
43
|
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
|
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 =
|
53
|
-
relative_paths << relative_path
|
54
|
-
if
|
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,8 @@ 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
|
129
|
+
self.update_errata_status
|
124
130
|
end
|
125
131
|
|
126
132
|
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)
|
data/app/models/katello/ping.rb
CHANGED
@@ -31,9 +31,7 @@ module Katello
|
|
31
31
|
|
32
32
|
# set overall status result code
|
33
33
|
result = {:services => result}
|
34
|
-
result[:services].each_value
|
35
|
-
result[:status] = v[:status] == OK_RETURN_CODE ? OK_RETURN_CODE : FAIL_RETURN_CODE
|
36
|
-
end
|
34
|
+
result[:status] = result[:services].each_value.any? { |v| v[:status] == FAIL_RETURN_CODE } ? FAIL_RETURN_CODE : OK_RETURN_CODE
|
37
35
|
result
|
38
36
|
end
|
39
37
|
|
@@ -133,6 +133,7 @@ module Katello
|
|
133
133
|
scope :in_published_environments, -> { in_content_views(Katello::ContentView.non_default).where.not(:environment_id => nil) }
|
134
134
|
scope :order_by_root, ->(attr) { joins(:root).order("#{Katello::RootRepository.table_name}.#{attr}") }
|
135
135
|
scope :with_content, ->(content) { joins(Katello::RepositoryTypeManager.find_content_type(content).model_class.repository_association_class.name.demodulize.underscore.pluralize.to_sym).distinct }
|
136
|
+
scope :by_rpm_count, -> { left_joins(:repository_rpms).group(:id).order("count(katello_repository_rpms.id) ASC") } # smallest count first
|
136
137
|
|
137
138
|
scoped_search :on => :name, :relation => :root, :complete_value => true
|
138
139
|
scoped_search :rename => :product, :on => :name, :relation => :product, :complete_value => true
|
@@ -469,6 +470,17 @@ module Katello
|
|
469
470
|
end
|
470
471
|
end
|
471
472
|
|
473
|
+
def module_streams_without_errata
|
474
|
+
module_stream_errata = Katello::ModuleStreamErratumPackage.joins(:erratum_package => {:erratum => :repository_errata})
|
475
|
+
.where("#{RepositoryErratum.table_name}.repository_id" => self.id)
|
476
|
+
.pluck("#{Katello::ModuleStreamErratumPackage.table_name}.module_stream_id")
|
477
|
+
if module_stream_errata.any?
|
478
|
+
self.module_streams.where("#{ModuleStream.table_name}.id NOT in (?)", module_stream_errata)
|
479
|
+
else
|
480
|
+
self.module_streams
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
472
484
|
def self.with_errata(errata)
|
473
485
|
joins(:repository_errata).where("#{Katello::RepositoryErratum.table_name}.erratum_id" => errata)
|
474
486
|
end
|
@@ -581,6 +593,10 @@ module Katello
|
|
581
593
|
environment
|
582
594
|
end
|
583
595
|
|
596
|
+
def self.smart_proxy_syncable
|
597
|
+
where.not(:environment_id => nil)
|
598
|
+
end
|
599
|
+
|
584
600
|
def exist_for_environment?(environment, content_view, attribute = nil)
|
585
601
|
if environment.present? && content_view.in_environment?(environment)
|
586
602
|
repos = content_view.version(environment).repos(environment)
|
@@ -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
|
+
100, 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",
|