katello 4.0.0.rc3 → 4.0.0.rc3.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/katello/agent/connection.rb +20 -6
- data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +5 -4
- data/app/lib/katello/qpid/connection.rb +31 -14
- data/db/seeds.d/111-upgrade_tasks.rb +0 -12
- data/lib/katello/engine.rb +5 -2
- data/lib/katello/version.rb +1 -1
- metadata +2 -12
- data/lib/katello/tasks/upgrades/3.10/clear_invalid_repo_credentials.rake +0 -27
- data/lib/katello/tasks/upgrades/3.11/import_yum_metadata_file.rake +0 -12
- data/lib/katello/tasks/upgrades/3.11/update_puppet_repos.rake +0 -29
- data/lib/katello/tasks/upgrades/3.12/remove_pulp2_notifier.rake +0 -13
- data/lib/katello/tasks/upgrades/3.13/republish_deb_metadata.rake +0 -22
- data/lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake +0 -23
- data/lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake +0 -16
- data/lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake +0 -29
- data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +0 -18
- data/lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b1f2f557b3626c3063d82e67d89ad487eb532ceae69ebd8b3d17a5e6c1d1f58
|
4
|
+
data.tar.gz: 4740bb46003409a84d0e3ff4d83d265e872c59744afd996c7d930e41978c8ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b588283c5bfc2f7ffe233be131fc45579531bee31b5202216e20be8f7fd4178a9080b34262dbfe46c25d463f9638c10f1c9820f5c6ecdb6fdcd1b73e1ad64a
|
7
|
+
data.tar.gz: 63fe08f466e464a3e628ca3e44dec60a46f2480bb88598798511175e05afdf43becbdfb8586edf5ca3ec13e37c67c3bf5b3ddb0315cd604ed5d82b315d3b6632
|
@@ -1,24 +1,38 @@
|
|
1
1
|
module Katello
|
2
2
|
module Agent
|
3
3
|
class Connection
|
4
|
+
def initialize
|
5
|
+
@connection = ::Katello::Qpid::Connection.new(
|
6
|
+
url: settings[:broker_url],
|
7
|
+
ssl_cert_file: settings[:broker_ssl_cert_file],
|
8
|
+
ssl_key_file: settings[:broker_ssl_key_file],
|
9
|
+
ssl_ca_file: settings[:broker_ssl_ca_file]
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
4
13
|
def send_messages(messages)
|
5
|
-
connection
|
6
|
-
connection.send_messages(messages)
|
14
|
+
@connection.send_messages(messages)
|
7
15
|
end
|
8
16
|
|
9
17
|
def fetch_agent_messages(handler = ClientMessageHandler)
|
10
|
-
connection
|
11
|
-
connection.receive_messages(address: settings[:event_queue_name], handler: handler)
|
18
|
+
@connection.receive_messages(address: settings[:event_queue_name], handler: handler)
|
12
19
|
end
|
13
20
|
|
14
21
|
def delete_client_queue(queue_name)
|
15
|
-
connection
|
16
|
-
connection.delete_queue(queue_name)
|
22
|
+
@connection.delete_queue(queue_name)
|
17
23
|
end
|
18
24
|
|
19
25
|
def settings
|
20
26
|
SETTINGS[:katello][:agent]
|
21
27
|
end
|
28
|
+
|
29
|
+
def open?
|
30
|
+
@connection.open?
|
31
|
+
end
|
32
|
+
|
33
|
+
def close
|
34
|
+
@connection.close
|
35
|
+
end
|
22
36
|
end
|
23
37
|
end
|
24
38
|
end
|
@@ -34,17 +34,18 @@ module Katello
|
|
34
34
|
|
35
35
|
@thread = Thread.new do
|
36
36
|
@handler = Handler.new
|
37
|
-
agent_connection = ::Katello::Agent::Connection.new
|
38
|
-
agent_connection.fetch_agent_messages(@handler)
|
37
|
+
@agent_connection = ::Katello::Agent::Connection.new
|
38
|
+
@agent_connection.fetch_agent_messages(@handler)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.close
|
43
|
-
@
|
43
|
+
@agent_connection&.close
|
44
|
+
@thread&.join
|
44
45
|
end
|
45
46
|
|
46
47
|
def self.running?
|
47
|
-
@thread&.status.present?
|
48
|
+
@agent_connection&.open? && @thread&.status.present?
|
48
49
|
end
|
49
50
|
|
50
51
|
def self.status(refresh: true)
|
@@ -4,9 +4,10 @@ module Katello
|
|
4
4
|
module Qpid
|
5
5
|
class Connection
|
6
6
|
class Sender < ::Qpid::Proton::MessagingHandler
|
7
|
-
def initialize(url, address, messages)
|
7
|
+
def initialize(url, connection_options, address, messages)
|
8
8
|
super()
|
9
9
|
@url = url
|
10
|
+
@connection_options = connection_options
|
10
11
|
@address = address
|
11
12
|
@messages = messages
|
12
13
|
@sent = 0
|
@@ -14,7 +15,7 @@ module Katello
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def on_container_start(container)
|
17
|
-
c = container.connect(@url)
|
18
|
+
c = container.connect(@url, @connection_options)
|
18
19
|
c.open_sender
|
19
20
|
@receiver = c.open_receiver(@address) if @address
|
20
21
|
end
|
@@ -40,7 +41,7 @@ module Katello
|
|
40
41
|
opcode = message.properties['qmf.opcode']
|
41
42
|
if opcode == '_exception'
|
42
43
|
error_code = message.body.dig('_values', 'error_code')
|
43
|
-
if error_code !=
|
44
|
+
if error_code != 7 # not found
|
44
45
|
error_message = message.body.dig('_values', 'error_text')
|
45
46
|
fail(error_message)
|
46
47
|
end
|
@@ -49,17 +50,18 @@ module Katello
|
|
49
50
|
end
|
50
51
|
|
51
52
|
class Receiver < ::Qpid::Proton::MessagingHandler
|
52
|
-
def initialize(url, address, handler)
|
53
|
+
def initialize(url, connection_options, address, handler)
|
53
54
|
super()
|
54
55
|
@url = url
|
56
|
+
@connection_options = connection_options.merge(
|
57
|
+
idle_timeout: 30
|
58
|
+
)
|
55
59
|
@address = address
|
56
60
|
@handler = handler
|
57
61
|
end
|
58
62
|
|
59
63
|
def on_container_start(container)
|
60
|
-
c = container.connect(@url,
|
61
|
-
idle_timeout: 4
|
62
|
-
)
|
64
|
+
c = container.connect(@url, @connection_options)
|
63
65
|
c.open_receiver(@address)
|
64
66
|
end
|
65
67
|
|
@@ -69,8 +71,15 @@ module Katello
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
|
-
def initialize(url)
|
74
|
+
def initialize(url:, ssl_cert_file:, ssl_key_file:, ssl_ca_file:)
|
73
75
|
@url = url
|
76
|
+
ssl_domain = ::Qpid::Proton::SSLDomain.new(::Qpid::Proton::SSLDomain::MODE_CLIENT)
|
77
|
+
ssl_domain.credentials(ssl_cert_file, ssl_key_file, nil) if ssl_cert_file && ssl_key_file
|
78
|
+
ssl_domain.trusted_ca_db(ssl_ca_file) if ssl_ca_file
|
79
|
+
@connection_options = {
|
80
|
+
ssl_domain: ssl_domain,
|
81
|
+
sasl_allowed_mechs: 'external'
|
82
|
+
}
|
74
83
|
end
|
75
84
|
|
76
85
|
def delete_queue(queue_name)
|
@@ -97,7 +106,7 @@ module Katello
|
|
97
106
|
'method' => 'request'
|
98
107
|
}
|
99
108
|
|
100
|
-
sender = Sender.new(@url, address, [message])
|
109
|
+
sender = Sender.new(@url, @connection_options, address, [message])
|
101
110
|
with_connection(sender)
|
102
111
|
end
|
103
112
|
|
@@ -108,22 +117,30 @@ module Katello
|
|
108
117
|
msg.address = message.recipient_address
|
109
118
|
msg
|
110
119
|
end
|
111
|
-
sender = Sender.new(@url, nil, qpid_messages)
|
120
|
+
sender = Sender.new(@url, @connection_options, nil, qpid_messages)
|
112
121
|
with_connection(sender)
|
113
122
|
end
|
114
123
|
|
115
124
|
def receive_messages(address:, handler:)
|
116
|
-
receiver = Receiver.new(@url, address, handler)
|
125
|
+
receiver = Receiver.new(@url, @connection_options, address, handler)
|
117
126
|
with_connection(receiver)
|
118
127
|
end
|
119
128
|
|
129
|
+
def close
|
130
|
+
@container&.stop
|
131
|
+
end
|
132
|
+
|
133
|
+
def open?
|
134
|
+
(@container&.running || 0) > 0
|
135
|
+
end
|
136
|
+
|
120
137
|
private
|
121
138
|
|
122
139
|
def with_connection(handler)
|
123
|
-
container = ::Qpid::Proton::Container.new(handler)
|
124
|
-
container.run
|
140
|
+
@container = ::Qpid::Proton::Container.new(handler)
|
141
|
+
@container.run
|
125
142
|
ensure
|
126
|
-
|
143
|
+
close
|
127
144
|
end
|
128
145
|
end
|
129
146
|
end
|
@@ -3,18 +3,6 @@ UpgradeTask.define_tasks(:katello) do
|
|
3
3
|
{:name => 'katello:correct_repositories', :long_running => true, :skip_failure => true, :always_run => true},
|
4
4
|
{:name => 'katello:correct_puppet_environments', :long_running => true, :skip_failure => true, :always_run => true},
|
5
5
|
{:name => 'katello:clean_backend_objects', :long_running => true, :skip_failure => true, :always_run => true},
|
6
|
-
{:name => 'katello:upgrades:3.8:clear_checksum_type'},
|
7
|
-
{:name => 'katello:upgrades:3.10:clear_invalid_repo_credentials'},
|
8
|
-
{:name => 'katello:upgrades:3.10:update_gpg_key_urls'},
|
9
|
-
{:name => 'katello:upgrades:3.11:import_yum_metadata'},
|
10
|
-
{:name => 'katello:upgrades:3.11:update_puppet_repos'},
|
11
|
-
{:name => 'katello:upgrades:3.11:clear_checksum_type', :task_name => 'katello:upgrades:3.8:clear_checksum_type'},
|
12
|
-
{:name => 'katello:upgrades:3.12:remove_pulp2_notifier'},
|
13
|
-
{:name => 'katello:upgrades:3.13:republish_deb_metadata'},
|
14
|
-
{:name => 'katello:upgrades:3.15:set_sub_facet_dmi_uuid'},
|
15
|
-
{:name => 'katello:upgrades:3.15:reindex_rpm_modular'},
|
16
|
-
{:name => 'katello:upgrades:3.16:update_applicable_el8_hosts'},
|
17
|
-
{:name => 'katello:upgrades:3.18:add_cvv_export_history_metadata'},
|
18
6
|
{:name => 'katello:upgrades:4.0:remove_ostree_puppet_content'}
|
19
7
|
]
|
20
8
|
end
|
data/lib/katello/engine.rb
CHANGED
@@ -58,8 +58,11 @@ module Katello
|
|
58
58
|
},
|
59
59
|
:agent => {
|
60
60
|
:client_queue_format => 'pulp.agent.%s',
|
61
|
-
:
|
62
|
-
:
|
61
|
+
:event_queue_name => 'katello.agent',
|
62
|
+
:broker_url => 'amqps://localhost:5671',
|
63
|
+
:broker_ssl_cert_file => SETTINGS[:ssl_certificate],
|
64
|
+
:broker_ssl_key_file => SETTINGS[:ssl_priv_key],
|
65
|
+
:broker_ssl_ca_file => SETTINGS[:ssl_ca_file]
|
63
66
|
}
|
64
67
|
}
|
65
68
|
|
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: 4.0.0.rc3
|
4
|
+
version: 4.0.0.rc3.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-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -4539,16 +4539,6 @@ files:
|
|
4539
4539
|
- lib/katello/tasks/update_content_default_http_proxy.rake
|
4540
4540
|
- lib/katello/tasks/update_subscription_facet_backend_data.rake
|
4541
4541
|
- lib/katello/tasks/upgrade_check.rake
|
4542
|
-
- lib/katello/tasks/upgrades/3.10/clear_invalid_repo_credentials.rake
|
4543
|
-
- lib/katello/tasks/upgrades/3.11/import_yum_metadata_file.rake
|
4544
|
-
- lib/katello/tasks/upgrades/3.11/update_puppet_repos.rake
|
4545
|
-
- lib/katello/tasks/upgrades/3.12/remove_pulp2_notifier.rake
|
4546
|
-
- lib/katello/tasks/upgrades/3.13/republish_deb_metadata.rake
|
4547
|
-
- lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake
|
4548
|
-
- lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake
|
4549
|
-
- lib/katello/tasks/upgrades/3.16/update_applicable_el8_hosts.rake
|
4550
|
-
- lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb
|
4551
|
-
- lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
|
4552
4542
|
- lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake
|
4553
4543
|
- lib/katello/tasks/virt_who_report.rake
|
4554
4544
|
- lib/katello/url_constrained_cookie_store.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Before 3.8, you could successfully edit only the username, or only the
|
2
|
-
# password, but since we added a validation now those old repos are now
|
3
|
-
# invalid. This finds those repos and clears their credentials.
|
4
|
-
|
5
|
-
namespace :katello do
|
6
|
-
namespace :upgrades do
|
7
|
-
namespace '3.10' do
|
8
|
-
desc "Clear invalid credentials for repositories"
|
9
|
-
task :clear_invalid_repo_credentials => %w(environment) do
|
10
|
-
User.current = User.anonymous_admin
|
11
|
-
|
12
|
-
# Where one, but not both, is set
|
13
|
-
root_repos = Katello::RootRepository.where('(upstream_username IS NULL AND upstream_password is NOT NULL) OR (upstream_username IS NOT NULL AND upstream_password is NULL)')
|
14
|
-
|
15
|
-
root_repos.each do |root_repo|
|
16
|
-
puts "Clearing invalid credentials for #{root_repo.label} (#{root_repo.id})"
|
17
|
-
root_repo.update(upstream_username: nil, upstream_password: nil)
|
18
|
-
|
19
|
-
root_repo.repositories.each do |repo|
|
20
|
-
puts "Refreshing repository #{repo.label} (#{repo.id})"
|
21
|
-
ForemanTasks.sync_task(::Actions::Pulp::Repository::Refresh, repo)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.11' do
|
4
|
-
desc "Import yum metadata file units from pulp"
|
5
|
-
task :import_yum_metadata => ["environment"] do
|
6
|
-
User.current = User.anonymous_api_admin
|
7
|
-
puts _("Importing Yum Metadata Files")
|
8
|
-
Katello::YumMetadataFile.import_all
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.11' do
|
4
|
-
def wait_on_task(task, time = 0.1)
|
5
|
-
task = SmartProxy.pulp_primary.pulp_api.resources.task.poll(task['task_id'])
|
6
|
-
return if Actions::Pulp::AbstractAsyncTask::FINISHED_STATES.include?(task['state'])
|
7
|
-
sleep time
|
8
|
-
wait_on_task(task, time + 0.2)
|
9
|
-
end
|
10
|
-
|
11
|
-
desc "update puppet repos to regenerate pulp configuration"
|
12
|
-
task :update_puppet_repos => %w(environment) do
|
13
|
-
User.current = User.anonymous_admin
|
14
|
-
Katello::Repository.puppet_type.each do |repo|
|
15
|
-
puts "Refreshing repository #{repo.label} (#{repo.id})"
|
16
|
-
install_dist = repo.backend_service(SmartProxy.pulp_primary).backend_data['distributors'].find { |dist| dist['distributor_type_id'] == 'puppet_install_distributor' }
|
17
|
-
if install_dist
|
18
|
-
response = SmartProxy.pulp_primary.pulp_api.resources.repository.delete_distributor(repo.pulp_id, install_dist['id'])
|
19
|
-
wait_on_task('task_id' => response['spawned_tasks'][0]['task_id'])
|
20
|
-
end
|
21
|
-
ForemanTasks.sync_task(::Actions::Pulp::Repository::Refresh, repo)
|
22
|
-
rescue RestClient::ResourceNotFound
|
23
|
-
Rails.logger.warn("Recieved 404 on repository: #{repo.id} - #{repo.name}")
|
24
|
-
next
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.12' do
|
4
|
-
desc "removes the unused pulp2 notifier"
|
5
|
-
task :remove_pulp2_notifier => %w(environment) do
|
6
|
-
SmartProxy.pulp_primary!.pulp_api.resources.event_notifier.list.each do |notifier|
|
7
|
-
Rails.logger.info("Deleting notifier #{notifier['id']}")
|
8
|
-
SmartProxy.pulp_primary!.pulp_api.resources.event_notifier.delete(notifier['id'])
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.13' do
|
4
|
-
desc "Regenerate the metadata for repositories affected by pulp_deb migration 0004"
|
5
|
-
task :republish_deb_metadata, [:input_file] => ["environment"] do |task, args|
|
6
|
-
User.current = User.anonymous_api_admin
|
7
|
-
input_file = args[:input_file] || "/var/lib/pulp/0004_deb_repo_republish_candidates.txt"
|
8
|
-
if File.readable?(input_file)
|
9
|
-
pulp_ids = File.read(input_file).each_line.map(&:strip) || []
|
10
|
-
repos = Katello::Repository.where(:pulp_id => pulp_ids)
|
11
|
-
puts _("Starting BulkMetadataGenerate task.")
|
12
|
-
task = ForemanTasks.async_task(Actions::Katello::Repository::BulkMetadataGenerate, repos, :force => true)
|
13
|
-
puts _("Please check that the task #{task.id} completes successfully.")
|
14
|
-
puts _('You can manually re-trigger this task by running "foreman-rake katello:upgrades:3.13:republish_deb_metadata"')
|
15
|
-
else
|
16
|
-
puts _("Input file #{input_file} was not readable.")
|
17
|
-
puts _('You can manually use an alternate input file by running "foreman-rake katello:upgrades:3.13:republish_deb_metadata[<path>]"')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.15' do
|
4
|
-
desc "Reindex the is_modular attribute of an rpm"
|
5
|
-
task :reindex_rpm_modular, [:input_file] => ["environment"] do
|
6
|
-
User.current = User.anonymous_api_admin
|
7
|
-
criteria = { :fields => [],
|
8
|
-
:limit => SETTINGS[:katello][:pulp][:bulk_load_size],
|
9
|
-
:skip => 0,
|
10
|
-
:filters => {'is_modular' => {'$eq' => true}}
|
11
|
-
}
|
12
|
-
content_type = Katello.pulp_server.extensions.rpm.content_type
|
13
|
-
batch = ::Katello::Pulp::PulpContentUnit.pulp_units_batch(criteria, criteria[:limit]) do
|
14
|
-
Katello.pulp_server.resources.unit.search(content_type, criteria)
|
15
|
-
end
|
16
|
-
pulp_modular_ids = batch.map { |response| response.pluck("_id") }.flatten
|
17
|
-
db_modular_ids = ::Katello::Rpm.modular.pluck(:pulp_id)
|
18
|
-
::Katello::Rpm.where(pulp_id: db_modular_ids - pulp_modular_ids).update_all(modular: false)
|
19
|
-
::Katello::Rpm.where(pulp_id: pulp_modular_ids - db_modular_ids).update_all(modular: true)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.15' do
|
4
|
-
desc "Set the DMI UUID on Host::SubscriptionFacet from facts"
|
5
|
-
task :set_sub_facet_dmi_uuid, [:input_file] => ["environment"] do
|
6
|
-
User.current = User.anonymous_api_admin
|
7
|
-
dmi_uuid_fact_name = Katello::RhsmFactName.find_by_name('dmi::system::uuid') || -1
|
8
|
-
|
9
|
-
fact_values = ::FactValue.where(fact_name: dmi_uuid_fact_name).where.not(value: nil)
|
10
|
-
fact_values.each do |fv|
|
11
|
-
fv.host.subscription_facet&.update(dmi_uuid: fv.value)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,29 +0,0 @@
|
|
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,18 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.18' do
|
4
|
-
task :add_cvv_export_history_metadata => ['environment', 'check_ping'] do
|
5
|
-
smart_proxy = SmartProxy.pulp_primary!
|
6
|
-
|
7
|
-
Katello::ContentViewVersionExportHistory.includes(:content_view_version).where(metadata: nil).find_each do |export_history|
|
8
|
-
export = ::Katello::Pulp3::ContentViewVersion::Export.new(
|
9
|
-
content_view_version: export_history.content_view_version,
|
10
|
-
smart_proxy: smart_proxy
|
11
|
-
)
|
12
|
-
|
13
|
-
export_history.update(metadata: export.generate_metadata)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.8' do
|
4
|
-
desc "Clear checksum type for on-demand repositories"
|
5
|
-
task :clear_checksum_type => %w(environment) do
|
6
|
-
User.current = User.anonymous_admin
|
7
|
-
|
8
|
-
Katello::RootRepository.yum_type.find_each do |root_repo|
|
9
|
-
root_repo.transaction do
|
10
|
-
if [::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND, ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND].include?(root_repo.download_policy) && root_repo.url.present? && URI(root_repo.url).scheme == 'file'
|
11
|
-
root_repo.update_attribute(:download_policy, ::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE)
|
12
|
-
root_repo.repositories.each do |repo|
|
13
|
-
importer = repo.importers[0]
|
14
|
-
config = {
|
15
|
-
:download_policy => ::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE
|
16
|
-
}
|
17
|
-
|
18
|
-
SmartProxy.pulp_primary.pulp_api.resources.repository.update_importer(repo.pulp_id, importer[:id], config) if (importer && importer[:id])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
if root_repo.on_demand? && root_repo.url.present?
|
23
|
-
root_repo.update_attribute(:checksum_type, nil)
|
24
|
-
|
25
|
-
root_repo.repositories.each do |repo|
|
26
|
-
repo.update_attribute(:saved_checksum_type, nil)
|
27
|
-
|
28
|
-
if repo.find_distributor[:config]&.delete(:checksum_type)
|
29
|
-
SmartProxy.pulp_primary.pulp_api.resources.repository.update_distributor(
|
30
|
-
repo.pulp_id, repo.find_distributor[:id], repo.find_distributor[:config])
|
31
|
-
end
|
32
|
-
# rubocop:disable Lint/SuppressedException
|
33
|
-
rescue RestClient::ResourceNotFound
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|