katello 3.18.2 → 3.18.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb532cdaf1e25293105ac236fca987d75fb73d336c9a7c48f6d9d5e196b3eee6
4
- data.tar.gz: 71581e670f4b0bd9811aaa529ef8fe515a958e9bd9d7a558b6bbda8aa6efdeba
3
+ metadata.gz: 9c5ad1aaf8a0bb032cc1ffd42c4c070c77cc538044396af1cd40db8d00132e58
4
+ data.tar.gz: fd418dbd20507da2ca47e937df543ccf1f5a2c8d254f17623aec03f0d5d2767b
5
5
  SHA512:
6
- metadata.gz: 0630ee6e3a5e8c5ee653a499611bd1e647b62d6d291619c398cd32af95bdf3ef4e2b3b3097f13d53cfc35313d56e1e1a6cd64db1b040ed7775824bc199bbadc7
7
- data.tar.gz: 1c6b2912fd5438dcbbcff04c152f45e2cc003535a3ebc8c84fbca5574b5b2e2ccc32684f9a4e61048f9c6f81432eb882a31faf54aba3b7512b5df3bfede1f37c
6
+ metadata.gz: b21464bd7f2341093cb31c47a6ee1792d508b8d16f6c9f47db4e8cffb3bc737f02aa1150e50cc05352c668db37eadc5fe708cd0d2705010fbd0072f46b887877
7
+ data.tar.gz: b67b69add02fae0357308a8301ac689814f2e32d835b5270c421d94cf46f6068b6398cd18cbb7da55913106deac0be816668939c605e7bf20d0a671740039402
@@ -72,7 +72,11 @@ module Actions
72
72
  end
73
73
  plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
74
74
  :contents_changed => contents_changed)
75
- plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed) if generate_applicability
75
+
76
+ if generate_applicability && !SETTINGS[:katello][:katello_applicability]
77
+ plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed)
78
+ end
79
+
76
80
  plan_action(Katello::Repository::SyncHook, :id => repo.id)
77
81
  end
78
82
  end
@@ -8,7 +8,7 @@ module Katello
8
8
  def filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs)
9
9
  rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
10
10
  package_groups.reject do |package_group|
11
- (package_group.package_names & rpms.pluck(:name)).empty?
11
+ (package_group.package_names - rpms.pluck(:name)).any?
12
12
  end
13
13
  end
14
14
 
@@ -31,43 +31,21 @@ module Katello
31
31
  validates :host, :presence => true, :allow_blank => false
32
32
  validates_with Validators::ContentViewEnvironmentValidator
33
33
 
34
- def bindable_types
35
- [
36
- {
37
- type: Repository::DEB_TYPE,
38
- matcher: '/pulp/deb/',
39
- paths: []
40
- },
41
- {
42
- type: Repository::YUM_TYPE,
43
- matcher: '/pulp/repos/',
44
- paths: []
45
- }
46
- ]
47
- end
48
-
49
34
  def update_repositories_by_paths(paths)
50
- bindable_paths = bindable_types
35
+ prefixes = %w(/pulp/deb/ /pulp/repos/ /pulp/content/)
51
36
  relative_paths = []
52
37
 
53
- # paths == ["/pulp/repos/Default_Organization/Library/custom/Test_product/test2",
54
- # "/pulp/repos/Default_Organization/Library/custom/Test_product/My_repo"]
55
- paths.each do |absolute_path|
56
- bindable_paths.each do |supported|
57
- relative_path = absolute_path.gsub(supported[:matcher], '') # remove e.g. '/pulp/repos/' from beginning of string
58
- relative_paths << relative_path unless relative_path == absolute_path
59
- if absolute_path.starts_with?(supported[:matcher])
60
- supported[:paths] << relative_path
61
- break
62
- end
38
+ # paths == ["/pulp/repos/Default_Organization/Library/custom/Test_product/test2"]
39
+ paths.each do |path|
40
+ if (prefix = prefixes.find { |pre| path.start_with?(pre) })
41
+ relative_paths << path.gsub(prefix, '')
42
+ else
43
+ Rails.logger.warn("System #{self.host.name} (#{self.host.id}) requested binding to repo with unknown prefix. #{path}")
63
44
  end
64
45
  end
65
46
 
66
- repos = bindable_paths.flat_map do |supported|
67
- repos = Repository.joins(:root).where(RootRepository.table_name => {content_type: supported[:type]}, relative_path: supported[:paths])
68
- relative_paths -= repos.pluck(:relative_path) # remove relative paths that match our repos
69
- repos
70
- end
47
+ repos = Repository.where(relative_path: relative_paths)
48
+ relative_paths -= repos.pluck(:relative_path) # remove relative paths that match our repos
71
49
 
72
50
  # Any leftover relative paths do not match the repos we've just retrieved from the db,
73
51
  # so we should log warnings about them.
@@ -23,25 +23,18 @@ module Katello
23
23
  services
24
24
  end
25
25
 
26
- # Calls "status" services in all backend engines.
27
26
  def ping(services: nil, capsule_id: nil)
28
- services ||= self.services(capsule_id)
29
- result = {}
30
- services.each { |service| result[service] = {} }
27
+ ping_services_for_capsule(services, capsule_id)
28
+ end
31
29
 
32
- ping_pulp3_without_auth(result[:pulp3], capsule_id) if result.include?(:pulp3)
33
- ping_pulp_without_auth(result[:pulp], capsule_id) if result.include?(:pulp)
34
- ping_candlepin_without_auth(result[:candlepin]) if result.include?(:candlepin)
30
+ def ping!(services: nil, capsule_id: nil)
31
+ result = ping_services_for_capsule(services, capsule_id)
35
32
 
36
- ping_pulp_with_auth(result[:pulp_auth], result[:pulp][:status]) if result.include?(:pulp_auth)
37
- ping_candlepin_with_auth(result[:candlepin_auth]) if result.include?(:candlepin_auth)
38
- ping_foreman_tasks(result[:foreman_tasks]) if result.include?(:foreman_tasks)
39
- ping_katello_events(result[:katello_events]) if result.include?(:katello_events)
40
- ping_candlepin_events(result[:candlepin_events]) if result.include?(:candlepin_events)
33
+ if result[:status] != OK_RETURN_CODE
34
+ failed_names = failed_services(result).keys
35
+ fail("The following services have not been started or are reporting errors: #{failed_names.join(', ')}")
36
+ end
41
37
 
42
- # set overall status result code
43
- result = {:services => result}
44
- result[:status] = result[:services].each_value.any? { |v| v[:status] == FAIL_RETURN_CODE } ? FAIL_RETURN_CODE : OK_RETURN_CODE
45
38
  result
46
39
  end
47
40
 
@@ -221,6 +214,33 @@ module Katello
221
214
 
222
215
  private
223
216
 
217
+ def failed_services(result)
218
+ result[:services].reject do |_name, details|
219
+ details[:status] != OK_RETURN_CODE
220
+ end
221
+ end
222
+
223
+ def ping_services_for_capsule(services, capsule_id)
224
+ services ||= self.services(capsule_id)
225
+ result = {}
226
+ services.each { |service| result[service] = {} }
227
+
228
+ ping_pulp3_without_auth(result[:pulp3], capsule_id) if result.include?(:pulp3)
229
+ ping_pulp_without_auth(result[:pulp], capsule_id) if result.include?(:pulp)
230
+ ping_candlepin_without_auth(result[:candlepin]) if result.include?(:candlepin)
231
+
232
+ ping_pulp_with_auth(result[:pulp_auth], result[:pulp][:status]) if result.include?(:pulp_auth)
233
+ ping_candlepin_with_auth(result[:candlepin_auth]) if result.include?(:candlepin_auth)
234
+ ping_foreman_tasks(result[:foreman_tasks]) if result.include?(:foreman_tasks)
235
+ ping_katello_events(result[:katello_events]) if result.include?(:katello_events)
236
+ ping_candlepin_events(result[:candlepin_events]) if result.include?(:candlepin_events)
237
+
238
+ # set overall status result code
239
+ result = {:services => result}
240
+ result[:status] = result[:services].each_value.any? { |v| v[:status] == FAIL_RETURN_CODE } ? FAIL_RETURN_CODE : OK_RETURN_CODE
241
+ result
242
+ end
243
+
224
244
  def fetch_proxy(capsule_id)
225
245
  capsule_id ? SmartProxy.unscoped.find(capsule_id) : SmartProxy.pulp_primary
226
246
  end
@@ -111,6 +111,8 @@ module Katello
111
111
  content_types.each do |content_type|
112
112
  if Migration::CORRUPTABLE_CONTENT_TYPES.include?(content_type.model_class)
113
113
  content_type.model_class.ignored_missing_migrated_content.destroy_all
114
+ elsif content_type.model_class == Katello::Erratum
115
+ Katello::RepositoryErratum.where(:erratum_pulp3_href => nil).delete_all
114
116
  else
115
117
  content_type.model_class.unmigrated_content.destroy_all
116
118
  end
@@ -111,6 +111,10 @@ module Katello
111
111
  backend_data['rpm_license']
112
112
  end
113
113
 
114
+ def parse_filename(path)
115
+ File.split(path).last unless path.blank?
116
+ end
117
+
114
118
  def update_model(model)
115
119
  custom_json = {}
116
120
  custom_json['modular'] = backend_data['is_modular']
@@ -119,7 +123,7 @@ module Katello
119
123
  each { |field| custom_json[field] = backend_data[field] }
120
124
  custom_json['release_sortable'] = Util::Package.sortable_version(backend_data['release'])
121
125
  custom_json['version_sortable'] = Util::Package.sortable_version(backend_data['version'])
122
- custom_json['filename'] = backend_data['location_href']
126
+ custom_json['filename'] = parse_filename(backend_data['location_href']) #location_href is the relative path of the rpm in the upstream repo
123
127
  custom_json['checksum'] = backend_data['pkgId']
124
128
  custom_json['sourcerpm'] = backend_data['rpm_sourcerpm']
125
129
  model.assign_attributes(custom_json)
@@ -1,6 +1,9 @@
1
1
  namespace :katello do
2
2
  desc "Runs a Pulp 2 to 3 Content Migration for supported types. May be run multiple times. Use wait=false to immediately return with a task url."
3
- task :pulp3_migration => ["dynflow:client", "check_ping"] do
3
+ task :pulp3_migration => ["dynflow:client"] do
4
+ services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
5
+ Katello::Ping.ping!(services: services)
6
+
4
7
  puts "Starting task."
5
8
  SmartProxy.pulp_primary.refresh
6
9
 
@@ -8,6 +11,7 @@ namespace :katello do
8
11
  wait = ::Foreman::Cast.to_bool(ENV['wait'] || 'true')
9
12
  preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
10
13
 
14
+ User.current = User.anonymous_api_admin
11
15
  task = ForemanTasks.async_task(Actions::Pulp3::ContentMigration, SmartProxy.pulp_primary, reimport_all: reimport_all)
12
16
 
13
17
  if wait
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.18.2".freeze
2
+ VERSION = "3.18.2.1".freeze
3
3
  end
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: 3.18.2
4
+ version: 3.18.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails