katello 4.0.1.2 → 4.0.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/sync.rb +1 -1
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +14 -3
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +2 -2
- data/app/lib/actions/katello/repository/check_matching_content.rb +3 -4
- data/app/lib/actions/pulp3/content_guard/refresh.rb +6 -10
- data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +1 -1
- data/app/lib/katello/errors.rb +1 -1
- data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
- data/app/models/katello/concerns/hostgroup_extensions.rb +3 -1
- data/app/models/katello/concerns/redhat_extensions.rb +18 -10
- data/app/models/katello/concerns/smart_proxy_extensions.rb +9 -0
- data/app/models/katello/glue/pulp/repo.rb +0 -19
- data/app/models/katello/ping.rb +2 -9
- data/app/models/katello/repository.rb +14 -0
- data/app/services/cert/certs.rb +4 -0
- data/app/services/katello/pulp3/api/content_guard.rb +39 -5
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -0
- data/app/views/overrides/smart_proxies/_download_policy.erb +1 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +1 -1
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +25 -22
- data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +11 -0
- data/lib/katello.rb +1 -1
- data/lib/katello/engine.rb +0 -1
- data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
- data/lib/katello/version.rb +1 -1
- data/locale/bn/LC_MESSAGES/katello.mo +0 -0
- data/locale/bn/katello.edit.po +8542 -0
- data/locale/bn/katello.po.time_stamp +0 -0
- data/locale/cs/LC_MESSAGES/katello.mo +0 -0
- data/locale/cs/katello.edit.po +8444 -0
- data/locale/cs/katello.po.time_stamp +0 -0
- data/locale/de/LC_MESSAGES/katello.mo +0 -0
- data/locale/de/katello.edit.po +8351 -0
- data/locale/de/katello.po.time_stamp +0 -0
- data/locale/en/LC_MESSAGES/katello.mo +0 -0
- data/locale/en/katello.edit.po +8165 -0
- data/locale/en/katello.po.time_stamp +0 -0
- data/locale/es/LC_MESSAGES/katello.mo +0 -0
- data/locale/es/katello.edit.po +8313 -0
- data/locale/es/katello.po.time_stamp +0 -0
- data/locale/fr/LC_MESSAGES/katello.mo +0 -0
- data/locale/fr/katello.edit.po +8363 -0
- data/locale/fr/katello.po.time_stamp +0 -0
- data/locale/gu/LC_MESSAGES/katello.mo +0 -0
- data/locale/gu/katello.edit.po +8544 -0
- data/locale/gu/katello.po.time_stamp +0 -0
- data/locale/hi/LC_MESSAGES/katello.mo +0 -0
- data/locale/hi/katello.edit.po +8541 -0
- data/locale/hi/katello.po.time_stamp +0 -0
- data/locale/it/LC_MESSAGES/katello.mo +0 -0
- data/locale/it/katello.edit.po +8300 -0
- data/locale/it/katello.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/katello.mo +0 -0
- data/locale/ja/katello.edit.po +8329 -0
- data/locale/ja/katello.po.time_stamp +0 -0
- data/locale/kn/LC_MESSAGES/katello.mo +0 -0
- data/locale/kn/katello.edit.po +8542 -0
- data/locale/kn/katello.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/katello.mo +0 -0
- data/locale/ko/katello.edit.po +8296 -0
- data/locale/ko/katello.po.time_stamp +0 -0
- data/locale/mr/LC_MESSAGES/katello.mo +0 -0
- data/locale/mr/katello.edit.po +8506 -0
- data/locale/mr/katello.po.time_stamp +0 -0
- data/locale/or/LC_MESSAGES/katello.mo +0 -0
- data/locale/or/katello.edit.po +8542 -0
- data/locale/or/katello.po.time_stamp +0 -0
- data/locale/pa/LC_MESSAGES/katello.mo +0 -0
- data/locale/pa/katello.edit.po +8528 -0
- data/locale/pa/katello.po.time_stamp +0 -0
- data/locale/pt/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt/katello.edit.po +8259 -0
- data/locale/pt/katello.po.time_stamp +0 -0
- data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt_BR/katello.edit.po +8296 -0
- data/locale/pt_BR/katello.po.time_stamp +0 -0
- data/locale/ru/LC_MESSAGES/katello.mo +0 -0
- data/locale/ru/katello.edit.po +8316 -0
- data/locale/ru/katello.po.time_stamp +0 -0
- data/locale/ta/LC_MESSAGES/katello.mo +0 -0
- data/locale/ta/katello.edit.po +8540 -0
- data/locale/ta/katello.po.time_stamp +0 -0
- data/locale/te/LC_MESSAGES/katello.mo +0 -0
- data/locale/te/katello.edit.po +8540 -0
- data/locale/te/katello.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_CN/katello.edit.po +8295 -0
- data/locale/zh_CN/katello.po.time_stamp +0 -0
- data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_TW/katello.edit.po +8427 -0
- data/locale/zh_TW/katello.po.time_stamp +0 -0
- metadata +75 -7
- data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77e02e169ae9d1f8c31a49999ac7f6fcc900e5a3c9338beb825d19e3ed8598a4
|
4
|
+
data.tar.gz: 7049ec270dcd1db4d3335d33f4665306178289888b7ba33e283f25d69a72768d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4282384c1c10065f6d731af1e45a006cc4b5a294e1d906954fad02fd81db19faf772a3c8bcd81aca33dcf7bb2c779f740ea3a2155cefb84d9af041f6e55f2d6
|
7
|
+
data.tar.gz: 87a57f7437ebfdf7f567efbae8e24f60d1c5655aa18944085cc9ce141483b61b92637bf1f10999c5ea00d35fe16ec98f8e98fd0e9bb244bf294efe33ef84407c
|
@@ -39,7 +39,7 @@ module Actions
|
|
39
39
|
end
|
40
40
|
|
41
41
|
if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE)
|
42
|
-
plan_action(Actions::Pulp3::
|
42
|
+
plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
|
43
43
|
plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
|
44
44
|
end
|
45
45
|
plan_action(SyncCapsule, smart_proxy, refresh_options)
|
@@ -19,7 +19,8 @@ module Actions
|
|
19
19
|
|
20
20
|
# rubocop:disable Metrics/MethodLength
|
21
21
|
# rubocop:disable Metrics/AbcSize
|
22
|
-
|
22
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
23
|
+
def plan(old_version, environments, options = {})
|
23
24
|
dep_solve = options.fetch(:resolve_dependencies, true)
|
24
25
|
description = options.fetch(:description, '')
|
25
26
|
content = options.fetch(:content, {})
|
@@ -72,8 +73,18 @@ module Actions
|
|
72
73
|
unit_map = pulp3_content_mapping(content)
|
73
74
|
|
74
75
|
unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
|
75
|
-
|
76
|
-
|
76
|
+
sequence do
|
77
|
+
copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
|
78
|
+
dependency_solving: dep_solve).output
|
79
|
+
repos_to_clone.each do |source_repos|
|
80
|
+
if separated_repo_map[:pulp3_yum].keys.include?(source_repos)
|
81
|
+
copy_repos(repository_mapping[source_repos],
|
82
|
+
new_content_view_version,
|
83
|
+
content,
|
84
|
+
dep_solve)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
77
88
|
end
|
78
89
|
end
|
79
90
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Actions
|
2
2
|
module Katello
|
3
3
|
module OrphanCleanup
|
4
|
-
class RemoveOrphans <
|
4
|
+
class RemoveOrphans < Actions::Base
|
5
5
|
input_format do
|
6
6
|
param :capsule_id
|
7
7
|
end
|
8
8
|
def plan(proxy)
|
9
9
|
sequence do
|
10
|
-
plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy)
|
10
|
+
plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy) if (proxy.has_feature?(SmartProxy::PULP_FEATURE) || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE))
|
11
11
|
if proxy.pulp3_enabled?
|
12
12
|
plan_action(
|
13
13
|
Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans,
|
@@ -13,6 +13,7 @@ module Actions
|
|
13
13
|
def run
|
14
14
|
source_repo = ::Katello::Repository.find(input[:source_repo_id])
|
15
15
|
target_repo = ::Katello::Repository.find(input[:target_repo_id])
|
16
|
+
target_repo_published = target_repo.backend_service(SmartProxy.pulp_primary).published?
|
16
17
|
|
17
18
|
if source_repo.content_type == ::Katello::Repository::YUM_TYPE
|
18
19
|
srpms_match = srpms_match?(source_repo, target_repo)
|
@@ -23,16 +24,14 @@ module Actions
|
|
23
24
|
yum_metadata_files = yum_metadata_files_match?(source_repo, target_repo)
|
24
25
|
checksum_match = (target_repo.saved_checksum_type == source_repo.saved_checksum_type)
|
25
26
|
|
26
|
-
published = target_repo.backend_service(SmartProxy.pulp_primary).published?
|
27
|
-
|
28
27
|
output[:checksum_match] = checksum_match
|
29
|
-
output[:matching_content] = yum_metadata_files && srpms_match && rpms && errata && package_groups && distributions &&
|
28
|
+
output[:matching_content] = yum_metadata_files && srpms_match && rpms && errata && package_groups && distributions && target_repo_published && checksum_match
|
30
29
|
end
|
31
30
|
|
32
31
|
if source_repo.content_type == ::Katello::Repository::DEB_TYPE
|
33
32
|
debs = debs_match?(source_repo, target_repo)
|
34
33
|
|
35
|
-
output[:matching_content] = debs &&
|
34
|
+
output[:matching_content] = debs && target_repo_published
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
@@ -2,16 +2,12 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module ContentGuard
|
4
4
|
class Refresh < Pulp3::Abstract
|
5
|
-
def plan(smart_proxy
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
content_guard_api.create
|
13
|
-
::Katello::Pulp3::ContentGuard.import(smart_proxy)
|
14
|
-
end
|
5
|
+
def plan(smart_proxy)
|
6
|
+
plan_self(smart_proxy_id: smart_proxy.id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
::Katello::Pulp3::Api::ContentGuard.new(smart_proxy).refresh
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
data/app/lib/katello/errors.rb
CHANGED
@@ -53,7 +53,7 @@ module Katello
|
|
53
53
|
|
54
54
|
class PulpcoreMissingCapabilities < StandardError
|
55
55
|
def message
|
56
|
-
_("A smart proxy seems to have been refreshed without pulpcore being running.
|
56
|
+
_("A smart proxy seems to have been refreshed without pulpcore being running. Please refresh the smart proxy after ensuring that pulpcore services are running.")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# Used exclusively by fix_hostgroup_facets.rake task
|
2
|
+
module Katello
|
3
|
+
module Util
|
4
|
+
class HostgroupFacetsHelper
|
5
|
+
def initialize
|
6
|
+
@logger = Logger.new($stdout)
|
7
|
+
end
|
8
|
+
|
9
|
+
def interested_hostgroups
|
10
|
+
groups = ::Hostgroup.unscoped.where(
|
11
|
+
id: Katello::Hostgroup::ContentFacet.
|
12
|
+
where(content_source_id: nil,
|
13
|
+
kickstart_repository_id: nil,
|
14
|
+
content_view_id: nil,
|
15
|
+
lifecycle_environment_id: nil).select(:hostgroup_id))
|
16
|
+
parents = groups.select { |group| group.parent.blank? }
|
17
|
+
children = groups.reject { |group| group.parent.blank? }
|
18
|
+
# we want the parents to get created before the children
|
19
|
+
# hence the order
|
20
|
+
parents + children
|
21
|
+
end
|
22
|
+
|
23
|
+
def pick_facet_values(hg)
|
24
|
+
# This call looks at the audit logs for a host group.
|
25
|
+
# Pries out information related to lce, ks, cv and content_source_id from the audit logs.
|
26
|
+
# The audit logs typically only contain updates.
|
27
|
+
# So if the user changed just the content_view_id, then that is the only thing marked as audited_changes.
|
28
|
+
# Hence we need to go through all the audit logs until we have information on lce, ks, cv and cs.
|
29
|
+
# If there was only one audit log and that was during the creation of hostgroup
|
30
|
+
# the audited changes look like this
|
31
|
+
# ```ruby
|
32
|
+
# {
|
33
|
+
# content_view_id: 10,
|
34
|
+
# kickstart_repository_id: 1000
|
35
|
+
# ......
|
36
|
+
# }
|
37
|
+
# ```
|
38
|
+
# However if you updated the hostgroup and set the kickstart_repository_id, or
|
39
|
+
# content_view_id then audited changes look like
|
40
|
+
# ```ruby
|
41
|
+
# {
|
42
|
+
# content_view_id: [10, 11],
|
43
|
+
# kickstart_repository_id: [1000, 1200]
|
44
|
+
# ......
|
45
|
+
# }
|
46
|
+
# ```
|
47
|
+
# So the code says "if the attribute value is an array pick the last value else just keep the value as it is "
|
48
|
+
|
49
|
+
# Further along it is to be noted that `hostgroup.audits` returns the audits ordered by the version number in ascending order, so the latest audit will be `hostgroup.audits.last`
|
50
|
+
|
51
|
+
# We want to iterate though each audit from latest audit to start, and as soon as we find a content_view_id key or kickstart_repository_id key or lifecycle environment_id key or content_source_id key we want it to be set once.
|
52
|
+
|
53
|
+
# So if I had an audit history like
|
54
|
+
# ``` ruby
|
55
|
+
# {
|
56
|
+
# content_view_id: 10,
|
57
|
+
# kickstart_repository_id: 1000,
|
58
|
+
# version:1
|
59
|
+
# ......
|
60
|
+
# },
|
61
|
+
# {
|
62
|
+
# content_view_id: [10, 11],
|
63
|
+
# kickstart_repository_id: [1000, 1200],
|
64
|
+
# version: 2
|
65
|
+
# ......
|
66
|
+
# }
|
67
|
+
# ```
|
68
|
+
|
69
|
+
# The code would start at version 2, notice that cv_id and ks_repo were set there
|
70
|
+
# and keep them as the final.
|
71
|
+
# So when it goes to version 1 since cv_id and ks_repo are already set,
|
72
|
+
# it will ignore. It will finally
|
73
|
+
# return {content_view_id: 11, kickstart_repository_id: 1200}
|
74
|
+
facet_values = {}
|
75
|
+
hg.audits.reverse_each do |audit|
|
76
|
+
hg_changes = audit.audited_changes.slice("lifecycle_environment_id",
|
77
|
+
"kickstart_repository_id",
|
78
|
+
"content_view_id",
|
79
|
+
"content_source_id")
|
80
|
+
facet_values = hg_changes.merge(facet_values)
|
81
|
+
end
|
82
|
+
|
83
|
+
values = facet_values.map do |k, v|
|
84
|
+
v = v[-1] if v.is_a? Array
|
85
|
+
[k, v]
|
86
|
+
end
|
87
|
+
values.to_h.with_indifferent_access
|
88
|
+
end
|
89
|
+
|
90
|
+
def main
|
91
|
+
bad_hgs = []
|
92
|
+
good_hgs = []
|
93
|
+
|
94
|
+
groups = interested_hostgroups.each do |hg|
|
95
|
+
facet = hg.content_facet
|
96
|
+
values = pick_facet_values(hg)
|
97
|
+
if !values.empty? && facet.update(values)
|
98
|
+
good_hgs << { hostgroup: hg, facet_values: values }
|
99
|
+
else
|
100
|
+
bad_hgs << { hostgroup: hg, facet_values: values }
|
101
|
+
facet.save(validate: false)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
unless bad_hgs.empty?
|
106
|
+
@logger.warn "Some of the hostgroups reported a validation error. "\
|
107
|
+
"The hostgroups have been updated. "\
|
108
|
+
"Check via the Web UI."
|
109
|
+
|
110
|
+
bad_hgs.each do |bad_group|
|
111
|
+
@logger.warn "Hostgroup #{bad_group[:hostgroup]}"
|
112
|
+
@logger.warn "Facet Values #{bad_group[:facet_values]}"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
unless good_hgs.empty?
|
116
|
+
@logger.info "Following hostgroups were succesfully updated."
|
117
|
+
good_hgs.each do |good_group|
|
118
|
+
@logger.info "Hostgroup #{good_group[:hostgroup]}"
|
119
|
+
@logger.info "Facet Values #{good_group[:facet_values]}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
@logger.info("#{groups.count} Hostgroup(s) were updated.")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -107,7 +107,9 @@ module Katello
|
|
107
107
|
return true unless operatingsystem
|
108
108
|
|
109
109
|
if operatingsystem.respond_to? :kickstart_repos
|
110
|
-
|
110
|
+
operatingsystem.kickstart_repos(self, content_facet: content_facet).any? do |repo|
|
111
|
+
repo[:id] == (content_facet&.kickstart_repository_id || content_facet&.kickstart_repository&.id)
|
112
|
+
end
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
@@ -10,8 +10,15 @@ module Katello
|
|
10
10
|
minor ||= '' # treat minor versions as empty string to not confuse with nil
|
11
11
|
os = ::Redhat.where(:name => os_name, :major => major, :minor => minor).try(:first)
|
12
12
|
return os if os
|
13
|
-
|
14
|
-
|
13
|
+
|
14
|
+
if ::Redhat.where(:title => "#{os_name} #{repo.distribution_version}").present?
|
15
|
+
description = "#{os_name} #{repo.distribution_version} #{SecureRandom.uuid}"
|
16
|
+
create_os = lambda do
|
17
|
+
::Redhat.create!(:name => os_name, :major => major, :minor => minor, :description => description)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
create_os = lambda { ::Redhat.create!(:name => os_name, :major => major, :minor => minor) }
|
21
|
+
end
|
15
22
|
|
16
23
|
begin
|
17
24
|
create_os.call
|
@@ -42,10 +49,11 @@ module Katello
|
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
45
|
-
def kickstart_repos(host)
|
46
|
-
distros = distribution_repositories(host).where(distribution_bootable: true)
|
47
|
-
|
48
|
-
|
52
|
+
def kickstart_repos(host, content_facet: nil)
|
53
|
+
distros = distribution_repositories(host, content_facet: content_facet).where(distribution_bootable: true)
|
54
|
+
content_facet ||= host.content_facet
|
55
|
+
if distros && content_facet&.content_source
|
56
|
+
distros.map { |distro| distro.to_hash(content_facet.content_source) }
|
49
57
|
else
|
50
58
|
[]
|
51
59
|
end
|
@@ -62,10 +70,10 @@ module Katello
|
|
62
70
|
end
|
63
71
|
end
|
64
72
|
|
65
|
-
def distribution_repositories(host)
|
66
|
-
|
67
|
-
|
68
|
-
|
73
|
+
def distribution_repositories(host, content_facet: nil)
|
74
|
+
content_facet ||= host.content_facet
|
75
|
+
content_view = content_facet.try(:content_view) || host.try(:content_view)
|
76
|
+
lifecycle_environment = content_facet.try(:lifecycle_environment) || host.try(:lifecycle_environment)
|
69
77
|
if content_view && lifecycle_environment && host.os && host.architecture
|
70
78
|
Katello::Repository.in_environment(lifecycle_environment).in_content_views([content_view]).
|
71
79
|
where(:distribution_arch => host.architecture.name).
|
@@ -90,6 +90,10 @@ module Katello
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def self.with_environment(environment, include_default = false)
|
93
|
+
(pulp2_proxies_with_environment(environment, include_default) + pulpcore_proxies_with_environment(environment)).try(:uniq)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.pulp2_proxies_with_environment(environment, include_default = false)
|
93
97
|
features = [PULP_NODE_FEATURE]
|
94
98
|
features << PULP_FEATURE if include_default
|
95
99
|
|
@@ -97,6 +101,11 @@ module Katello
|
|
97
101
|
where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id })
|
98
102
|
end
|
99
103
|
|
104
|
+
def self.pulpcore_proxies_with_environment(environment)
|
105
|
+
unscoped.where(id: unscoped.select { |p| p.pulp_mirror? }.pluck(:id)).joins(:capsule_lifecycle_environments).
|
106
|
+
where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id })
|
107
|
+
end
|
108
|
+
|
100
109
|
def self.sync_needed?(environment)
|
101
110
|
Setting[:foreman_proxy_content_auto_sync] && unscoped.with_environment(environment).any?
|
102
111
|
end
|
@@ -74,11 +74,6 @@ module Katello
|
|
74
74
|
pulp_repo_facts['content_unit_counts']['srpm']
|
75
75
|
end
|
76
76
|
|
77
|
-
def uri
|
78
|
-
uri = URI.parse(SETTINGS[:katello][:pulp][:url])
|
79
|
-
"https://#{uri.host}/pulp/content/#{relative_path}"
|
80
|
-
end
|
81
|
-
|
82
77
|
def to_hash
|
83
78
|
pulp_repo_facts.merge(as_json).merge(:sync_state => sync_state)
|
84
79
|
end
|
@@ -364,19 +359,5 @@ module Katello
|
|
364
359
|
end
|
365
360
|
end
|
366
361
|
end
|
367
|
-
|
368
|
-
def full_path(smart_proxy = nil, force_http = false)
|
369
|
-
pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : SETTINGS[:katello][:pulp][:url])
|
370
|
-
scheme = force_http ? 'http' : 'https'
|
371
|
-
if docker?
|
372
|
-
"#{pulp_uri.host.downcase}/#{container_repository_name}"
|
373
|
-
elsif ostree?
|
374
|
-
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/web/#{relative_path}"
|
375
|
-
elsif ansible_collection?
|
376
|
-
"#{scheme}://#{pulp_uri.host.downcase}/pulp_ansible/galaxy/#{relative_path}/api"
|
377
|
-
else
|
378
|
-
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/#{relative_path}/"
|
379
|
-
end
|
380
|
-
end
|
381
362
|
end
|
382
363
|
end
|
data/app/models/katello/ping.rb
CHANGED
@@ -5,17 +5,10 @@ module Katello
|
|
5
5
|
PACKAGES = %w(katello candlepin pulp qpid foreman tfm hammer).freeze
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def pulpcore_enabled # for downstream 6.9, remove in 6.10
|
9
|
-
SETTINGS[:katello][:use_pulp_2_for_content_type].nil? || (!SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
|
10
|
-
!SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
|
11
|
-
!SETTINGS[:katello][:use_pulp_2_for_content_type][:file]) ||
|
12
|
-
system('systemctl is-enabled pulpcore-api.service &>/dev/null')
|
13
|
-
end
|
14
|
-
|
15
8
|
def services(capsule_id = nil)
|
16
9
|
proxy = fetch_proxy(capsule_id)
|
17
|
-
services = [:candlepin, :candlepin_auth, :foreman_tasks, :katello_events, :candlepin_events
|
18
|
-
services += [:pulp3] if proxy&.pulp3_enabled?
|
10
|
+
services = [:candlepin, :candlepin_auth, :foreman_tasks, :katello_events, :candlepin_events]
|
11
|
+
services += [:pulp3] if proxy&.pulp3_enabled?
|
19
12
|
if proxy.nil? || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE) || proxy.has_feature?(SmartProxy::PULP_FEATURE)
|
20
13
|
services += [:pulp, :pulp_auth]
|
21
14
|
end
|
@@ -395,6 +395,20 @@ module Katello
|
|
395
395
|
all_instances
|
396
396
|
end
|
397
397
|
|
398
|
+
def full_path(smart_proxy = nil, force_http = false)
|
399
|
+
pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : ::SmartProxy.pulp_primary.url)
|
400
|
+
scheme = force_http ? 'http' : 'https'
|
401
|
+
if docker?
|
402
|
+
"#{pulp_uri.host.downcase}/#{container_repository_name}"
|
403
|
+
elsif ostree?
|
404
|
+
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/web/#{relative_path}"
|
405
|
+
elsif ansible_collection?
|
406
|
+
"#{scheme}://#{pulp_uri.host.downcase}/pulp_ansible/galaxy/#{relative_path}/api"
|
407
|
+
else
|
408
|
+
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/#{relative_path}/"
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
398
412
|
def to_hash(content_source = nil, force_http = false)
|
399
413
|
{id: id, name: label, url: full_path(content_source, force_http)}
|
400
414
|
end
|
data/app/services/cert/certs.rb
CHANGED
@@ -8,6 +8,10 @@ module Cert
|
|
8
8
|
File.open(Setting[:ssl_ca_file], 'r').read
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.candlepin_client_ca_cert
|
12
|
+
File.read(SETTINGS[:katello][:candlepin][:ca_cert_file])
|
13
|
+
end
|
14
|
+
|
11
15
|
def self.ssl_client_cert
|
12
16
|
@ssl_client_cert ||= OpenSSL::X509::Certificate.new(File.open(ssl_client_cert_filename, 'r').read)
|
13
17
|
end
|
@@ -4,6 +4,10 @@ module Katello
|
|
4
4
|
module Pulp3
|
5
5
|
module Api
|
6
6
|
class ContentGuard < Core
|
7
|
+
def default_name
|
8
|
+
'RHSMCertGuard'
|
9
|
+
end
|
10
|
+
|
7
11
|
def self.client_module
|
8
12
|
PulpCertguardClient
|
9
13
|
end
|
@@ -20,19 +24,49 @@ module Katello
|
|
20
24
|
PulpCertguardClient::ContentguardsRhsmApi.new(api_client)
|
21
25
|
end
|
22
26
|
|
23
|
-
def
|
24
|
-
|
27
|
+
def ca_cert
|
28
|
+
Cert::Certs.candlepin_client_ca_cert
|
29
|
+
end
|
30
|
+
|
31
|
+
def refresh
|
32
|
+
found = list(name: default_name).results.first
|
33
|
+
if found && found.ca_certificate != ca_cert
|
34
|
+
partial_update(found.pulp_href)
|
35
|
+
else
|
36
|
+
found = create
|
37
|
+
end
|
38
|
+
persist_if_needed(found.pulp_href)
|
39
|
+
end
|
40
|
+
|
41
|
+
def persist_if_needed(href)
|
42
|
+
return if self.smart_proxy.pulp_mirror?
|
43
|
+
Katello::Util::Support.active_record_retry do
|
44
|
+
found = Katello::Pulp3::ContentGuard.find_by(:name => default_name)
|
45
|
+
if found
|
46
|
+
found.update(pulp_href: href)
|
47
|
+
else
|
48
|
+
Katello::Pulp3::ContentGuard.create(name: default_name, pulp_href: href)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def create(name = default_name)
|
54
|
+
data = PulpCertguardClient::CertguardRHSMCertGuard.new(name: name, ca_certificate: ca_cert)
|
25
55
|
rhsm_api_client.create(data)
|
26
56
|
rescue self.class.api_exception_class => e
|
27
|
-
|
57
|
+
if (found = list&.results&.first) #check for possible race condition
|
58
|
+
found
|
59
|
+
else
|
60
|
+
raise e
|
61
|
+
end
|
28
62
|
end
|
29
63
|
|
30
64
|
def list(options = {})
|
31
65
|
rhsm_api_client.list options
|
32
66
|
end
|
33
67
|
|
34
|
-
def partial_update(href
|
35
|
-
data = PulpCertguardClient::CertguardRHSMCertGuard.new(ca_certificate:
|
68
|
+
def partial_update(href)
|
69
|
+
data = PulpCertguardClient::CertguardRHSMCertGuard.new(ca_certificate: ca_cert)
|
36
70
|
rhsm_api_client.partial_update(href, data)
|
37
71
|
end
|
38
72
|
|