katello 3.15.1 → 3.15.1.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: d0e59e380081b85056d0babdeff1cc1bf1922da00e775bf2636c8d77217a1056
4
- data.tar.gz: 23b423ff8b50a973affd765cd9f44c5ca2ae9581539dfb5858918f16b8962092
3
+ metadata.gz: 198db45b1663ec5e4dd73cb999c9ef4860660fe9ca3428293d0c82ea45ff78a2
4
+ data.tar.gz: c541eaa6a075bf545ba668d2b80197375428a55047852ca7a4a8fddd2ac7f0cb
5
5
  SHA512:
6
- metadata.gz: 73817fdabb0fdb4d47dd1f295858b38778dad330ad29e1b54a06c0365916217a88f421ed2cf9fa24e4f6d4ea62314a554428029879cb3b3201e38c5d7c2a957e
7
- data.tar.gz: 210ad0aa94dfc1d1528d4430051f7d43642b85882761ebc9016eb24c81ef1b4170934f411635dccfa2f2fd2ee100e1878089267519af013353291406e1397357
6
+ metadata.gz: 54851ee1cbf1de239a68264f377b4b96e58b310e656b67daed646927aa56bfbc6f6bdf307dc6f4a1240982675a98d2a05bf4d2991b9dae8dc5b829f0d897a4c2
7
+ data.tar.gz: e8466a953f3bedaa7f761f353fdddf8c858dbe9b09b72dcd338c5a2a132745f9b923e2ba1afdd6e4c2a4fd71fafc2bcb1bc88332866c0d6b08930b9c37246d69
@@ -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
- ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_module_stream_profile(enabled_payload)
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
- import_module_streams(payload, host)
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
@@ -422,8 +422,12 @@ module Katello
422
422
  path
423
423
  end
424
424
 
425
+ def library_instance_or_self
426
+ self.library_instance || self
427
+ end
428
+
425
429
  def generate_repo_path(content_path = nil)
426
- _org, _content, content_path = (self.library_instance || self).relative_path.split("/", 3) if content_path.blank?
430
+ _org, _content, content_path = library_instance_or_self.relative_path.split("/", 3) if content_path.blank?
427
431
  content_path = content_path.sub(%r|^/|, '')
428
432
  if self.environment
429
433
  cve = ContentViewEnvironment.where(:environment_id => self.environment,
@@ -496,7 +500,7 @@ module Katello
496
500
  end
497
501
  end
498
502
  clone = Repository.new(:environment => to_env,
499
- :library_instance => self.library_instance || self,
503
+ :library_instance => library_instance_or_self,
500
504
  :root => self.root,
501
505
  :content_view_version => to_version,
502
506
  :saved_checksum_type => checksum_type)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.15.1".freeze
2
+ VERSION = "3.15.1.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.15.1
4
+ version: 3.15.1.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-22 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -4151,6 +4151,7 @@ files:
4151
4151
  - lib/katello/tasks/upgrades/3.13/republish_deb_metadata.rake
4152
4152
  - lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
4153
4153
  - lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake
4154
+ - lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake
4154
4155
  - lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
4155
4156
  - lib/katello/tasks/virt_who_report.rake
4156
4157
  - lib/katello/url_constrained_cookie_store.rb