katello 4.1.1 → 4.1.4
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/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +3 -1
- data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -1
- data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -1
- data/app/lib/actions/katello/repository/create.rb +9 -8
- data/app/lib/actions/katello/repository/create_root.rb +1 -1
- data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
- data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +5 -0
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +3 -2
- data/app/lib/actions/pulp3/capsule_content/sync.rb +2 -1
- data/app/lib/actions/pulp3/orchestration/repository/create.rb +2 -2
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +1 -0
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +1 -1
- data/app/lib/actions/pulp3/repository/create.rb +4 -3
- data/app/lib/actions/pulp3/repository/create_publication.rb +6 -3
- data/app/lib/actions/pulp3/repository/refresh_remote.rb +1 -1
- data/app/lib/actions/pulp3/repository/save_version.rb +9 -2
- data/app/lib/katello/agent/base_message.rb +7 -4
- data/app/lib/katello/agent/update_package_message.rb +8 -0
- data/app/lib/katello/qpid/connection.rb +3 -1
- data/app/models/katello/candlepin/repository_mapper.rb +1 -1
- data/app/models/katello/concerns/host_managed_extensions.rb +14 -1
- data/app/models/katello/concerns/smart_proxy_extensions.rb +9 -0
- data/app/models/katello/glue/pulp/repos.rb +1 -1
- data/app/services/katello/applicability/applicable_content_helper.rb +2 -1
- data/app/services/katello/pulp3/repository.rb +19 -24
- data/app/services/katello/pulp3/repository_mirror.rb +1 -1
- data/app/services/katello/pulp3/task.rb +16 -0
- data/app/services/katello/registration_manager.rb +2 -0
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +14 -4
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +1 -2
- data/lib/katello/tasks/repository.rake +4 -3
- data/lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake +4 -2
- data/lib/katello/version.rb +1 -1
- metadata +13 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c5585f90b341b73cc8ff5d0b5adea7f31e794da93c42e6f755de36b86f0fe12
|
4
|
+
data.tar.gz: fea8f7973ec98df5967310fcd025767d7fe03ee8077a388c64bb8b50101190b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aabf11851850da36e0a135c9a8dc0e0561ab4791c234bdd47e63caef2342cd60bf8428060399161f17eafe22878144dac4b7277250b68ae1a9c15e63c7ed4fac
|
7
|
+
data.tar.gz: 4b72e1f19961cf571056f14291e2bb811c29c353ae7453175a8afd2bf83b29f02709ad540a82230fcbc982923e5025cb19f37730373ea90c16afe7818f745c66
|
@@ -19,7 +19,9 @@ module Katello
|
|
19
19
|
|
20
20
|
def host_setup_extension
|
21
21
|
if params['host']['lifecycle_environment_id']
|
22
|
-
|
22
|
+
new_lce = KTEnvironment.readable.find(params['host']['lifecycle_environment_id'])
|
23
|
+
@host.content_facet.lifecycle_environment = new_lce
|
24
|
+
@host.update_candlepin_associations
|
23
25
|
end
|
24
26
|
|
25
27
|
super
|
@@ -10,7 +10,7 @@ module Actions
|
|
10
10
|
source_repositories.each do |repositories|
|
11
11
|
new_repository = repositories.first.build_clone(content_view: version.content_view,
|
12
12
|
version: version)
|
13
|
-
plan_action(Repository::Create, new_repository, true
|
13
|
+
plan_action(Repository::Create, new_repository, clone: true)
|
14
14
|
repository_mapping[repositories] = new_repository
|
15
15
|
end
|
16
16
|
end
|
@@ -10,7 +10,7 @@ module Actions
|
|
10
10
|
|
11
11
|
sequence do
|
12
12
|
if clone.new_record?
|
13
|
-
plan_action(Repository::Create, clone, true
|
13
|
+
plan_action(Repository::Create, clone, clone: true)
|
14
14
|
else
|
15
15
|
#only clear if it should be empty, but its not
|
16
16
|
plan_optional_pulp_action([Actions::Pulp::Repository::Clear], clone, SmartProxy.pulp_primary)
|
@@ -2,19 +2,18 @@ module Actions
|
|
2
2
|
module Katello
|
3
3
|
module Repository
|
4
4
|
class Create < Actions::EntryAction
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def plan(repository, args = {})
|
6
|
+
clone = args[:clone] || false
|
7
|
+
force_repo_create = args[:force_repo_create] || false
|
8
8
|
repository.save!
|
9
9
|
root = repository.root
|
10
10
|
|
11
11
|
action_subject(repository)
|
12
12
|
|
13
13
|
org = repository.organization
|
14
|
-
pulp2_create_action = plan_create ? Actions::Pulp::Repository::CreateInPlan : Actions::Pulp::Repository::Create
|
15
14
|
sequence do
|
16
|
-
create_action =
|
17
|
-
repository, SmartProxy.pulp_primary)
|
15
|
+
create_action = plan_action(Pulp3::Orchestration::Repository::Create,
|
16
|
+
repository, SmartProxy.pulp_primary, force_repo_create)
|
18
17
|
|
19
18
|
return if create_action.error
|
20
19
|
|
@@ -25,8 +24,10 @@ module Actions
|
|
25
24
|
if repository.product.redhat?
|
26
25
|
plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => repository.content_id)
|
27
26
|
else
|
28
|
-
|
29
|
-
|
27
|
+
unless root.content
|
28
|
+
content_create = plan_action(Katello::Product::ContentCreate, root)
|
29
|
+
plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => content_create.input[:content_id])
|
30
|
+
end
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -10,7 +10,7 @@ module Actions
|
|
10
10
|
repository.relative_path = repository.custom_repo_path
|
11
11
|
repository.save!
|
12
12
|
action_subject(repository)
|
13
|
-
plan_action(::Actions::Katello::Repository::Create, repository
|
13
|
+
plan_action(::Actions::Katello::Repository::Create, repository)
|
14
14
|
end
|
15
15
|
|
16
16
|
def humanized_name
|
@@ -15,7 +15,7 @@ module Actions
|
|
15
15
|
fail ::Katello::Errors::ConflictException, _("The repository is already enabled")
|
16
16
|
end
|
17
17
|
repository = mapper.build_repository
|
18
|
-
plan_action(Repository::Create, repository, false
|
18
|
+
plan_action(Repository::Create, repository, clone: false)
|
19
19
|
action_subject(repository)
|
20
20
|
plan_self
|
21
21
|
end
|
@@ -22,6 +22,11 @@ module Actions
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def invoke_external_task
|
25
|
+
if input[:options][:sync_task_output] &&
|
26
|
+
::Katello::Pulp3::Task.publication_href(input[:options][:sync_task_output]).present?
|
27
|
+
return input[:options][:sync_task_output]
|
28
|
+
end
|
29
|
+
|
25
30
|
repository = ::Katello::Repository.find(input[:repository_id])
|
26
31
|
smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
|
27
32
|
output[:response] = repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
|
@@ -19,9 +19,10 @@ module Actions
|
|
19
19
|
if options[:use_repository_version]
|
20
20
|
repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:use_repository_version => true)
|
21
21
|
elsif tasks && tasks[:pulp_tasks] && tasks[:pulp_tasks].first
|
22
|
-
publication_href = tasks[:pulp_tasks]
|
23
|
-
if publication_href
|
22
|
+
if (publication_href = ::Katello::Pulp3::Task.publication_href(tasks[:pulp_tasks]))
|
24
23
|
repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:publication => publication_href)
|
24
|
+
else
|
25
|
+
fail "Unable to refresh distribution for repo #{repository.id}, could not find a publication_href"
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -5,7 +5,8 @@ module Actions
|
|
5
5
|
include ::Actions::Helpers::SmartProxySyncHistoryHelper
|
6
6
|
def plan(repository, smart_proxy, options = {})
|
7
7
|
sequence do
|
8
|
-
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :options => options)
|
8
|
+
sync_task = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :options => options)
|
9
|
+
options[:sync_task_output] = sync_task.output[:pulp_tasks]
|
9
10
|
plan_action(GenerateMetadata, repository, smart_proxy, options)
|
10
11
|
end
|
11
12
|
end
|
@@ -3,9 +3,9 @@ module Actions
|
|
3
3
|
module Orchestration
|
4
4
|
module Repository
|
5
5
|
class Create < Pulp3::Abstract
|
6
|
-
def plan(repository, smart_proxy)
|
6
|
+
def plan(repository, smart_proxy, force = false)
|
7
7
|
sequence do
|
8
|
-
create_action = plan_action(Actions::Pulp3::Repository::Create, repository, smart_proxy)
|
8
|
+
create_action = plan_action(Actions::Pulp3::Repository::Create, repository, smart_proxy, force)
|
9
9
|
plan_action(Actions::Pulp3::Repository::SaveVersion, repository, repository_details: create_action.output[:response])
|
10
10
|
|
11
11
|
if repository.content_view.default? || !smart_proxy.pulp_primary?
|
@@ -6,6 +6,7 @@ module Actions
|
|
6
6
|
def plan(repository, smart_proxy, options = {})
|
7
7
|
options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
|
8
8
|
publication_content_type = !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication
|
9
|
+
|
9
10
|
sequence do
|
10
11
|
if options[:source_repository] && publication_content_type
|
11
12
|
plan_self(source_repository_id: options[:source_repository].id, target_repository_id: repository.id, smart_proxy_id: smart_proxy.id)
|
@@ -11,7 +11,7 @@ module Actions
|
|
11
11
|
|
12
12
|
force_fetch_version = true if options[:optimize] == false
|
13
13
|
version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks], :force_fetch_version => force_fetch_version).output
|
14
|
-
plan_action(Pulp3::Orchestration::Repository::GenerateMetadata, repository, smart_proxy, :contents_changed => version_output[:contents_changed])
|
14
|
+
plan_action(Pulp3::Orchestration::Repository::GenerateMetadata, repository, smart_proxy, :contents_changed => version_output[:contents_changed], :skip_publication_creation => version_output[:publication_provided])
|
15
15
|
plan_self(:subaction_output => version_output)
|
16
16
|
end
|
17
17
|
end
|
@@ -2,13 +2,14 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
4
|
class Create < Pulp3::Abstract
|
5
|
-
def plan(repository, smart_proxy)
|
6
|
-
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id)
|
5
|
+
def plan(repository, smart_proxy, force = false)
|
6
|
+
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :force => force)
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
10
|
repo = ::Katello::Repository.find(input[:repository_id])
|
11
|
-
|
11
|
+
force = input[:force] || false
|
12
|
+
output[:response] = repo.backend_service(smart_proxy).with_mirror_adapter.create(force)
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -5,14 +5,17 @@ module Actions
|
|
5
5
|
middleware.use Actions::Middleware::ExecuteIfContentsChanged
|
6
6
|
def plan(repository, smart_proxy, options)
|
7
7
|
sequence do
|
8
|
-
action = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :contents_changed => options[:contents_changed],
|
8
|
+
action = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :contents_changed => options[:contents_changed],
|
9
|
+
:skip_publication_creation => options[:skip_publication_creation])
|
9
10
|
plan_action(SavePublication, repository, action.output, :contents_changed => options[:contents_changed])
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
def invoke_external_task
|
14
|
-
|
15
|
-
|
15
|
+
unless input[:skip_publication_creation]
|
16
|
+
repository = ::Katello::Repository.find(input[:repository_id])
|
17
|
+
output[:response] = repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
|
18
|
+
end
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
@@ -9,17 +9,24 @@ module Actions
|
|
9
9
|
|
10
10
|
def run
|
11
11
|
repo = ::Katello::Repository.find(input[:repository_id])
|
12
|
-
|
13
12
|
if input[:force_fetch_version]
|
14
13
|
version_href = fetch_version_href(repo)
|
15
14
|
elsif input[:repository_details].present?
|
16
15
|
version_href = input[:repository_details][:latest_version_href]
|
17
16
|
elsif input[:tasks].present?
|
18
|
-
version_href = input[:tasks]
|
17
|
+
version_href = ::Katello::Pulp3::Task.version_href(input[:tasks])
|
19
18
|
else
|
20
19
|
version_href = fetch_version_href(repo)
|
21
20
|
end
|
22
21
|
|
22
|
+
output[:publication_provided] = false
|
23
|
+
if input[:tasks].present?
|
24
|
+
if (publication_href = ::Katello::Pulp3::Task.publication_href(input[:tasks]))
|
25
|
+
repo.update(:publication_href => publication_href)
|
26
|
+
output[:publication_provided] = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
23
30
|
if version_href
|
24
31
|
if repo.version_href != version_href || input[:force_fetch_version]
|
25
32
|
output[:contents_changed] = true
|
@@ -12,10 +12,7 @@ module Katello
|
|
12
12
|
replyto: reply_to,
|
13
13
|
request: {
|
14
14
|
args: [
|
15
|
-
units,
|
16
|
-
{
|
17
|
-
importkeys: true
|
18
|
-
}
|
15
|
+
units, options
|
19
16
|
],
|
20
17
|
classname: "Content",
|
21
18
|
cntr: [[], {}],
|
@@ -30,6 +27,12 @@ module Katello
|
|
30
27
|
}
|
31
28
|
end
|
32
29
|
|
30
|
+
def options # may be overridden by children
|
31
|
+
{
|
32
|
+
importkeys: true
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
33
36
|
def to_s
|
34
37
|
json.to_json
|
35
38
|
end
|
@@ -10,7 +10,15 @@ module Katello
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
+
def options
|
14
|
+
ops = super
|
15
|
+
ops[:all] = true if @packages.blank?
|
16
|
+
ops
|
17
|
+
end
|
18
|
+
|
13
19
|
def units
|
20
|
+
return [{ type_id: @content_type, unit_key: {}}] if @packages.blank?
|
21
|
+
|
14
22
|
@packages.map do |package|
|
15
23
|
{
|
16
24
|
type_id: @content_type,
|
@@ -74,11 +74,13 @@ module Katello
|
|
74
74
|
def initialize(url:, ssl_cert_file:, ssl_key_file:, ssl_ca_file:)
|
75
75
|
@url = url
|
76
76
|
ssl_domain = ::Qpid::Proton::SSLDomain.new(::Qpid::Proton::SSLDomain::MODE_CLIENT)
|
77
|
+
ssl_domain.peer_authentication(::Qpid::Proton::SSLDomain::VERIFY_PEER_NAME)
|
77
78
|
ssl_domain.credentials(ssl_cert_file, ssl_key_file, nil) if ssl_cert_file && ssl_key_file
|
78
79
|
ssl_domain.trusted_ca_db(ssl_ca_file) if ssl_ca_file
|
79
80
|
@connection_options = {
|
80
81
|
ssl_domain: ssl_domain,
|
81
|
-
sasl_allowed_mechs: 'external'
|
82
|
+
sasl_allowed_mechs: 'external',
|
83
|
+
virtual_host: URI.parse(url).host
|
82
84
|
}
|
83
85
|
end
|
84
86
|
|
@@ -44,7 +44,7 @@ module Katello
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def validate!
|
47
|
-
return if katello_content_type == Repository::OSTREE_TYPE
|
47
|
+
return if katello_content_type == Repository::OSTREE_TYPE || Setting[:content_disconnected]
|
48
48
|
substitutor.validate_substitutions(content, substitutions)
|
49
49
|
end
|
50
50
|
|
@@ -215,10 +215,15 @@ module Katello
|
|
215
215
|
new_ids = new_available_module_streams.keys - old_associated_ids
|
216
216
|
new_ids.each do |new_id|
|
217
217
|
module_stream = new_available_module_streams[new_id]
|
218
|
+
status = module_stream["status"]
|
219
|
+
# Set status to "unknown" only if the active field is in use and set to false and the module is enabled
|
220
|
+
if enabled_module_stream_inactive?(module_stream)
|
221
|
+
status = "unknown"
|
222
|
+
end
|
218
223
|
self.host_available_module_streams.create!(host_id: self.id,
|
219
224
|
available_module_stream_id: new_id,
|
220
225
|
installed_profiles: module_stream["installed_profiles"],
|
221
|
-
status:
|
226
|
+
status: status)
|
222
227
|
end
|
223
228
|
|
224
229
|
upgradable_streams.each do |hams|
|
@@ -228,6 +233,10 @@ module Katello
|
|
228
233
|
if hams.attributes.slice(*shared_keys) != module_stream_data
|
229
234
|
hams.update!(module_stream_data)
|
230
235
|
end
|
236
|
+
# Set status to "unknown" only if the active field is in use and set to false and the module is enabled
|
237
|
+
if enabled_module_stream_inactive?(module_stream)
|
238
|
+
hams.update!(status: "unknown")
|
239
|
+
end
|
231
240
|
end
|
232
241
|
end
|
233
242
|
|
@@ -347,6 +356,10 @@ module Katello
|
|
347
356
|
self.get_status(::Katello::TraceStatus).refresh!
|
348
357
|
self.refresh_global_status!
|
349
358
|
end
|
359
|
+
|
360
|
+
def enabled_module_stream_inactive?(module_stream)
|
361
|
+
!module_stream["active"].nil? && module_stream["active"] == false && module_stream["status"] == "enabled"
|
362
|
+
end
|
350
363
|
end
|
351
364
|
end
|
352
365
|
end
|
@@ -89,6 +89,10 @@ module Katello
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def self.with_environment(environment, include_default = false)
|
92
|
+
(pulp2_proxies_with_environment(environment, include_default) + pulpcore_proxies_with_environment(environment)).try(:uniq)
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.pulp2_proxies_with_environment(environment, include_default = false)
|
92
96
|
features = [PULP_NODE_FEATURE]
|
93
97
|
features << PULP_FEATURE if include_default
|
94
98
|
|
@@ -96,6 +100,11 @@ module Katello
|
|
96
100
|
where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id })
|
97
101
|
end
|
98
102
|
|
103
|
+
def self.pulpcore_proxies_with_environment(environment)
|
104
|
+
unscoped.where(id: unscoped.select { |p| p.pulp_mirror? }.pluck(:id)).joins(:capsule_lifecycle_environments).
|
105
|
+
where(katello_capsule_lifecycle_environments: { lifecycle_environment_id: environment.id })
|
106
|
+
end
|
107
|
+
|
99
108
|
def self.sync_needed?(environment)
|
100
109
|
Setting[:foreman_proxy_content_auto_sync] && unscoped.with_environment(environment).any?
|
101
110
|
end
|
@@ -42,7 +42,7 @@ module Katello
|
|
42
42
|
def sync_status
|
43
43
|
all_repos = repos(self.library, nil, false)
|
44
44
|
task = last_repo_sync_task
|
45
|
-
last_synced_repo = task ? all_repos.find { |repo| task.
|
45
|
+
last_synced_repo = task ? all_repos.find { |repo| task.links.where(:resource_type => ::Katello::Repository.name).pluck(:resource_id).map(&:to_s).include?(repo.id.to_s) } : nil
|
46
46
|
::Katello::SyncStatusPresenter.new(last_synced_repo, task).sync_progress
|
47
47
|
end
|
48
48
|
|
@@ -92,7 +92,8 @@ module Katello
|
|
92
92
|
::Katello::ModuleStream.
|
93
93
|
joins("inner join katello_available_module_streams on
|
94
94
|
katello_module_streams.name = katello_available_module_streams.name and
|
95
|
-
katello_module_streams.stream = katello_available_module_streams.stream
|
95
|
+
katello_module_streams.stream = katello_available_module_streams.stream and
|
96
|
+
katello_module_streams.context = katello_available_module_streams.context").
|
96
97
|
joins("inner join katello_host_available_module_streams on
|
97
98
|
katello_available_module_streams.id = katello_host_available_module_streams.available_module_stream_id").
|
98
99
|
where("katello_host_available_module_streams.host_id = :content_facet_id and
|
@@ -16,6 +16,14 @@ module Katello
|
|
16
16
|
@smart_proxy = smart_proxy
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.version_href?(href)
|
20
|
+
/.*\/versions\/\d*\//.match(href)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.publication_href?(href)
|
24
|
+
href.include?('/publications/')
|
25
|
+
end
|
26
|
+
|
19
27
|
def partial_repo_path
|
20
28
|
fail NotImplementedError
|
21
29
|
end
|
@@ -124,7 +132,7 @@ module Katello
|
|
124
132
|
|
125
133
|
def refresh_if_needed
|
126
134
|
tasks = []
|
127
|
-
tasks << update_remote
|
135
|
+
tasks << update_remote #always update remote
|
128
136
|
tasks << update_distribution if distribution_needs_update?
|
129
137
|
tasks.compact
|
130
138
|
end
|
@@ -133,21 +141,6 @@ module Katello
|
|
133
141
|
api.remotes_api.read(href)
|
134
142
|
end
|
135
143
|
|
136
|
-
def remote_needs_updates?
|
137
|
-
if repo.remote_href
|
138
|
-
remote = get_remote
|
139
|
-
# The proxy auth creds are not returned by the Pulp API.
|
140
|
-
# The creds don't need to be checked here because they
|
141
|
-
# won't be updated outside of UpdateRemote.
|
142
|
-
computed = compute_remote_options.slice!(:proxy_username, :proxy_password)
|
143
|
-
computed.keys.any? { |key| remote.send(key) != computed[key] }
|
144
|
-
elsif repo.url
|
145
|
-
true
|
146
|
-
else
|
147
|
-
false
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
144
|
def get_distribution(href = distribution_reference.href)
|
152
145
|
api.get_distribution(href)
|
153
146
|
end
|
@@ -168,14 +161,16 @@ module Katello
|
|
168
161
|
computed_options.except(:name, :client_key)
|
169
162
|
end
|
170
163
|
|
171
|
-
def create
|
172
|
-
|
173
|
-
response = api.repositories_api.create(
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
164
|
+
def create(force = false)
|
165
|
+
if force || !repository_reference
|
166
|
+
response = api.repositories_api.create(name: generate_backend_object_name)
|
167
|
+
RepositoryReference.where(
|
168
|
+
root_repository_id: repo.root_id,
|
169
|
+
content_view_id: repo.content_view.id).destroy_all
|
170
|
+
RepositoryReference.where(
|
171
|
+
root_repository_id: repo.root_id,
|
172
|
+
content_view_id: repo.content_view.id,
|
173
|
+
repository_href: response.pulp_href).create!
|
179
174
|
response
|
180
175
|
end
|
181
176
|
end
|
@@ -51,6 +51,22 @@ module Katello
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
def self.version_href(tasks)
|
55
|
+
tasks = [tasks] unless tasks.is_a?(Array)
|
56
|
+
version_hrefs = tasks.map { |task| task[:created_resources] }.flatten
|
57
|
+
version_hrefs = version_hrefs.select { |href| ::Katello::Pulp3::Repository.version_href?(href) }
|
58
|
+
Rails.logger.error("Got multiple version_hrefs for pulp task: #{tasks}") if version_hrefs.length > 2
|
59
|
+
version_hrefs.last
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.publication_href(tasks)
|
63
|
+
tasks = [tasks] unless tasks.is_a?(Array)
|
64
|
+
publication_hrefs = tasks.map { |task| task[:created_resources] }.flatten
|
65
|
+
publication_hrefs = publication_hrefs.select { |href| ::Katello::Pulp3::Repository.publication_href?(href) }
|
66
|
+
Rails.logger.error("Got multiple publication hrefs for pulp task: #{tasks}") if publication_hrefs.length > 2
|
67
|
+
publication_hrefs.last #return the last href to workaround https://pulp.plan.io/issues/9098
|
68
|
+
end
|
69
|
+
|
54
70
|
def task_data(force_refresh = false)
|
55
71
|
@pulp_data = nil if force_refresh
|
56
72
|
@pulp_data ||= tasks_api.read(@href).as_json.with_indifferent_access
|
@@ -249,6 +249,8 @@ module Katello
|
|
249
249
|
end
|
250
250
|
|
251
251
|
def delete_agent_queue(host)
|
252
|
+
return unless ::Katello.with_katello_agent?
|
253
|
+
|
252
254
|
queue_name = Katello::Agent::Dispatcher.host_queue_name(host)
|
253
255
|
Katello::EventQueue.push_event(::Katello::Events::DeleteHostAgentQueue::EVENT_TYPE, host.id) do |attrs|
|
254
256
|
attrs[:metadata] = { queue_name: queue_name }
|
@@ -39,13 +39,23 @@ class DeletePuppetAndOstreeRepos < ActiveRecord::Migration[6.0]
|
|
39
39
|
FakeContentViewPuppetEnvironment.delete_all
|
40
40
|
FakePuppetModule.delete_all
|
41
41
|
|
42
|
-
|
42
|
+
if puppet_repositories.any?
|
43
|
+
User.as_anonymous_admin do
|
44
|
+
::Katello::Repository.delete(puppet_repositories)
|
45
|
+
::Katello::RootRepository.where(content_type: 'puppet').destroy_all
|
46
|
+
end
|
47
|
+
end
|
43
48
|
|
44
49
|
FakeRepositoryOstreeBranch.delete_all
|
45
50
|
FakeOstreeBranch.delete_all
|
46
|
-
|
47
|
-
Katello::Repository.ostree_type.
|
48
|
-
|
51
|
+
|
52
|
+
if Katello::Repository.ostree_type.any?
|
53
|
+
User.as_anonymous_admin do
|
54
|
+
Katello::Repository.ostree_type.where.not(:library_instance_id => nil, :environment_id => nil).destroy_all #CV LCE repos
|
55
|
+
Katello::Repository.ostree_type.where.not(:library_instance_id => nil).destroy_all # archive repos
|
56
|
+
Katello::Repository.ostree_type.destroy_all #all the rest (should just be library repos)
|
57
|
+
end
|
58
|
+
end
|
49
59
|
|
50
60
|
Katello::ContentViewVersion.where.not(:content_counts => nil).each do |version|
|
51
61
|
version.content_counts.except!('ostree', 'puppet_module')
|
@@ -4,6 +4,7 @@ UpgradeTask.define_tasks(:katello) do
|
|
4
4
|
{:name => 'katello:clean_backend_objects', :long_running => true, :skip_failure => true, :always_run => true},
|
5
5
|
{:name => 'katello:upgrades:4.0:remove_ostree_puppet_content'},
|
6
6
|
{:name => 'katello:upgrades:4.1:sync_noarch_content'},
|
7
|
-
{:name => 'katello:upgrades:4.1:fix_invalid_pools'}
|
7
|
+
{:name => 'katello:upgrades:4.1:fix_invalid_pools'},
|
8
|
+
{:name => 'katello:upgrades:4.1:update_content_import_export_perms'}
|
8
9
|
]
|
9
10
|
end
|
@@ -55,6 +55,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostsBulkErrataModalC
|
|
55
55
|
$scope.initialLoad = true;
|
56
56
|
$scope.remoteExecutionPresent = BastionConfig.remoteExecutionPresent;
|
57
57
|
$scope.remoteExecutionByDefault = BastionConfig.remoteExecutionByDefault;
|
58
|
+
$scope.katelloAgentPresent = BastionConfig.katelloAgentPresent;
|
58
59
|
$scope.allHostsSelected = hostIds.allResultsSelected;
|
59
60
|
$scope.hostToolingEnabled = BastionConfig.hostToolingEnabled;
|
60
61
|
|
@@ -126,7 +126,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostErrataController'
|
|
126
126
|
|
127
127
|
$scope.performViaKatelloAgent = function () {
|
128
128
|
var errataIds = $scope.selectedErrataIds();
|
129
|
-
HostErratum.apply({id: $scope.host.id, 'bulk_errata_ids': errataIds},
|
129
|
+
HostErratum.apply({id: $scope.host.id, 'bulk_errata_ids': angular.toJson(errataIds)},
|
130
130
|
function (task) {
|
131
131
|
$scope.table.selectAll(false);
|
132
132
|
$scope.transitionTo('content-host.tasks.details', {taskId: task.id});
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<input type="hidden" name="remote_action" ng-value="moduleStreamActionFormValues.remoteAction"/>
|
14
14
|
<input type="hidden" name="module_stream_action" ng-value="moduleStreamActionFormValues.moduleStreamAction"/>
|
15
15
|
<input type="hidden" name="module_spec" ng-value="moduleStreamActionFormValues.moduleSpec"/>
|
16
|
-
<input type="hidden" name="bulk_host_ids" ng-value="moduleStreamActionFormValues.
|
16
|
+
<input type="hidden" name="bulk_host_ids" ng-value="moduleStreamActionFormValues.bulkHostIds"/>
|
17
17
|
<input type="hidden" name="customize" ng-value="moduleStreamActionFormValues.customize"/>
|
18
18
|
<input type="hidden" name="authenticity_token" ng-value="moduleStreamActionFormValues.authenticityToken"/>
|
19
19
|
</form>
|
@@ -37,7 +37,7 @@ angular.module('Bastion.errata').controller('ApplyErrataController',
|
|
37
37
|
$scope.errataActionFormValues = {
|
38
38
|
authenticityToken: $window.AUTH_TOKEN.replace(/"/g, ''),
|
39
39
|
errata: IncrementalUpdate.getErrataIds().join(','),
|
40
|
-
|
40
|
+
bulkHostIds: angular.toJson({ included: { ids: IncrementalUpdate.getBulkContentHosts().included.ids }}),
|
41
41
|
customize: false
|
42
42
|
};
|
43
43
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<form id="errataActionForm" method="post" action="/katello/remote_execution">
|
19
19
|
<input type="hidden" name="remote_action" value="errata_install"/>
|
20
20
|
<input type="hidden" name="name" ng-value="errataActionFormValues.errata"/>
|
21
|
-
<input type="hidden" name="
|
21
|
+
<input type="hidden" name="bulk_host_ids" ng-value="errataActionFormValues.bulkHostIds"/>
|
22
22
|
<input type="hidden" name="customize" ng-value="errataActionFormValues.customize"/>
|
23
23
|
<input type="hidden" name="authenticity_token" ng-value="errataActionFormValues.authenticityToken"/>
|
24
24
|
<input type="hidden" name="install_all" ng-value="table.allResultsSelected" />
|
@@ -132,4 +132,3 @@
|
|
132
132
|
</button>
|
133
133
|
</form>
|
134
134
|
</section>
|
135
|
-
|
@@ -114,20 +114,21 @@ namespace :katello do
|
|
114
114
|
def repo_exists?(repo)
|
115
115
|
if SmartProxy.pulp_primary!.pulp3_support?(repo)
|
116
116
|
backend_service = repo.backend_service(SmartProxy.pulp_primary!)
|
117
|
+
return false unless backend_service&.repository_reference&.repository_href
|
117
118
|
backend_service.api.repositories_api.read(backend_service.repository_reference.repository_href)
|
118
119
|
else
|
119
120
|
Katello.pulp_server.extensions.repository.retrieve(repo.pulp_id)
|
120
121
|
end
|
121
122
|
true
|
122
|
-
rescue
|
123
|
-
false
|
123
|
+
rescue StandardError => e
|
124
|
+
return false if e.code == 404
|
124
125
|
end
|
125
126
|
|
126
127
|
def handle_missing_repo(repo)
|
127
128
|
puts "Repository #{repo.id} Missing"
|
128
129
|
if repo.content_view.default?
|
129
130
|
puts "Recreating #{repo.id}"
|
130
|
-
ForemanTasks.sync_task(::Actions::Katello::Repository::Create, repo) if commit?
|
131
|
+
ForemanTasks.sync_task(::Actions::Katello::Repository::Create, repo, force_repo_create: true) if commit?
|
131
132
|
else
|
132
133
|
puts "Deleting #{repo.id}"
|
133
134
|
ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, repo) if commit?
|
@@ -5,11 +5,13 @@ namespace :katello do
|
|
5
5
|
task :remove_ostree_puppet_content => ["environment", "check_ping"] do
|
6
6
|
contents = Katello::Content.where(content_type: ['ostree', 'puppet'])
|
7
7
|
contents.each do |content|
|
8
|
-
|
8
|
+
unless content.products.any?(&:redhat?)
|
9
|
+
Katello::Resources::Candlepin::Content.destroy(content.organization.label, content.cp_content_id)
|
10
|
+
content.destroy
|
11
|
+
end
|
9
12
|
rescue RestClient::NotFound
|
10
13
|
#skip content not found
|
11
14
|
end
|
12
|
-
contents.destroy_all
|
13
15
|
end
|
14
16
|
end
|
15
17
|
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: 4.1.
|
4
|
+
version: 4.1.4
|
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-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "<"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 13.0.4
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "<"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 13.0.4
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rabl
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +98,16 @@ dependencies:
|
|
112
98
|
name: foreman-tasks-core
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- - "
|
101
|
+
- - "<"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
103
|
+
version: '0.4'
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- - "
|
108
|
+
- - "<"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
110
|
+
version: '0.4'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: foreman_remote_execution
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +126,16 @@ dependencies:
|
|
140
126
|
name: dynflow
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- - "
|
129
|
+
- - "<"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
131
|
+
version: 1.6.0
|
146
132
|
type: :runtime
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- - "
|
136
|
+
- - "<"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
138
|
+
version: 1.6.0
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: activerecord-import
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -405,7 +391,7 @@ dependencies:
|
|
405
391
|
version: 3.13.0
|
406
392
|
- - "<"
|
407
393
|
- !ruby/object:Gem::Version
|
408
|
-
version: 3.
|
394
|
+
version: 3.15.0
|
409
395
|
type: :runtime
|
410
396
|
prerelease: false
|
411
397
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -415,7 +401,7 @@ dependencies:
|
|
415
401
|
version: 3.13.0
|
416
402
|
- - "<"
|
417
403
|
- !ruby/object:Gem::Version
|
418
|
-
version: 3.
|
404
|
+
version: 3.15.0
|
419
405
|
- !ruby/object:Gem::Dependency
|
420
406
|
name: pulp_certguard_client
|
421
407
|
requirement: !ruby/object:Gem::Requirement
|
@@ -5114,7 +5100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
5114
5100
|
- !ruby/object:Gem::Version
|
5115
5101
|
version: '0'
|
5116
5102
|
requirements: []
|
5117
|
-
rubygems_version: 3.1.
|
5103
|
+
rubygems_version: 3.1.6
|
5118
5104
|
signing_key:
|
5119
5105
|
specification_version: 4
|
5120
5106
|
summary: Content and Subscription Management plugin for Foreman
|