katello 3.16.0.rc1 → 3.16.0.rc1.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/lib/actions/katello/host/upload_profiles.rb +36 -5
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +6 -1
- data/app/models/katello/concerns/host_managed_extensions.rb +3 -1
- data/app/models/katello/host/content_facet.rb +1 -0
- data/app/models/katello/repository.rb +6 -2
- data/app/models/katello/subscription.rb +2 -0
- data/app/services/katello/applicability/applicable_content_helper.rb +27 -13
- data/app/services/katello/pulp3/pulp_content_unit.rb +5 -7
- data/app/services/katello/pulp3/rpm.rb +3 -14
- data/app/services/katello/pulp3/srpm.rb +5 -0
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake +29 -0
- data/lib/katello/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49e88fab5fb43375d053afea798096a12e7141395144dfab26d48323e304fbac
|
4
|
+
data.tar.gz: ee2095edb5cb2ce6f48966c9f7a7f73ee893f2d5c08e31930d080e8b07895321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27d9a1ab44ddd37d5ec67ebdcb918be9a0f86cf179a02c5e93b1188cf461fcd31c3205cd4748c893aa24f940dfd0f599b8649abef5291161b02fbdaf9a99778e
|
7
|
+
data.tar.gz: 9ecb92e8ff4000c0564762fc4eb2355a0c265e34f97e2ebe47c6e6636afc17d320519dfc0d73fe83d7e44ee7dd1d8a23f96e3e5a1fdcab8f0c1a9f62cabc4d83
|
@@ -33,16 +33,42 @@ module Actions
|
|
33
33
|
Dynflow::Action::Rescue::Skip
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.upload_modules_to_pulp(available_streams, host)
|
37
|
+
query_name_streams = available_streams.map do |profile|
|
38
|
+
::Katello::ModuleStream.where(profile.slice(:name, :stream))
|
39
|
+
end
|
40
|
+
|
41
|
+
query_name_streams = query_name_streams.inject(&:or)
|
42
|
+
|
43
|
+
bound_library_instances = host.content_facet.bound_repositories.map(&:library_instance_or_self)
|
44
|
+
query = ::Katello::ModuleStream.in_repositories(bound_library_instances).
|
45
|
+
select(:name, :stream, :version, :context, :arch).
|
46
|
+
merge(query_name_streams)
|
47
|
+
|
48
|
+
updated_profiles = query.map do |module_stream|
|
49
|
+
module_stream.slice(:name, :stream, :version, :context, :arch)
|
50
|
+
end
|
51
|
+
|
52
|
+
# We also need to pass module streams that are not found in the ModuleStream table
|
53
|
+
# but are present on the content host
|
54
|
+
unassociated_profiles = available_streams.select do |profile|
|
55
|
+
updated_profiles.none? { |p| p[:name] == profile[:name] && p[:stream] == profile[:stream] }
|
56
|
+
end
|
57
|
+
|
58
|
+
::Katello::Pulp::Consumer.new(host.content_facet.uuid).
|
59
|
+
upload_module_stream_profile(updated_profiles + unassociated_profiles)
|
60
|
+
rescue RestClient::ResourceNotFound
|
61
|
+
Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
|
62
|
+
end
|
63
|
+
|
36
64
|
def import_module_streams(payload, host)
|
37
65
|
enabled_payload = payload.map do |profile|
|
38
|
-
profile.slice("name", "stream", "version", "context", "arch") if profile["status"] == "enabled"
|
66
|
+
profile.slice("name", "stream", "version", "context", "arch").with_indifferent_access if profile["status"] == "enabled"
|
39
67
|
end
|
40
68
|
enabled_payload.compact!
|
41
69
|
|
42
|
-
|
70
|
+
UploadProfiles.upload_modules_to_pulp(enabled_payload, host)
|
43
71
|
host.import_module_streams(payload)
|
44
|
-
rescue RestClient::ResourceNotFound
|
45
|
-
Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % input[:host_id])
|
46
72
|
end
|
47
73
|
|
48
74
|
def import_deb_package_profile(host, profile)
|
@@ -69,6 +95,7 @@ module Actions
|
|
69
95
|
payload = profiles.dig("deb_package_profile", "deb_packages") || []
|
70
96
|
import_deb_package_profile(host, payload)
|
71
97
|
else
|
98
|
+
module_streams = []
|
72
99
|
profiles.each do |profile|
|
73
100
|
payload = profile["profile"]
|
74
101
|
case profile["content_type"]
|
@@ -79,9 +106,13 @@ module Actions
|
|
79
106
|
when "enabled_repos"
|
80
107
|
host.import_enabled_repositories(payload)
|
81
108
|
else
|
82
|
-
|
109
|
+
module_streams << payload
|
83
110
|
end
|
84
111
|
end
|
112
|
+
|
113
|
+
module_streams.each do |module_stream_payload|
|
114
|
+
import_module_streams(module_stream_payload, host)
|
115
|
+
end
|
85
116
|
end
|
86
117
|
end
|
87
118
|
end
|
@@ -8,7 +8,8 @@ module Katello
|
|
8
8
|
super + [:errata, :host_subscriptions, :host_applicable_errata_ids, :host_applicable_errata_filtered,
|
9
9
|
:host_latest_applicable_rpm_version, :load_pools, :load_errata_applications, :host_content_facet,
|
10
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
|
11
|
+
:host_subscriptions_names, :host_subscriptions, :host_products_names, :host_collections_names,
|
12
|
+
:host_redhat_subscription_names]
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -28,6 +29,10 @@ module Katello
|
|
28
29
|
host.subscriptions.map(&:name)
|
29
30
|
end
|
30
31
|
|
32
|
+
def host_redhat_subscription_names(host)
|
33
|
+
host.subscriptions.redhat.pluck(:name)
|
34
|
+
end
|
35
|
+
|
31
36
|
def host_content_facet(host)
|
32
37
|
host.content_facet
|
33
38
|
end
|
@@ -226,11 +226,13 @@ module Katello
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def import_tracer_profile(tracer_profile)
|
229
|
-
host_traces.delete_all
|
230
229
|
traces = []
|
231
230
|
tracer_profile.each do |trace, attributes|
|
231
|
+
next if attributes[:helper].blank?
|
232
|
+
|
232
233
|
traces << { host_id: self.id, application: trace, helper: attributes[:helper], app_type: attributes[:type] }
|
233
234
|
end
|
235
|
+
host_traces.delete_all
|
234
236
|
Katello::HostTracer.import(traces, validate: false)
|
235
237
|
update_trace_status
|
236
238
|
end
|
@@ -120,6 +120,7 @@ module Katello
|
|
120
120
|
|
121
121
|
::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::Rpm, bound_repos).calculate_and_import
|
122
122
|
::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::Erratum, bound_repos).calculate_and_import
|
123
|
+
::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::ModuleStream, bound_repos).calculate_and_import
|
123
124
|
end
|
124
125
|
|
125
126
|
def import_applicability(partial = false)
|
@@ -431,8 +431,12 @@ module Katello
|
|
431
431
|
path
|
432
432
|
end
|
433
433
|
|
434
|
+
def library_instance_or_self
|
435
|
+
self.library_instance || self
|
436
|
+
end
|
437
|
+
|
434
438
|
def generate_repo_path(content_path = nil)
|
435
|
-
_org, _content, content_path =
|
439
|
+
_org, _content, content_path = library_instance_or_self.relative_path.split("/", 3) if content_path.blank?
|
436
440
|
content_path = content_path.sub(%r|^/|, '')
|
437
441
|
if self.environment
|
438
442
|
cve = ContentViewEnvironment.where(:environment_id => self.environment,
|
@@ -505,7 +509,7 @@ module Katello
|
|
505
509
|
end
|
506
510
|
end
|
507
511
|
clone = Repository.new(:environment => to_env,
|
508
|
-
:library_instance =>
|
512
|
+
:library_instance => library_instance_or_self,
|
509
513
|
:root => self.root,
|
510
514
|
:content_view_version => to_version,
|
511
515
|
:saved_checksum_type => checksum_type)
|
@@ -11,6 +11,8 @@ module Katello
|
|
11
11
|
|
12
12
|
scope :in_organization, ->(org) { where(:organization => org) }
|
13
13
|
|
14
|
+
scope :redhat, -> { joins(:products).merge(Katello::Product.redhat).distinct }
|
15
|
+
|
14
16
|
def self.subscribable
|
15
17
|
product_ids = Product.subscribable.pluck(:id) + [nil]
|
16
18
|
joins(:pools).joins("LEFT OUTER JOIN #{Katello::PoolProduct.table_name} pool_prod ON #{Pool.table_name}.id = pool_prod.pool_id")
|
@@ -23,7 +23,7 @@ module Katello
|
|
23
23
|
if self.content_unit_class == ::Katello::Erratum
|
24
24
|
fetch_errata_content_ids
|
25
25
|
elsif self.content_unit_class == ::Katello::ModuleStream
|
26
|
-
|
26
|
+
fetch_module_stream_content_ids
|
27
27
|
else
|
28
28
|
fetch_rpm_content_ids
|
29
29
|
end
|
@@ -31,18 +31,32 @@ module Katello
|
|
31
31
|
|
32
32
|
def fetch_errata_content_ids
|
33
33
|
# Query for all Errata ids that are attached to the host's applicable packages
|
34
|
-
query = '
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
query = 'SELECT DISTINCT katello_repository_errata.erratum_id AS id FROM katello_repository_errata
|
35
|
+
INNER JOIN katello_erratum_packages
|
36
|
+
ON katello_repository_errata.erratum_id = katello_erratum_packages.erratum_id
|
37
|
+
INNER JOIN katello_rpms
|
38
|
+
ON katello_rpms.nvra = katello_erratum_packages.nvrea
|
39
|
+
INNER JOIN katello_content_facet_applicable_rpms
|
40
|
+
ON katello_content_facet_applicable_rpms.rpm_id = katello_rpms.id
|
41
|
+
WHERE katello_content_facet_applicable_rpms.content_facet_id = :content_facet_id
|
42
|
+
AND katello_repository_errata.repository_id IN (:repo_ids)'
|
43
|
+
|
44
|
+
return Katello::Erratum.find_by_sql([query, { content_facet_id: content_facet.id, repo_ids: self.bound_library_instance_repos }]).map(&:id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def fetch_module_stream_content_ids
|
48
|
+
# Query for all applicable module stream ids
|
49
|
+
query = 'SELECT DISTINCT katello_repository_module_streams.module_stream_id AS id FROM katello_repository_module_streams
|
50
|
+
INNER JOIN katello_module_stream_rpms
|
51
|
+
ON katello_repository_module_streams.module_stream_id = katello_module_stream_rpms.module_stream_id
|
52
|
+
INNER JOIN katello_rpms
|
53
|
+
ON katello_rpms.id = katello_module_stream_rpms.rpm_id
|
54
|
+
INNER JOIN katello_content_facet_applicable_rpms
|
55
|
+
ON katello_content_facet_applicable_rpms.rpm_id = katello_rpms.id
|
56
|
+
WHERE katello_content_facet_applicable_rpms.content_facet_id = :content_facet_id
|
57
|
+
AND katello_repository_module_streams.repository_id IN (:repo_ids)'
|
58
|
+
|
59
|
+
return Katello::ModuleStream.find_by_sql([query, { content_facet_id: content_facet.id, repo_ids: self.bound_library_instance_repos }]).map(&:id)
|
46
60
|
end
|
47
61
|
|
48
62
|
def fetch_rpm_content_ids
|
@@ -62,13 +62,7 @@ module Katello
|
|
62
62
|
break unless (
|
63
63
|
(response["count"] && page_opts["offset"] < response["count"]) ||
|
64
64
|
page_opts["offset"] == 0)
|
65
|
-
|
66
|
-
# Get all packages where arch != "src"
|
67
|
-
# FIXME change once reverse filtering is in Pulp3
|
68
|
-
page_opts["arch__in"] = Katello::Pulp3::Rpm.rpm_architectures.join(",")
|
69
|
-
elsif self == Katello::Pulp3::Srpm
|
70
|
-
page_opts["arch"] = "src"
|
71
|
-
end
|
65
|
+
page_opts = page_options page_opts
|
72
66
|
response = fetch_content_list page_opts
|
73
67
|
response = response.as_json.with_indifferent_access
|
74
68
|
yielder.yield response[:results]
|
@@ -77,6 +71,10 @@ module Katello
|
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
74
|
+
def self.page_options(page_opts = {})
|
75
|
+
page_opts
|
76
|
+
end
|
77
|
+
|
80
78
|
def self.pulp_data(href)
|
81
79
|
content_unit = self.content_api.read(href)
|
82
80
|
content_unit.as_json
|
@@ -20,20 +20,9 @@ module Katello
|
|
20
20
|
repo_content_list.map { |content| content.try(:pulp_href) }
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.
|
24
|
-
[
|
25
|
-
|
26
|
-
'ia64',
|
27
|
-
'alpha', 'alphaev5', 'alphaev56', 'alphapca56', 'alphaev6', 'alphaev67',
|
28
|
-
'sparc', 'sparcv8', 'sparcv9', 'sparc64', 'sparc64v', 'sun4', 'sun4c', 'sun4d', 'sun4m', 'sun4u',
|
29
|
-
'armv3l', 'armv4b', 'armv4l', 'armv5tel', 'armv5tejl', 'armv6l', 'armv7l',
|
30
|
-
'mips', 'mipsel',
|
31
|
-
'ppc', 'ppciseries', 'ppcpseries', 'ppc64', 'ppc8260', 'ppc8560', 'ppc32dy4',
|
32
|
-
'm68k', 'm68kmint', 'atarist', 'atariste', 'ataritt', 'falcon', 'atariclone', 'milan', 'hades',
|
33
|
-
'Sgi',
|
34
|
-
'rs6000',
|
35
|
-
'i370', 's390x', 's390',
|
36
|
-
'noarch']
|
23
|
+
def self.page_options(page_opts = {})
|
24
|
+
page_opts["arch__ne"] = "src"
|
25
|
+
page_opts
|
37
26
|
end
|
38
27
|
|
39
28
|
def requires
|
@@ -17,6 +17,11 @@ module Katello
|
|
17
17
|
PulpRpmClient::ContentPackagesApi.new(Katello::Pulp3::Api::Yum.new(SmartProxy.pulp_master!).api_client)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.page_options(page_opts = {})
|
21
|
+
page_opts["arch"] = "src"
|
22
|
+
page_opts
|
23
|
+
end
|
24
|
+
|
20
25
|
def self.ids_for_repository(repo_id)
|
21
26
|
repo = Katello::Pulp3::Repository::Yum.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
|
22
27
|
repo_content_list = repo.content_list
|
@@ -12,6 +12,7 @@ UpgradeTask.define_tasks(:katello) do
|
|
12
12
|
{:name => 'katello:upgrades:3.12:remove_pulp2_notifier'},
|
13
13
|
{:name => 'katello:upgrades:3.13:republish_deb_metadata'},
|
14
14
|
{:name => 'katello:upgrades:3.15:set_sub_facet_dmi_uuid'},
|
15
|
-
{:name => 'katello:upgrades:3.15:reindex_rpm_modular'}
|
15
|
+
{:name => 'katello:upgrades:3.15:reindex_rpm_modular'},
|
16
|
+
{:name => 'katello:upgrades:3.16:update_applicable_el8_hosts'}
|
16
17
|
]
|
17
18
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :katello do
|
2
|
+
namespace :upgrades do
|
3
|
+
namespace '3.16' do
|
4
|
+
desc <<-DESCRIPTION
|
5
|
+
Update the applicability calculations for Rhel8 hosts.
|
6
|
+
This migration is to be run to address -> https://bugzilla.redhat.com/show_bug.cgi?id=1814095
|
7
|
+
DESCRIPTION
|
8
|
+
task :update_applicable_el8_hosts, [:input_file] => ["environment"] do
|
9
|
+
User.current = User.anonymous_api_admin
|
10
|
+
|
11
|
+
# Find me only those hosts that follow ALL the conditions below
|
12
|
+
# 1) Have a module stream enabled.
|
13
|
+
# 2) Bound to Non Library repositories. (i.e must belong to a CV thats not the default)
|
14
|
+
# 3) Bound repositories must have module streams in them
|
15
|
+
hosts = Host.joins(:content_facet => :content_facet_repositories).
|
16
|
+
where("#{Host.table_name}.id" => ::Katello::HostAvailableModuleStream.enabled.select(:host_id)).
|
17
|
+
where("#{Katello::ContentFacetRepository.table_name}.repository_id" =>
|
18
|
+
::Katello::Repository.joins(:repository_module_streams).
|
19
|
+
in_non_default_view.
|
20
|
+
non_archived)
|
21
|
+
hosts.each do |host|
|
22
|
+
available_streams = ::Katello::HostAvailableModuleStream.joins(:available_module_stream).
|
23
|
+
enabled.where(:host_id => host).select(:name, :stream)
|
24
|
+
::Actions::Katello::Host::UploadProfiles.upload_modules_to_pulp(available_streams, host)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
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: 3.16.0.rc1
|
4
|
+
version: 3.16.0.rc1.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: 2020-05-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -4325,6 +4325,7 @@ files:
|
|
4325
4325
|
- lib/katello/tasks/upgrades/3.13/republish_deb_metadata.rake
|
4326
4326
|
- lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
|
4327
4327
|
- lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake
|
4328
|
+
- lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake
|
4328
4329
|
- lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
|
4329
4330
|
- lib/katello/tasks/virt_who_report.rake
|
4330
4331
|
- lib/katello/url_constrained_cookie_store.rb
|