katello 3.16.0.rc5 → 3.16.1.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.

Files changed (97) 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 +1 -1
  4. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
  5. data/app/controllers/katello/api/v2/host_tracer_controller.rb +0 -5
  6. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +15 -0
  7. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -1
  8. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -5
  9. data/app/helpers/katello/content_view_helper.rb +15 -0
  10. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  11. data/app/lib/actions/katello/capsule_content/sync.rb +3 -2
  12. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +17 -3
  13. data/app/lib/actions/katello/content_view/incremental_updates.rb +3 -1
  14. data/app/lib/actions/katello/content_view/publish.rb +55 -16
  15. data/app/lib/actions/katello/content_view_version/incremental_update.rb +84 -53
  16. data/app/lib/actions/katello/host/attach_subscriptions.rb +5 -1
  17. data/app/lib/actions/katello/product/destroy.rb +25 -4
  18. data/app/lib/actions/katello/repository/destroy.rb +5 -1
  19. data/app/lib/actions/katello/repository/multi_clone_contents.rb +62 -0
  20. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
  21. data/app/lib/actions/katello/repository/sync.rb +35 -25
  22. data/app/lib/actions/katello/repository/update.rb +11 -16
  23. data/app/lib/actions/katello/repository/verify_checksum.rb +28 -0
  24. data/app/lib/actions/katello/sync_plan/run.rb +1 -1
  25. data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
  26. data/app/lib/actions/pulp/repository/sync.rb +2 -1
  27. data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
  28. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
  29. data/app/lib/actions/pulp3/capsule_content/sync.rb +3 -1
  30. data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
  31. data/app/lib/actions/pulp3/content_migration.rb +4 -0
  32. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -4
  33. data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
  34. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +3 -1
  35. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +22 -0
  36. data/app/lib/actions/pulp3/repository/copy_content.rb +0 -1
  37. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
  38. data/app/lib/actions/pulp3/repository/multi_copy_units.rb +14 -7
  39. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -1
  40. data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +85 -0
  41. data/app/lib/actions/pulp3/repository/repair.rb +29 -0
  42. data/app/lib/actions/pulp3/repository/save_version.rb +20 -8
  43. data/app/lib/actions/pulp3/repository/save_versions.rb +47 -13
  44. data/app/lib/actions/pulp3/repository/sync.rb +1 -1
  45. data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +6 -2
  46. data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
  47. data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -0
  48. data/app/lib/katello/errors.rb +1 -15
  49. data/app/lib/katello/resources/cdn.rb +3 -2
  50. data/app/lib/katello/util/cdn_var_substitutor.rb +9 -6
  51. data/app/models/katello/concerns/smart_proxy_extensions.rb +14 -3
  52. data/app/models/katello/content_view.rb +18 -6
  53. data/app/models/katello/content_view_erratum_filter.rb +13 -0
  54. data/app/models/katello/content_view_filter.rb +4 -0
  55. data/app/models/katello/content_view_module_stream_filter.rb +30 -3
  56. data/app/models/katello/content_view_package_filter.rb +1 -1
  57. data/app/models/katello/host/content_facet.rb +1 -0
  58. data/app/models/katello/module_stream.rb +1 -1
  59. data/app/models/katello/ping.rb +1 -3
  60. data/app/models/katello/repository.rb +16 -0
  61. data/app/models/setting/content.rb +1 -1
  62. data/app/presenters/katello/sync_status_presenter.rb +4 -2
  63. data/app/services/cert/certs.rb +10 -2
  64. data/app/services/katello/pulp/repository/yum.rb +2 -1
  65. data/app/services/katello/pulp3/api/core.rb +4 -0
  66. data/app/services/katello/pulp3/erratum.rb +3 -1
  67. data/app/services/katello/pulp3/migration.rb +10 -5
  68. data/app/services/katello/pulp3/migration_plan.rb +6 -6
  69. data/app/services/katello/pulp3/repository.rb +13 -5
  70. data/app/services/katello/pulp3/repository/yum.rb +235 -35
  71. data/app/services/katello/pulp3/repository_mirror.rb +7 -2
  72. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
  73. data/app/services/katello/pulp3/task.rb +100 -0
  74. data/app/services/katello/pulp3/task_group.rb +79 -0
  75. data/app/services/katello/smart_proxy_helper.rb +13 -16
  76. data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
  77. data/config/routes/api/rhsm.rb +1 -0
  78. data/config/routes/api/v2.rb +2 -0
  79. data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
  80. data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +1 -0
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +6 -0
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +7 -1
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +1 -0
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +15 -0
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
  90. data/lib/katello/permission_creator.rb +2 -2
  91. data/lib/katello/plugin.rb +0 -1
  92. data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
  93. data/lib/katello/tasks/reports.rake +16 -0
  94. data/lib/katello/version.rb +1 -1
  95. data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -6
  96. metadata +34 -14
  97. data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
@@ -3,7 +3,7 @@ module Actions
3
3
  module Repository
4
4
  class MultiCopyUnits < Pulp3::AbstractAsyncTask
5
5
  # repo_map example: {
6
- # <source_repo_id>: {
6
+ # [<source_repo_ids>]: {
7
7
  # dest_repo: <dest_repo_id>,
8
8
  # base_version: <base_version>
9
9
  # }
@@ -22,7 +22,11 @@ module Actions
22
22
 
23
23
  def invoke_external_task
24
24
  unit_hrefs = []
25
- repo_map = input[:repo_map]
25
+ repo_map = {}
26
+
27
+ input[:repo_map].each do |source_repo_ids, dest_repo_map|
28
+ repo_map[JSON.parse(source_repo_ids)] = dest_repo_map
29
+ end
26
30
 
27
31
  if input[:unit_map][:errata].any?
28
32
  unit_hrefs << ::Katello::RepositoryErratum.
@@ -34,13 +38,16 @@ module Actions
34
38
  if input[:unit_map][:rpms].any?
35
39
  unit_hrefs << ::Katello::Rpm.where(:id => input[:unit_map][:rpms]).map(&:pulp_id)
36
40
  end
41
+ unit_hrefs.flatten!
42
+
43
+ repo_map.each do |_source_repos, dest_repo_map|
44
+ dest_repo_map[:content_unit_hrefs] = unit_hrefs
45
+ end
37
46
 
38
- # TODO: Fix this workaround by refactoring copy_units after general content view dep solving is refactored
39
- source_repo = ::Katello::Repository.find(repo_map.keys.first)
40
47
  target_repo = ::Katello::Repository.find(repo_map.values.first[:dest_repo])
41
- dest_base_version = repo_map.values.first[:base_version]
42
- repo_map.delete(repo_map.keys.first)
43
- output[:pulp_tasks] = target_repo.backend_service(SmartProxy.pulp_master).copy_units(source_repo, unit_hrefs.flatten, input[:dependency_solving], dest_base_version, repo_map)
48
+ unless unit_hrefs.flatten.empty?
49
+ output[:pulp_tasks] = target_repo.backend_service(SmartProxy.pulp_master).multi_copy_units(repo_map, input[:dependency_solving])
50
+ end
44
51
  end
45
52
  end
46
53
  end
@@ -12,7 +12,7 @@ module Actions
12
12
  def humanized_details
13
13
  ret = []
14
14
  ret << _("Cancelled.") if cancelled?
15
- ret << _("Total tasks: ") + ": #{finished_units}/#{total_units}"
15
+ ret << _("Total steps: ") + "#{finished_units}/#{total_units}"
16
16
  ret << "--------------------------------"
17
17
  progress_reports = sync_task.try(:[], 'progress_reports') || []
18
18
  progress_reports = progress_reports.sort_by { |pr| pr.try(:[], 'message') }
@@ -0,0 +1,85 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Repository
4
+ module Presenters
5
+ class RepairPresenter < Helpers::Presenter::Base
6
+ def humanized_output
7
+ if action.external_task
8
+ humanized_details
9
+ end
10
+ end
11
+
12
+ def progress
13
+ total_units == 0 ? 0.1 : finished_units.to_f / total_units
14
+ end
15
+
16
+ private
17
+
18
+ def repair_task
19
+ tasks = action.external_task.select do |task|
20
+ if task.key? 'name'
21
+ task['name'].include?("repair_version")
22
+ end
23
+ end
24
+ tasks.first
25
+ end
26
+
27
+ def cancelled?
28
+ repair_task && repair_task['state'] == 'cancelled'
29
+ end
30
+
31
+ def task_result
32
+ repair_task['result']
33
+ end
34
+
35
+ def task_result_details
36
+ task_result && task_result['details']
37
+ end
38
+
39
+ def humanized_details
40
+ ret = []
41
+ ret << _("Cancelled.") if cancelled?
42
+ ret << _("Total steps: ") + "#{finished_units}/#{total_units}"
43
+ ret << "--------------------------------"
44
+ progress_reports = repair_task.try(:[], 'progress_reports') || []
45
+ progress_reports = progress_reports.sort_by { |pr| pr.try(:[], 'message') }
46
+ progress_reports.each do |pr|
47
+ done = pr.try(:[], 'done')
48
+ total = pr.try(:[], 'total') || pr.try(:[], 'done')
49
+ unless done.nil? || total.nil?
50
+ ret << _(pr.try(:[], 'message') + ": #{done}/#{total}")
51
+ end
52
+ end
53
+
54
+ ret.join("\n")
55
+ end
56
+
57
+ def total_units
58
+ total_unit = 0
59
+ progress_reports = repair_task.try(:[], 'progress_reports') || []
60
+ progress_reports.each do |pr|
61
+ total = pr.try(:[], 'total')
62
+ total = pr.try(:[], 'done') if total.nil?
63
+ unless total.nil?
64
+ total_unit += total.to_i
65
+ end
66
+ end
67
+ total_unit
68
+ end
69
+
70
+ def finished_units
71
+ finished_unit = 0
72
+ progress_reports = repair_task.try(:[], 'progress_reports') || []
73
+ progress_reports.each do |pr|
74
+ done = pr.try(:[], 'done')
75
+ unless done.nil?
76
+ finished_unit += done.to_i
77
+ end
78
+ end
79
+ finished_unit
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,29 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Repository
4
+ class Repair < Pulp3::AbstractAsyncTask
5
+ include Helpers::Presenter
6
+ def plan(repository_id, smart_proxy)
7
+ plan_self(:repository_id => repository_id, :smart_proxy_id => smart_proxy.id)
8
+ end
9
+
10
+ def invoke_external_task
11
+ repo = ::Katello::Repository.find(input[:repository_id])
12
+ output[:response] = repo.backend_service(smart_proxy).repair(repo.version_href)
13
+ end
14
+
15
+ def run_progress
16
+ presenter.progress
17
+ end
18
+
19
+ def run_progress_weight
20
+ 10
21
+ end
22
+
23
+ def presenter
24
+ Presenters::RepairPresenter.new(self)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,27 +3,39 @@ module Actions
3
3
  module Repository
4
4
  class SaveVersion < Pulp3::Abstract
5
5
  def plan(repository, options)
6
- plan_self(:repository_id => repository.id, :tasks => options[:tasks], :repository_details => options[:repository_details])
6
+ fail "Cannot accept tasks and repository_details into Save Version." if options[:tasks].present? && options[:repository_details].present?
7
+ plan_self(:repository_id => repository.id, :tasks => options[:tasks], :repository_details => options[:repository_details], :force_fetch_version => options.fetch(:force_fetch_version, false))
7
8
  end
8
9
 
9
10
  def run
10
11
  repo = ::Katello::Repository.find(input[:repository_id])
11
12
 
12
- if input[:tasks]
13
- version_href = input[:tasks].last[:created_resources].first
14
- end
15
-
16
- if !version_href && input[:repository_details]
13
+ if input[:force_fetch_version]
14
+ version_href = fetch_version_href(repo)
15
+ elsif input[:repository_details].present?
17
16
  version_href = input[:repository_details][:latest_version_href]
17
+ elsif input[:tasks].present?
18
+ version_href = input[:tasks].last[:created_resources].first
19
+ else
20
+ version_href = fetch_version_href(repo)
18
21
  end
19
22
 
20
23
  if version_href
21
- repo.update(:version_href => version_href)
22
- output[:contents_changed] = true
24
+ if repo.version_href != version_href || input[:force_fetch_version]
25
+ output[:contents_changed] = true
26
+ repo.update(:version_href => version_href)
27
+ end
23
28
  else
24
29
  output[:contents_changed] = false
25
30
  end
26
31
  end
32
+
33
+ def fetch_version_href(repo)
34
+ # Fetch latest Pulp 3 repo version
35
+ repo_backend_service = repo.backend_service(SmartProxy.pulp_master)
36
+ repo_href = repo_backend_service.repository_reference.repository_href
37
+ repo_backend_service.api.repositories_api.read(repo_href).latest_version_href
38
+ end
27
39
  end
28
40
  end
29
41
  end
@@ -7,23 +7,34 @@ module Actions
7
7
  end
8
8
 
9
9
  def run
10
+ return if input[:tasks].empty?
10
11
  version_hrefs = input[:tasks].last[:created_resources]
11
- repositories = input[:repository_ids].collect do |repo_id|
12
- ::Katello::Repository.find(repo_id)
13
- end
12
+ repositories = find_repositories(input[:repository_ids])
14
13
 
15
- output[:contents_changed] = false
16
- output[:updated_repositories] = []
14
+ output.merge!(contents_changed: false, updated_repositories: [])
17
15
  repositories.each do |repo|
18
- # Chop off the version number to compare base repo strings
19
- unversioned_href = repo.version_href[0..-2].rpartition('/').first
20
- new_version_href = version_hrefs.detect do |version_href|
21
- unversioned_href == version_href[0..-2].rpartition('/').first
16
+ repo_backend_service = repo.backend_service(SmartProxy.pulp_master)
17
+ if repo.version_href
18
+ # Chop off the version number to compare base repo strings
19
+ unversioned_href = repo.version_href[0..-2].rpartition('/').first
20
+ # Could have multiple version_hrefs for the same repo depending on the copy task
21
+ new_version_hrefs = version_hrefs.collect do |version_href|
22
+ version_href if unversioned_href == version_href[0..-2].rpartition('/').first
23
+ end
24
+
25
+ new_version_hrefs.compact!
26
+ if new_version_hrefs.size > 1
27
+ # Find latest version_href by its version number
28
+ new_version_href = version_map(new_version_hrefs).max_by { |_href, version| version }.first
29
+ else
30
+ new_version_href = new_version_hrefs.first
31
+ end
32
+
33
+ # Successive incremental updates won't generate a new repo version, so fetch the latest Pulp 3 repo version
34
+ new_version_href ||= latest_version_href(repo_backend_service)
35
+ else
36
+ new_version_href = latest_version_href(repo_backend_service)
22
37
  end
23
- # Successive incremental updates won't generate a new repo version, so fetch the latest Pulp 3 repo version
24
- new_version_href ||= ::Katello::Pulp3::Api::Yum.new(SmartProxy.pulp_master!).
25
- repositories_api.read(repo.backend_service(SmartProxy.pulp_master).
26
- repository_reference.repository_href).latest_version_href
27
38
 
28
39
  unless new_version_href == repo.version_href
29
40
  repo.update(version_href: new_version_href)
@@ -33,6 +44,29 @@ module Actions
33
44
  end
34
45
  end
35
46
  end
47
+
48
+ def version_map(version_hrefs)
49
+ version_map = {}
50
+ version_hrefs.each do |href|
51
+ version_map[href] = href.split("/")[-1].to_i
52
+ end
53
+ version_map
54
+ end
55
+
56
+ def latest_version_href(repo_backend_service)
57
+ repo_backend_service.api.repositories_api.
58
+ read(repo_backend_service.repository_reference.repository_href).latest_version_href
59
+ end
60
+
61
+ def find_repositories(repository_ids)
62
+ repository_ids.collect do |repo_id|
63
+ if repo_id.is_a?(Hash)
64
+ ::Katello::Repository.find(repo_id.with_indifferent_access[:id])
65
+ else
66
+ ::Katello::Repository.find(repo_id)
67
+ end
68
+ end
69
+ end
36
70
  end
37
71
  end
38
72
  end
@@ -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, _smart_proxy)
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, SmartProxy.pulp_master)
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 - 1
28
+ offset += actual_chunk_size
29
29
  ensure
30
30
  filechunk.close
31
31
  filechunk.unlink
@@ -154,6 +154,10 @@ module Katello
154
154
  end
155
155
  # rubocop:enable Metrics/MethodLength
156
156
 
157
+ def sortable_version(version)
158
+ Util::Package.sortable_version(version)
159
+ end
160
+
157
161
  private
158
162
 
159
163
  def host_subscription_facet(host)
@@ -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 (proxy = ::HttpProxy.default_global_content_proxy)
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
- futures = to_resolve.map do |path_with_substitution|
63
- Concurrent::Promises.future do
64
- path_with_substitution.resolve_substitutions(@resource)
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
- futures.each do |future|
69
- resolved << future.value
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.ssl_client_cert = ::Cert::Certs.ssl_client_cert
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)