katello 4.2.1 → 4.2.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.
- checksums.yaml +4 -4
- data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +1 -1
- data/app/lib/actions/katello/repository/finish_upload.rb +1 -1
- data/app/lib/actions/katello/repository/import_upload.rb +1 -1
- data/app/lib/actions/katello/repository/metadata_generate.rb +2 -0
- data/app/lib/actions/katello/repository/remove_content.rb +1 -1
- data/app/lib/actions/katello/repository/sync.rb +0 -2
- data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +14 -18
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +1 -11
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +3 -1
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +8 -1
- data/app/lib/katello/resources/registry.rb +1 -1
- data/app/models/katello/concerns/host_managed_extensions.rb +1 -1
- data/app/models/katello/concerns/pulp_database_unit.rb +1 -1
- data/app/models/katello/concerns/smart_proxy_extensions.rb +5 -5
- data/app/models/katello/ping.rb +1 -4
- data/app/models/katello/repository.rb +4 -0
- data/app/services/katello/organization_creator.rb +11 -4
- data/app/services/katello/pulp3/erratum.rb +9 -1
- data/app/services/katello/pulp3/repository.rb +0 -4
- data/app/services/katello/pulp3/repository_mirror.rb +13 -3
- data/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb +2 -0
- data/lib/katello/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cdba19f418c59dd75998081c306267defc02548958e1c48b38db4db29f2c633
|
4
|
+
data.tar.gz: 96f3ff300309604144e935295d3d8f859f757a694cde91768f773a63dfde1106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e793a484c717492274ee01345a14ccefb4ddad648a0db9b3615232a9b329f8681c1208ccabc21e382d7343bd5a812703db1a9840f59fe895bce42637a125c67f
|
7
|
+
data.tar.gz: f9a960acb16529071412b353e79c392cb0c79d8cb4f5f001d67b8ddc64056c80d8e9fd51ead49fce0d8f04918063ee95f31856608ddcef013eb22a70cb827f20
|
@@ -40,7 +40,7 @@ module Actions
|
|
40
40
|
pulp_repo = repo.backend_service(smart_proxy)
|
41
41
|
if !current_repos_on_capsule_ids.include?(repo.id)
|
42
42
|
pulp_repo.create_mirror_entities
|
43
|
-
|
43
|
+
else
|
44
44
|
tasks += pulp_repo.refresh_mirror_entities
|
45
45
|
end
|
46
46
|
end
|
@@ -4,7 +4,7 @@ module Actions
|
|
4
4
|
class SyncCapsule < ::Actions::EntryAction
|
5
5
|
include Actions::Katello::PulpSelector
|
6
6
|
def plan(smart_proxy, options = {})
|
7
|
-
plan_self(:smart_proxy_id => smart_proxy.id
|
7
|
+
plan_self(:smart_proxy_id => smart_proxy.id)
|
8
8
|
action_subject(smart_proxy)
|
9
9
|
environment = options[:environment]
|
10
10
|
content_view = options[:content_view]
|
@@ -13,7 +13,7 @@ module Actions
|
|
13
13
|
unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
|
14
14
|
end
|
15
15
|
generate_metadata = options.fetch(:generate_metadata, true)
|
16
|
-
plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task) if generate_metadata
|
16
|
+
plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task, :force_publication => true) if generate_metadata
|
17
17
|
|
18
18
|
recent_range = 5.minutes.ago.utc.iso8601
|
19
19
|
plan_action(Katello::Repository::FilteredIndexContent,
|
@@ -41,7 +41,7 @@ module Actions
|
|
41
41
|
import_upload.output
|
42
42
|
end
|
43
43
|
end
|
44
|
-
plan_action(Katello::Repository::MetadataGenerate, repository) if generate_metadata
|
44
|
+
plan_action(Katello::Repository::MetadataGenerate, repository, force_publication: true) if generate_metadata
|
45
45
|
plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repository.id]) if generate_applicability
|
46
46
|
plan_self(repository_id: repository.id, sync_capsule: sync_capsule, upload_results: upload_results)
|
47
47
|
end
|
@@ -7,9 +7,11 @@ module Actions
|
|
7
7
|
source_repository ||= repository.target_repository if repository.link?
|
8
8
|
smart_proxy = options.fetch(:smart_proxy, SmartProxy.pulp_primary)
|
9
9
|
matching_content = options.fetch(:matching_content, false)
|
10
|
+
force_publication = options.fetch(:force_publication, false)
|
10
11
|
|
11
12
|
plan_action(Pulp3::Orchestration::Repository::GenerateMetadata,
|
12
13
|
repository, smart_proxy,
|
14
|
+
:force_publication => force_publication,
|
13
15
|
:source_repository => source_repository,
|
14
16
|
:matching_content => matching_content)
|
15
17
|
end
|
@@ -42,7 +42,7 @@ module Actions
|
|
42
42
|
|
43
43
|
def create_sub_plans
|
44
44
|
trigger(Actions::Katello::Repository::MetadataGenerate,
|
45
|
-
::Katello::Repository.find(input[:repository][:id]))
|
45
|
+
::Katello::Repository.find(input[:repository][:id]), :force_publication => true)
|
46
46
|
end
|
47
47
|
|
48
48
|
def resource_locks
|
@@ -18,7 +18,6 @@ module Actions
|
|
18
18
|
# of Katello and we just need to finish the rest of the orchestration
|
19
19
|
# rubocop:disable Metrics/MethodLength
|
20
20
|
# rubocop:disable Metrics/CyclomaticComplexity
|
21
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
22
21
|
def plan(repo, options = {})
|
23
22
|
action_subject(repo)
|
24
23
|
|
@@ -54,7 +53,6 @@ module Actions
|
|
54
53
|
plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
|
55
54
|
plan_action(Katello::Repository::CorrectChecksum, repo)
|
56
55
|
concurrence do
|
57
|
-
plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check && repo.yum?
|
58
56
|
plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
|
59
57
|
plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability
|
60
58
|
end
|
@@ -6,30 +6,26 @@ module Actions
|
|
6
6
|
def plan(repository, smart_proxy, options = {})
|
7
7
|
options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
|
8
8
|
sequence do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
plan_action(RefreshDistribution, repository, smart_proxy,
|
13
|
-
:tasks => action_output,
|
14
|
-
:use_repository_version => false,
|
15
|
-
:contents_changed => options[:contents_changed])
|
16
|
-
else
|
17
|
-
plan_action(RefreshDistribution, repository, smart_proxy,
|
18
|
-
:use_repository_version => true,
|
19
|
-
:contents_changed => options[:contents_changed])
|
9
|
+
unless repository.repository_type.pulp3_skip_publication
|
10
|
+
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id,
|
11
|
+
:options => options).output
|
20
12
|
end
|
13
|
+
plan_action(RefreshDistribution, repository, smart_proxy,
|
14
|
+
:contents_changed => options[:contents_changed])
|
21
15
|
end
|
22
16
|
end
|
23
17
|
|
24
18
|
def invoke_external_task
|
25
|
-
if input[:options][:sync_task_output] &&
|
26
|
-
::Katello::Pulp3::Task.publication_href(input[:options][:sync_task_output]).present?
|
27
|
-
return input[:options][:sync_task_output]
|
28
|
-
end
|
29
|
-
|
30
19
|
repository = ::Katello::Repository.find(input[:repository_id])
|
31
|
-
|
32
|
-
|
20
|
+
backend = repository.backend_service(smart_proxy).with_mirror_adapter
|
21
|
+
#yum repositories use metadata mirroring always, so we should never
|
22
|
+
# regenerate metadata on proxies. but if there is no publication,
|
23
|
+
# it means the repo was likely empty and syncing didn't generate one
|
24
|
+
if repository.yum? && backend.publication_href.present?
|
25
|
+
[]
|
26
|
+
else
|
27
|
+
backend.create_publication
|
28
|
+
end
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -13,18 +13,8 @@ module Actions
|
|
13
13
|
|
14
14
|
def invoke_external_task
|
15
15
|
smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
|
16
|
-
options = input[:options]
|
17
|
-
tasks = options[:tasks]
|
18
16
|
repo = ::Katello::Repository.find(input[:repository_id])
|
19
|
-
|
20
|
-
repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:use_repository_version => true)
|
21
|
-
elsif tasks && tasks[:pulp_tasks] && tasks[:pulp_tasks].first
|
22
|
-
if (publication_href = ::Katello::Pulp3::Task.publication_href(tasks[:pulp_tasks]))
|
23
|
-
repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:publication => publication_href)
|
24
|
-
else
|
25
|
-
fail "Unable to refresh distribution for repo #{repository.id}, could not find a publication_href"
|
26
|
-
end
|
27
|
-
end
|
17
|
+
repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions
|
28
18
|
end
|
29
19
|
end
|
30
20
|
end
|
@@ -4,13 +4,15 @@ module Actions
|
|
4
4
|
module Repository
|
5
5
|
class GenerateMetadata < Pulp3::Abstract
|
6
6
|
def plan(repository, smart_proxy, options = {})
|
7
|
+
force_publication = options.fetch(:force_publication, repository.publication_href.nil?)
|
8
|
+
|
7
9
|
options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
|
8
10
|
publication_content_type = !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication
|
9
11
|
|
10
12
|
sequence do
|
11
13
|
if options[:source_repository] && publication_content_type
|
12
14
|
plan_self(source_repository_id: options[:source_repository].id, target_repository_id: repository.id, smart_proxy_id: smart_proxy.id)
|
13
|
-
elsif publication_content_type
|
15
|
+
elsif publication_content_type && (force_publication || repository.publication_href.nil? || !repository.using_mirrored_metadata?)
|
14
16
|
plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options)
|
15
17
|
end
|
16
18
|
plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
|
@@ -11,7 +11,14 @@ module Actions
|
|
11
11
|
|
12
12
|
force_fetch_version = true if options[:optimize] == false
|
13
13
|
version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks], :force_fetch_version => force_fetch_version).output
|
14
|
-
|
14
|
+
|
15
|
+
#force contents_changed to true if we're doing a 'force' sync
|
16
|
+
if options[:optimize] == false
|
17
|
+
contents_changed = true
|
18
|
+
else
|
19
|
+
contents_changed = version_output[:contents_changed]
|
20
|
+
end
|
21
|
+
plan_action(Pulp3::Orchestration::Repository::GenerateMetadata, repository, smart_proxy, :contents_changed => contents_changed, :skip_publication_creation => version_output[:publication_provided])
|
15
22
|
plan_self(:subaction_output => version_output)
|
16
23
|
end
|
17
24
|
end
|
@@ -32,7 +32,7 @@ module Katello
|
|
32
32
|
self.prefix = "/pulpcore_registry/"
|
33
33
|
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
34
34
|
self.ca_cert_file = Setting[:ssl_ca_file]
|
35
|
-
pulp_primary.pulp3_ssl_configuration(self)
|
35
|
+
pulp_primary.pulp3_ssl_configuration(self, :net_http)
|
36
36
|
|
37
37
|
self
|
38
38
|
end
|
@@ -108,7 +108,7 @@ module Katello
|
|
108
108
|
self.host_statuses.where(type: ::Katello::HostStatusManager::STATUSES.map(&:name)).each do |status|
|
109
109
|
status.refresh!
|
110
110
|
end
|
111
|
-
refresh_global_status
|
111
|
+
refresh_global_status
|
112
112
|
end
|
113
113
|
|
114
114
|
def queue_refresh_content_host_status
|
@@ -190,7 +190,7 @@ module Katello
|
|
190
190
|
service.update_model(model, repository.repository_type, generic_content_type)
|
191
191
|
elsif self == ::Katello::Erratum
|
192
192
|
# Errata will change pulp_hrefs if the upstream repo updates them
|
193
|
-
erratum_updated_ids << service.update_model(model)
|
193
|
+
erratum_updated_ids << service.update_model(model, repository)
|
194
194
|
else
|
195
195
|
service.update_model(model)
|
196
196
|
end
|
@@ -184,17 +184,17 @@ module Katello
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
def pulp3_ssl_configuration(config)
|
188
|
-
legacy_pulp_cert = !self.setting(PULP3_FEATURE, 'client_authentication')&.include?('
|
187
|
+
def pulp3_ssl_configuration(config, connection_adapter = Faraday.default_adapter)
|
188
|
+
legacy_pulp_cert = !self.setting(PULP3_FEATURE, 'client_authentication')&.include?('client_certificate')
|
189
189
|
|
190
|
-
if
|
190
|
+
if connection_adapter == :excon
|
191
191
|
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename(use_admin_as_cn_cert: legacy_pulp_cert)
|
192
192
|
config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename(use_admin_as_cn_cert: legacy_pulp_cert)
|
193
|
-
elsif
|
193
|
+
elsif connection_adapter == :net_http
|
194
194
|
config.ssl_client_cert = ::Cert::Certs.ssl_client_cert(use_admin_as_cn_cert: legacy_pulp_cert)
|
195
195
|
config.ssl_client_key = ::Cert::Certs.ssl_client_key(use_admin_as_cn_cert: legacy_pulp_cert)
|
196
196
|
else
|
197
|
-
fail "Unexpected
|
197
|
+
fail "Unexpected connection_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
data/app/models/katello/ping.rb
CHANGED
@@ -195,10 +195,7 @@ module Katello
|
|
195
195
|
end
|
196
196
|
|
197
197
|
workers = json["online_workers"] || []
|
198
|
-
|
199
|
-
unless workers.count > 1
|
200
|
-
fail _("Not all necessary pulp workers running at %s.") % url
|
201
|
-
end
|
198
|
+
fail _("No pulpcore workers are running at %s.") % url if workers.empty?
|
202
199
|
|
203
200
|
json
|
204
201
|
end
|
@@ -289,6 +289,10 @@ module Katello
|
|
289
289
|
::Katello::Resources::CDN::CdnResource.ca_file if ::Katello::Resources::CDN::CdnResource.redhat_cdn?(url)
|
290
290
|
end
|
291
291
|
|
292
|
+
def using_mirrored_metadata?
|
293
|
+
self.yum? && self.library_instance? && self.mirror_on_sync
|
294
|
+
end
|
295
|
+
|
292
296
|
def archive?
|
293
297
|
self.environment.nil?
|
294
298
|
end
|
@@ -16,7 +16,7 @@ module Katello
|
|
16
16
|
User.as_anonymous_admin do
|
17
17
|
Organization.not_created_in_katello.each do |org|
|
18
18
|
creator = self.new(org)
|
19
|
-
creator.create!
|
19
|
+
creator.create!(raise_validation_errors: false)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -28,7 +28,9 @@ module Katello
|
|
28
28
|
def seed!
|
29
29
|
ActiveRecord::Base.transaction do
|
30
30
|
@organization.setup_label_from_name
|
31
|
-
|
31
|
+
|
32
|
+
# existing validation errors are not resolvable here, so don't validatate
|
33
|
+
@organization.save(validate: false)
|
32
34
|
|
33
35
|
create_library_environment
|
34
36
|
create_library_view
|
@@ -39,14 +41,19 @@ module Katello
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
def create!
|
44
|
+
def create!(raise_validation_errors: true)
|
43
45
|
ActiveRecord::Base.transaction do
|
44
46
|
seed!
|
45
47
|
|
46
48
|
create_backend_objects!
|
47
49
|
|
48
50
|
@organization.created_in_katello = true
|
49
|
-
|
51
|
+
|
52
|
+
begin
|
53
|
+
@organization.save!
|
54
|
+
rescue => e
|
55
|
+
raise e if raise_validation_errors
|
56
|
+
end
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
@@ -26,7 +26,7 @@ module Katello
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# rubocop:disable Metrics/AbcSize
|
29
|
-
def update_model(model)
|
29
|
+
def update_model(model, repository = nil)
|
30
30
|
updated = false
|
31
31
|
keys = %w(title id severity issued_date type description reboot_suggested solution updated_date summary)
|
32
32
|
custom_json = backend_data.slice(*keys)
|
@@ -55,6 +55,14 @@ module Katello
|
|
55
55
|
update_packages(model, backend_data['pkglist']) unless backend_data['pkglist'].blank?
|
56
56
|
update_modules(model, backend_data['pkglist']) unless backend_data['pkglist'].blank?
|
57
57
|
|
58
|
+
if !updated && repository.present?
|
59
|
+
backend_identifier = backend_data.dig(self.class.backend_unit_identifier)
|
60
|
+
if Katello::RepositoryErratum.where(repository_id: repository.id, erratum_id: model.id).where.not(erratum_pulp3_href: backend_identifier).any?
|
61
|
+
# Pulp has created a new record for this erratum because it has been updated so we need to update repo association too
|
62
|
+
updated = true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
return model.id if updated
|
59
67
|
end
|
60
68
|
# rubocop:enable Metrics/AbcSize
|
@@ -163,10 +163,6 @@ module Katello
|
|
163
163
|
RepositoryMirror.new(self).refresh_entities
|
164
164
|
end
|
165
165
|
|
166
|
-
def mirror_needs_updates?
|
167
|
-
RepositoryMirror.new(self).needs_updates?
|
168
|
-
end
|
169
|
-
|
170
166
|
def refresh_if_needed
|
171
167
|
tasks = []
|
172
168
|
tasks << update_remote #always update remote
|
@@ -74,6 +74,10 @@ module Katello
|
|
74
74
|
fetch_repository.latest_version_href
|
75
75
|
end
|
76
76
|
|
77
|
+
def publication_href
|
78
|
+
api.publications_api.list(:repository_version => version_href).results.first&.pulp_href
|
79
|
+
end
|
80
|
+
|
77
81
|
def create_version(options = {})
|
78
82
|
api.repository_versions_api.create(repository_href, options)
|
79
83
|
end
|
@@ -158,11 +162,17 @@ module Katello
|
|
158
162
|
end
|
159
163
|
end
|
160
164
|
|
161
|
-
def refresh_distributions(
|
165
|
+
def refresh_distributions(_options = {})
|
162
166
|
path = repo_service.relative_path
|
163
167
|
dist_params = {}
|
164
|
-
|
165
|
-
|
168
|
+
if repo_service.repo.repository_type.pulp3_skip_publication
|
169
|
+
dist_params[:repository_version] = version_href
|
170
|
+
fail "could not lookup a version_href for repo #{repo_service.repo.id}" if version_href.nil?
|
171
|
+
else
|
172
|
+
dist_params[:publication] = publication_href
|
173
|
+
fail "Could not lookup a publication_href for repo #{repo_service.repo.id}" if publication_href.nil?
|
174
|
+
end
|
175
|
+
|
166
176
|
dist_options = distribution_options(path, dist_params)
|
167
177
|
dist_options.delete(:content_guard) if repo_service.repo.content_type == "docker"
|
168
178
|
if (distro = repo_service.lookup_distributions(base_path: path).first) ||
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class KatelloPoolOrganizationIdNotNullable < ActiveRecord::Migration[6.0]
|
2
2
|
def up
|
3
3
|
::Katello::Pool.where(organization_id: nil).destroy_all
|
4
|
+
::Katello::Pool.where(subscription_id: nil).destroy_all
|
5
|
+
|
4
6
|
change_column :katello_pools, :organization_id, :integer, null: false
|
5
7
|
change_column :katello_pools, :subscription_id, :integer, null: false
|
6
8
|
|
data/lib/katello/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- N/A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|