katello 4.1.0 → 4.1.3
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/content_view_version/incremental_update.rb +12 -15
- 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/content_view_version/destroy_exporter.rb +2 -2
- 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/create_remote.rb +4 -0
- 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/models/katello/candlepin/repository_mapper.rb +1 -1
- data/app/models/katello/concerns/smart_proxy_extensions.rb +9 -0
- data/app/models/katello/content_view_version.rb +26 -2
- data/app/models/katello/ping.rb +1 -2
- data/app/models/katello/root_repository.rb +10 -0
- data/app/services/katello/pulp3/api/core.rb +3 -3
- data/app/services/katello/pulp3/api/docker.rb +3 -1
- data/app/services/katello/pulp3/docker_manifest.rb +3 -9
- data/app/services/katello/pulp3/docker_manifest_list.rb +1 -1
- data/app/services/katello/pulp3/repository.rb +19 -24
- data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
- data/app/services/katello/pulp3/repository_mirror.rb +1 -1
- data/app/services/katello/pulp3/task.rb +16 -0
- data/app/services/katello/pulp3/task_group.rb +2 -2
- data/app/views/overrides/smart_proxies/_download_policy.erb +1 -1
- data/config/initializers/monkeys.rb +1 -0
- 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/content-host-traces.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/content-hosts/content/views/content-host-traces.html +1 -1
- data/lib/katello/tasks/repository.rake +4 -3
- data/lib/katello/version.rb +1 -1
- data/lib/monkeys/pulp3_13_checksumfix.rb +17 -0
- metadata +31 -74
- data/locale/bn/katello.edit.po +0 -8300
- data/locale/bn/katello.po.time_stamp +0 -0
- data/locale/cs/katello.edit.po +0 -8573
- data/locale/cs/katello.po.time_stamp +0 -0
- data/locale/de/katello.edit.po +0 -8319
- data/locale/de/katello.po.time_stamp +0 -0
- data/locale/en/katello.edit.po +0 -8297
- data/locale/en/katello.po.time_stamp +0 -0
- data/locale/es/katello.edit.po +0 -8317
- data/locale/es/katello.po.time_stamp +0 -0
- data/locale/fr/katello.edit.po +0 -8337
- data/locale/fr/katello.po.time_stamp +0 -0
- data/locale/gu/katello.edit.po +0 -8300
- data/locale/gu/katello.po.time_stamp +0 -0
- data/locale/hi/katello.edit.po +0 -8300
- data/locale/hi/katello.po.time_stamp +0 -0
- data/locale/it/katello.edit.po +0 -8303
- data/locale/it/katello.po.time_stamp +0 -0
- data/locale/ja/katello.edit.po +0 -8329
- data/locale/ja/katello.po.time_stamp +0 -0
- data/locale/kn/katello.edit.po +0 -8300
- data/locale/kn/katello.po.time_stamp +0 -0
- data/locale/ko/katello.edit.po +0 -8301
- data/locale/ko/katello.po.time_stamp +0 -0
- data/locale/mr/katello.edit.po +0 -8300
- data/locale/mr/katello.po.time_stamp +0 -0
- data/locale/or/katello.edit.po +0 -8300
- data/locale/or/katello.po.time_stamp +0 -0
- data/locale/pa/katello.edit.po +0 -8301
- data/locale/pa/katello.po.time_stamp +0 -0
- data/locale/pt/katello.edit.po +0 -8300
- data/locale/pt/katello.po.time_stamp +0 -0
- data/locale/pt_BR/katello.edit.po +0 -8315
- data/locale/pt_BR/katello.po.time_stamp +0 -0
- data/locale/ru/katello.edit.po +0 -8309
- data/locale/ru/katello.po.time_stamp +0 -0
- data/locale/ta/katello.edit.po +0 -8300
- data/locale/ta/katello.po.time_stamp +0 -0
- data/locale/te/katello.edit.po +0 -8300
- data/locale/te/katello.po.time_stamp +0 -0
- data/locale/zh_CN/katello.edit.po +0 -8328
- data/locale/zh_CN/katello.po.time_stamp +0 -0
- data/locale/zh_TW/katello.edit.po +0 -8303
- data/locale/zh_TW/katello.po.time_stamp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1adb0b8312ecc97c2044f94caff1265923f1cc909ff71a67cb95303c55658c11
|
4
|
+
data.tar.gz: 9a0584aad43b18d1ce26d9cd5fde0709e7b34233e005fd5fff046960a4674693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a887f66325269c29a3d1413184172d357ea097031fffad680789ebbb6c5d044eeb01b053e6e570cd8eb4d8528132ee8739d2b3224b14c73b412c19389d7f144
|
7
|
+
data.tar.gz: b54b6cfd02c914f976b38c6b5ad586192ffb7cf146957b8b1a09626560d046ecb4683760a7c90a72cb58558a3333fe972415c401f1afb06fd4bc96414aa9a536
|
@@ -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
|
@@ -18,6 +18,7 @@ module Actions
|
|
18
18
|
|
19
19
|
# rubocop:disable Metrics/MethodLength
|
20
20
|
# rubocop:disable Metrics/AbcSize
|
21
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
21
22
|
def plan(old_version, environments, options = {})
|
22
23
|
dep_solve = options.fetch(:resolve_dependencies, true)
|
23
24
|
description = options.fetch(:description, '')
|
@@ -71,18 +72,22 @@ module Actions
|
|
71
72
|
unit_map = pulp3_content_mapping(content)
|
72
73
|
|
73
74
|
unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
|
74
|
-
|
75
|
-
|
75
|
+
sequence do
|
76
|
+
copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
|
77
|
+
dependency_solving: dep_solve).output
|
78
|
+
repos_to_clone.each do |source_repos|
|
79
|
+
if separated_repo_map[:pulp3_yum].keys.include?(source_repos)
|
80
|
+
copy_repos(repository_mapping[source_repos])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
76
84
|
end
|
77
85
|
end
|
78
86
|
|
79
87
|
if separated_repo_map[:other].keys.flatten.present?
|
80
88
|
repos_to_clone.each do |source_repos|
|
81
89
|
if separated_repo_map[:other].keys.include?(source_repos)
|
82
|
-
|
83
|
-
new_content_view_version,
|
84
|
-
content,
|
85
|
-
dep_solve)
|
90
|
+
copy_repos(repository_mapping[source_repos])
|
86
91
|
end
|
87
92
|
end
|
88
93
|
end
|
@@ -138,19 +143,11 @@ module Actions
|
|
138
143
|
end
|
139
144
|
end
|
140
145
|
|
141
|
-
def copy_repos(new_repo
|
142
|
-
copy_output = []
|
146
|
+
def copy_repos(new_repo)
|
143
147
|
sequence do
|
144
|
-
solve_dependencies = new_version.content_view.solve_dependencies || dep_solve
|
145
|
-
copy_output += copy_deb_content(new_repo, solve_dependencies, content[:deb_ids])
|
146
|
-
copy_output += copy_yum_content(new_repo, solve_dependencies,
|
147
|
-
content[:package_ids],
|
148
|
-
content[:errata_ids])
|
149
|
-
|
150
148
|
plan_action(Katello::Repository::MetadataGenerate, new_repo)
|
151
149
|
plan_action(Katello::Repository::IndexContent, id: new_repo.id)
|
152
150
|
end
|
153
|
-
copy_output
|
154
151
|
end
|
155
152
|
|
156
153
|
# For a given repo, find it's instances in both the new and old component versions.
|
@@ -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
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Actions
|
2
2
|
module Pulp3
|
3
3
|
module ContentViewVersion
|
4
|
-
class DestroyExporter < Pulp3::
|
4
|
+
class DestroyExporter < Pulp3::AbstractAsyncTask
|
5
5
|
input_format do
|
6
6
|
param :smart_proxy_id, Integer
|
7
7
|
param :exporter_data, Hash
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def invoke_external_task
|
11
11
|
::Katello::Pulp3::ContentViewVersion::Export.new(smart_proxy: smart_proxy).destroy_exporter(input[:exporter_data][:pulp_href])
|
12
12
|
end
|
13
13
|
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,
|
@@ -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
|
|
@@ -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
|
@@ -231,7 +231,19 @@ module Katello
|
|
231
231
|
end
|
232
232
|
|
233
233
|
def available_packages
|
234
|
-
|
234
|
+
# The simple/obvious solution is:
|
235
|
+
# library_packages.where.not(:id => packages)
|
236
|
+
# However, when the list of exclusions is large, the SQL "NOT IN" clause
|
237
|
+
# is extremely inefficient, and it is much better to use a
|
238
|
+
# "LEFT OUTER JOIN" with a subquery.
|
239
|
+
# ActiveRecord .joins() only supports subqueries by supplying raw SQL. We
|
240
|
+
# use .to_sql to avoid hard-coding raw SQL for self.packages, although
|
241
|
+
# .to_sql may also be somewhat brittle. For example, see:
|
242
|
+
# https://github.com/rails/rails/issues/18379
|
243
|
+
library_packages.joins(
|
244
|
+
"LEFT OUTER JOIN (#{packages.select('id').to_sql}) AS exclude_rpms ON " \
|
245
|
+
'katello_rpms.id = exclude_rpms.id'
|
246
|
+
).where('exclude_rpms.id IS NULL')
|
235
247
|
end
|
236
248
|
|
237
249
|
def srpms
|
@@ -262,7 +274,19 @@ module Katello
|
|
262
274
|
end
|
263
275
|
|
264
276
|
def available_errata
|
265
|
-
|
277
|
+
# The simple/obvious solution is:
|
278
|
+
# library_errata.where.not(:id => errata)
|
279
|
+
# However, when the list of exclusions is large, the SQL "NOT IN" clause
|
280
|
+
# is extremely inefficient, and it is much better to use a
|
281
|
+
# "LEFT OUTER JOIN" with a subquery.
|
282
|
+
# ActiveRecord .joins() only supports subqueries by supplying raw SQL. We
|
283
|
+
# use .to_sql to avoid hard-coding raw SQL for self.errata, although
|
284
|
+
# .to_sql may also be somewhat brittle. For example, see:
|
285
|
+
# https://github.com/rails/rails/issues/18379
|
286
|
+
library_errata.joins(
|
287
|
+
"LEFT OUTER JOIN (#{errata.select('id').to_sql}) AS exclude_errata ON " \
|
288
|
+
'katello_errata.id = exclude_errata.id'
|
289
|
+
).where('exclude_errata.id IS NULL')
|
266
290
|
end
|
267
291
|
|
268
292
|
def file_units
|