katello 4.2.0.1.rc2 → 4.2.0.1.rc3
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/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +6 -3
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +2 -1
- data/app/helpers/katello/content_view_helper.rb +4 -4
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +18 -11
- data/app/lib/actions/katello/activation_key/destroy.rb +1 -1
- data/app/lib/actions/katello/content_view/incremental_updates.rb +13 -3
- data/app/lib/actions/katello/content_view/publish.rb +3 -4
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +4 -4
- data/app/lib/actions/katello/repository/multi_clone_to_version.rb +1 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +16 -3
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -2
- data/app/lib/katello/qpid/connection.rb +3 -1
- data/app/lib/katello/util/errata.rb +7 -2
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -0
- data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +27 -14
- data/app/models/katello/concerns/hostgroup_extensions.rb +4 -4
- data/app/models/katello/concerns/redhat_extensions.rb +3 -2
- data/app/overrides/add_activation_keys_input.rb +1 -1
- data/app/services/katello/pulp3/package_group.rb +10 -10
- data/app/services/katello/pulp3/repository/yum.rb +14 -31
- data/app/services/katello/pulp3/repository.rb +8 -2
- data/app/services/katello/pulp3/task.rb +3 -2
- data/app/services/katello/pulp3/task_group.rb +1 -0
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +6 -13
- data/lib/katello/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d21cfa77627ae227af66157509f62c5b035a89a46b403d607ba6c70926b7253a
|
4
|
+
data.tar.gz: b9dd69ad43fb90ad1af496ac476e38083e0942ed0f114171c5cfe1b32c075c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e264679f2c596a41ee24e322f0ca2bc521c89b6a18b6d9d245b987d4dae13cd55cbf18483430d590b15c8aa565bbf6e28c5550bc6969a662034e50c2054a214
|
7
|
+
data.tar.gz: 985b102bdd203636c1c84cc038f29fdb7050ea95bb4bd7a7227c4a67d3d3f33a088c7913c75a6a89e5c2f9c8792812101aedd503a67e8ce15fb965a570479b21
|
@@ -4,7 +4,7 @@ KT.hosts = {};
|
|
4
4
|
$(document).on('ContentLoad', function(){
|
5
5
|
KT.hosts.onKatelloHostEditLoad();
|
6
6
|
window.tfm.hosts.registerPluginAttributes("os",
|
7
|
-
['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id']);
|
7
|
+
['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id', 'parent_id']);
|
8
8
|
|
9
9
|
$("#hostgroup_lifecycle_environment_id").change(KT.hosts.environmentChanged);
|
10
10
|
$("#host_lifecycle_environment_id").change(KT.hosts.environmentChanged);
|
@@ -27,13 +27,15 @@ KT.hosts.fetchContentViews = function () {
|
|
27
27
|
var envId = KT.hosts.getSelectedEnvironment();
|
28
28
|
var option;
|
29
29
|
var previous_view = KT.hosts.getSelectedContentView();
|
30
|
-
|
30
|
+
var previousInheritViewText = select.find('option:first-child').text();
|
31
31
|
select.find('option').remove();
|
32
32
|
if (envId) {
|
33
33
|
KT.hosts.signalContentViewFetch(true);
|
34
34
|
var url = tfm.tools.foremanUrl('/katello/api/v2/content_views/');
|
35
35
|
$.get(url, {environment_id: envId, full_result: true}, function (data) {
|
36
|
-
|
36
|
+
if ($('#hostgroup_parent_id').length > 0) {
|
37
|
+
select.append($("<option />").text(previousInheritViewText).val(''));
|
38
|
+
}
|
37
39
|
$.each(data.results, function(index, view) {
|
38
40
|
option = $("<option />").val(view.id).text(view.name);
|
39
41
|
if (view.id === parseInt(previous_view)) {
|
@@ -41,6 +43,7 @@ KT.hosts.fetchContentViews = function () {
|
|
41
43
|
}
|
42
44
|
select.append(option);
|
43
45
|
});
|
46
|
+
select.trigger('change');
|
44
47
|
KT.hosts.signalContentViewFetch(false);
|
45
48
|
});
|
46
49
|
}
|
@@ -124,7 +124,8 @@ module Katello
|
|
124
124
|
validate_content(params[:add_content])
|
125
125
|
resolve_dependencies = params.fetch(:resolve_dependencies, true)
|
126
126
|
task = async_task(::Actions::Katello::ContentView::IncrementalUpdates, @content_view_version_environments, @composite_version_environments,
|
127
|
-
params[:add_content], resolve_dependencies, hosts, params[:description]
|
127
|
+
params[:add_content], resolve_dependencies, hosts, params[:description],
|
128
|
+
Setting[:remote_execution_by_default] && ::Katello.with_remote_execution?)
|
128
129
|
respond_for_async :resource => task
|
129
130
|
end
|
130
131
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Katello
|
2
2
|
module ContentViewHelper
|
3
|
-
def separated_repo_mapping(repo_mapping)
|
4
|
-
separated_mapping = { :
|
3
|
+
def separated_repo_mapping(repo_mapping, use_multicopy_actions)
|
4
|
+
separated_mapping = { :pulp3_yum_multicopy => {}, :other => {} }
|
5
5
|
repo_mapping.each do |source_repos, dest_repo|
|
6
|
-
if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo)
|
7
|
-
separated_mapping[:
|
6
|
+
if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo) && use_multicopy_actions
|
7
|
+
separated_mapping[:pulp3_yum_multicopy][source_repos] = dest_repo
|
8
8
|
else
|
9
9
|
separated_mapping[:other][source_repos] = dest_repo
|
10
10
|
end
|
@@ -58,19 +58,19 @@ module Katello
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def fetch_lifecycle_environment(host, options = {})
|
61
|
-
return host.lifecycle_environment if host.
|
61
|
+
return host.lifecycle_environment if host.try(:lifecycle_environment_id)
|
62
62
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
63
63
|
return selected_host_group.lifecycle_environment if selected_host_group.present?
|
64
64
|
end
|
65
65
|
|
66
66
|
def fetch_content_view(host, options = {})
|
67
|
-
return host.content_view if host.
|
67
|
+
return host.content_view if host.try(:content_view_id)
|
68
68
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
69
69
|
return selected_host_group.content_view if selected_host_group.present?
|
70
70
|
end
|
71
71
|
|
72
72
|
def fetch_content_source(host, options = {})
|
73
|
-
return host.content_source if host.
|
73
|
+
return host.content_source if host.try(:content_source_id)
|
74
74
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
75
75
|
return selected_host_group.content_source if selected_host_group.present?
|
76
76
|
end
|
@@ -216,11 +216,15 @@ module Katello
|
|
216
216
|
new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
|
217
217
|
else
|
218
218
|
# case 2
|
219
|
-
os_updated_kickstart_options
|
219
|
+
os_updated_kickstart_options
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
def
|
223
|
+
def fetch_inherited_param(id, entity, parent_value)
|
224
|
+
id.blank? ? parent_value : entity.find(id)
|
225
|
+
end
|
226
|
+
|
227
|
+
def os_updated_kickstart_options(host = nil)
|
224
228
|
# this method gets called in 1 place Once you chose a diff os/content source/arch/lifecycle env/cv
|
225
229
|
# via the os_selected method.
|
226
230
|
# In this case we want it play by the rules of "one of these params" and
|
@@ -228,19 +232,22 @@ module Katello
|
|
228
232
|
os_selection_params = ["operatingsystem_id", 'content_view_id', 'lifecycle_environment_id',
|
229
233
|
'content_source_id', 'architecture_id']
|
230
234
|
view_options = []
|
235
|
+
|
231
236
|
host_params = params[:hostgroup] || params[:host]
|
232
|
-
|
237
|
+
parent = ::Hostgroup.find(host_params[:parent_id]) unless host_params.blank? || host_params[:parent_id].blank?
|
238
|
+
if host_params && (parent || os_selection_params.all? { |key| host_params[key].present? })
|
233
239
|
if host.nil?
|
234
240
|
host = ::Host.new
|
235
241
|
end
|
236
|
-
host.operatingsystem =
|
237
|
-
host.architecture =
|
242
|
+
host.operatingsystem = fetch_inherited_param(host_params[:operatingsystem_id], ::Operatingsystem, parent&.os)
|
243
|
+
host.architecture = fetch_inherited_param(host_params[:architecture_id], ::Architecture, parent&.architecture)
|
244
|
+
lifecycle_env = fetch_inherited_param(host_params[:lifecycle_environment_id], ::Katello::KTEnvironment, parent&.lifecycle_environment)
|
245
|
+
content_view = fetch_inherited_param(host_params[:content_view_id], ::Katello::ContentView, parent&.content_view)
|
246
|
+
content_source = fetch_inherited_param(host_params[:content_source_id], ::SmartProxy, parent&.content_source)
|
238
247
|
|
239
|
-
lifecycle_env = Katello::KTEnvironment.find(host_params[:lifecycle_environment_id])
|
240
|
-
content_view = Katello::ContentView.find(host_params[:content_view_id])
|
241
248
|
host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_env.id,
|
242
249
|
:content_view_id => content_view.id,
|
243
|
-
:content_source =>
|
250
|
+
:content_source => content_source)
|
244
251
|
if host.operatingsystem.is_a?(Redhat)
|
245
252
|
view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
|
246
253
|
end
|
@@ -6,7 +6,7 @@ module Actions
|
|
6
6
|
skip_candlepin = options.fetch(:skip_candlepin, false)
|
7
7
|
action_subject(activation_key)
|
8
8
|
|
9
|
-
plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id)
|
9
|
+
plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id) if !skip_candlepin && activation_key.cp_id.present?
|
10
10
|
plan_self
|
11
11
|
end
|
12
12
|
|
@@ -4,7 +4,8 @@ module Actions
|
|
4
4
|
class IncrementalUpdates < Actions::EntryAction
|
5
5
|
include Helpers::Presenter
|
6
6
|
|
7
|
-
def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description
|
7
|
+
def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description,
|
8
|
+
use_remote_execution = false)
|
8
9
|
old_new_version_map = {}
|
9
10
|
output_for_version_ids = []
|
10
11
|
|
@@ -28,12 +29,13 @@ module Actions
|
|
28
29
|
handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description)
|
29
30
|
end
|
30
31
|
|
31
|
-
if hosts.any? && !content[:errata_ids].blank?
|
32
|
+
if hosts.any? && !content[:errata_ids].blank? && !use_remote_execution
|
32
33
|
errata = ::Katello::Erratum.with_identifiers(content[:errata_ids])
|
33
34
|
hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
|
34
35
|
plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, :errata_ids => content[:errata_ids])
|
35
36
|
end
|
36
|
-
plan_self(:version_outputs => output_for_version_ids)
|
37
|
+
plan_self(:version_outputs => output_for_version_ids, :host_ids => hosts.pluck(:id),
|
38
|
+
:errata_ids => content[:errata_ids], :use_remote_execution => use_remote_execution)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -59,6 +61,14 @@ module Actions
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def run
|
64
|
+
if input[:errata_ids].present? && input[:host_ids].present? && input[:use_remote_execution]
|
65
|
+
errata_ids = input[:errata_ids].join(',')
|
66
|
+
errata = ::Katello::Erratum.with_identifiers(input[:errata_ids])
|
67
|
+
hosts = ::Host.where(:id => input[:host_ids] &
|
68
|
+
::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
|
69
|
+
JobInvocationComposer.for_feature('katello_errata_install', hosts, { :errata => errata_ids }).trigger
|
70
|
+
end
|
71
|
+
|
62
72
|
output[:changed_content] = input[:version_outputs].map do |version_output|
|
63
73
|
{
|
64
74
|
:content_view_version => {:id => version_output[:version_id]},
|
@@ -49,13 +49,12 @@ module Actions
|
|
49
49
|
plan_action(ContentView::AddToEnvironment, version, library) unless options[:skip_promotion]
|
50
50
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, version, source_repositories).repository_mapping
|
51
51
|
# Split Pulp 3 Yum repos out of the repository_mapping. Only Pulp 3 RPM plugin has multi repo copy support.
|
52
|
-
separated_repo_map = separated_repo_mapping(repository_mapping)
|
52
|
+
separated_repo_map = separated_repo_mapping(repository_mapping, content_view.solve_dependencies)
|
53
53
|
|
54
54
|
if options[:importing]
|
55
55
|
handle_import(version, options.slice(:path, :metadata))
|
56
|
-
elsif separated_repo_map[:
|
57
|
-
|
58
|
-
plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
|
56
|
+
elsif separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
|
57
|
+
plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum_multicopy], version)
|
59
58
|
end
|
60
59
|
|
61
60
|
concurrence do
|
@@ -55,7 +55,7 @@ module Actions
|
|
55
55
|
|
56
56
|
sequence do
|
57
57
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, new_content_view_version, repos_to_clone).repository_mapping
|
58
|
-
separated_repo_map = separated_repo_mapping(repository_mapping)
|
58
|
+
separated_repo_map = separated_repo_mapping(repository_mapping, true)
|
59
59
|
|
60
60
|
repos_to_clone.each do |source_repos|
|
61
61
|
plan_action(Repository::CloneToVersion,
|
@@ -66,8 +66,8 @@ module Actions
|
|
66
66
|
end
|
67
67
|
|
68
68
|
concurrence do
|
69
|
-
if separated_repo_map[:
|
70
|
-
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:
|
69
|
+
if separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
|
70
|
+
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum_multicopy], old_version)
|
71
71
|
unit_map = pulp3_content_mapping(content)
|
72
72
|
|
73
73
|
unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
|
@@ -75,7 +75,7 @@ module Actions
|
|
75
75
|
copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
|
76
76
|
dependency_solving: dep_solve).output
|
77
77
|
repos_to_clone.each do |source_repos|
|
78
|
-
if separated_repo_map[:
|
78
|
+
if separated_repo_map[:pulp3_yum_multicopy].keys.include?(source_repos)
|
79
79
|
copy_repos(repository_mapping[source_repos])
|
80
80
|
end
|
81
81
|
end
|
@@ -9,7 +9,7 @@ module Actions
|
|
9
9
|
sequence do
|
10
10
|
plan_action(::Actions::Katello::Repository::MultiCloneContents, extended_repo_map,
|
11
11
|
copy_contents: true,
|
12
|
-
solve_dependencies:
|
12
|
+
solve_dependencies: true,
|
13
13
|
metadata_generate: !incremental)
|
14
14
|
end
|
15
15
|
end
|
@@ -20,10 +20,16 @@ module Actions
|
|
20
20
|
_("checking Pulp task status")
|
21
21
|
end
|
22
22
|
when :suspended
|
23
|
-
|
24
|
-
|
23
|
+
started_task = combined_tasks.find { |task| task&.started? && !task&.done? }&.pulp_data
|
24
|
+
if started_task
|
25
|
+
name = started_task[:name] || started_task[:description]
|
26
|
+
label = get_task_label(name, started_task[:pulp_href])
|
27
|
+
_("waiting for Pulp to finish the task %s" % label)
|
25
28
|
else
|
26
|
-
|
29
|
+
pending_task = combined_tasks.find { |task| !task&.started? }&.pulp_data
|
30
|
+
name = pending_task[:name] || pending_task[:description]
|
31
|
+
label = get_task_label(name, pending_task[:pulp_href])
|
32
|
+
_("waiting for Pulp to start the task %s" % label) if pending_task
|
27
33
|
end
|
28
34
|
else
|
29
35
|
super
|
@@ -133,6 +139,13 @@ module Actions
|
|
133
139
|
check_for_errors
|
134
140
|
pulp_tasks
|
135
141
|
end
|
142
|
+
|
143
|
+
def get_task_label(name, href)
|
144
|
+
name = name.split('.').last if name
|
145
|
+
href = href.split('-').last[0...-1] if href
|
146
|
+
label = "%s (ID: %s)" % [name, href]
|
147
|
+
label
|
148
|
+
end
|
136
149
|
end
|
137
150
|
end
|
138
151
|
end
|
@@ -15,7 +15,7 @@ module Actions
|
|
15
15
|
if filter_ids.present? || rpm_filenames.present?
|
16
16
|
copy_action = plan_action(Actions::Pulp3::Repository::CopyContent, source_repositories.first, smart_proxy, target_repo,
|
17
17
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
18
|
-
rpm_filenames: rpm_filenames)
|
18
|
+
rpm_filenames: rpm_filenames, remove_all: true)
|
19
19
|
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_action.output[:pulp_tasks])
|
20
20
|
else
|
21
21
|
#if we are not filtering, copy the version to the cv repository, and the units for each additional repo
|
@@ -26,7 +26,7 @@ module Actions
|
|
26
26
|
source_repositories[1..-1].each do |source_repo|
|
27
27
|
copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent, source_repo, smart_proxy, target_repo,
|
28
28
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
29
|
-
rpm_filenames: rpm_filenames)
|
29
|
+
rpm_filenames: rpm_filenames, remove_all: false)
|
30
30
|
end
|
31
31
|
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_actions.last.output[:pulp_tasks])
|
32
32
|
end
|
@@ -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
|
|
@@ -46,13 +46,18 @@ module Katello
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def filter_errata_by_pulp_href(errata, package_pulp_hrefs)
|
49
|
+
def filter_errata_by_pulp_href(errata, package_pulp_hrefs, source_repo_rpm_filenames)
|
50
50
|
return [] if package_pulp_hrefs.empty?
|
51
51
|
rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
|
52
52
|
rpm_filenames = rpms.map { |rpm| File.basename(rpm.filename) }
|
53
|
+
source_repo_rpm_filenames = source_repo_rpm_filenames.map { |rpm| File.basename(rpm) }
|
53
54
|
matching_errata = []
|
54
55
|
errata.each do |erratum|
|
55
|
-
|
56
|
+
# The erratum should be copied if package_pulp_hrefs has all of its packages that are available in the source repo.
|
57
|
+
next if erratum.packages.empty?
|
58
|
+
rpms_in_erratum_and_source_repo = erratum.packages.pluck(:filename) & source_repo_rpm_filenames
|
59
|
+
next if rpms_in_erratum_and_source_repo.empty?
|
60
|
+
if (rpms_in_erratum_and_source_repo - rpm_filenames).empty?
|
56
61
|
matching_errata << erratum
|
57
62
|
end
|
58
63
|
end
|
@@ -8,6 +8,7 @@ module Katello
|
|
8
8
|
def filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs)
|
9
9
|
rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
|
10
10
|
package_groups.reject do |package_group|
|
11
|
+
package_group.package_names.empty? ||
|
11
12
|
(package_group.package_names - rpms.pluck(:name)).any?
|
12
13
|
end
|
13
14
|
end
|
@@ -3,21 +3,34 @@ module Katello
|
|
3
3
|
class HostgroupKickstartRepositoryValidator < ActiveModel::Validator
|
4
4
|
def validate(facet)
|
5
5
|
return unless facet.kickstart_repository_id
|
6
|
+
if facet.content_source.blank? && facet.hostgroup.content_source.blank?
|
7
|
+
prop = :content_source
|
8
|
+
msg = _("Please select a content source before assigning a kickstart repository")
|
9
|
+
elsif facet.hostgroup.operatingsystem.blank?
|
10
|
+
prop = :base
|
11
|
+
msg = _("Please select an operating system before assigning a kickstart repository")
|
12
|
+
elsif !facet.hostgroup.operatingsystem.is_a?(Redhat)
|
13
|
+
prop = :base
|
14
|
+
msg = _("Kickstart repositories can only be assigned to hosts in the Red Hat family")
|
15
|
+
elsif facet.hostgroup.architecture.blank?
|
16
|
+
prop = :base
|
17
|
+
msg = _("Please select an architecture before assigning a kickstart repository")
|
18
|
+
elsif !content_view_in_env?(facet)
|
19
|
+
prop = :lifecycle_environment
|
20
|
+
msg = _("The selected/Inherited Content View is not available for this Lifecycle Environment")
|
21
|
+
elsif !facet.hostgroup.matching_kickstart_repository?(facet)
|
22
|
+
prop = :kickstart_repository
|
23
|
+
msg = _("The selected kickstart repository is not part of the assigned content view, " \
|
24
|
+
"lifecycle environment, content source, operating system, and architecture")
|
25
|
+
end
|
26
|
+
facet.hostgroup.errors.add(prop, msg) if msg
|
27
|
+
end
|
6
28
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
_("Kickstart repositories can only be assigned to hosts in the Red Hat family")
|
13
|
-
elsif facet.hostgroup.architecture.blank?
|
14
|
-
_("Please select an architecture before assigning a kickstart repository")
|
15
|
-
elsif !facet.hostgroup.matching_kickstart_repository?(facet)
|
16
|
-
_("The selected kickstart repository is not part of the assigned content view, lifecycle environment,
|
17
|
-
content source, operating system, and architecture")
|
18
|
-
end
|
19
|
-
|
20
|
-
facet.errors.add(:base, msg) if msg
|
29
|
+
def content_view_in_env?(facet)
|
30
|
+
env = facet.lifecycle_environment || facet.hostgroup.lifecycle_environment
|
31
|
+
cv = facet.content_view || facet.hostgroup.content_view
|
32
|
+
return true if env.blank? || cv.blank?
|
33
|
+
env.content_views.include?(cv)
|
21
34
|
end
|
22
35
|
end
|
23
36
|
end
|
@@ -39,7 +39,7 @@ module Katello
|
|
39
39
|
self.medium = nil
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
if content_facet&.kickstart_repository_id && !matching_kickstart_repository?(content_facet)
|
43
43
|
if (equivalent = equivalent_kickstart_repository)
|
44
44
|
self.content_facet.kickstart_repository_id = equivalent[:id]
|
45
45
|
end
|
@@ -92,10 +92,10 @@ module Katello
|
|
92
92
|
|
93
93
|
def equivalent_kickstart_repository
|
94
94
|
return unless operatingsystem &&
|
95
|
-
kickstart_repository &&
|
95
|
+
content_facet.kickstart_repository &&
|
96
96
|
operatingsystem.respond_to?(:kickstart_repos)
|
97
|
-
ks_repos = operatingsystem.kickstart_repos(self)
|
98
|
-
ks_repos.find { |repo| repo[:name] == kickstart_repository.label }
|
97
|
+
ks_repos = operatingsystem.kickstart_repos(self, content_facet: content_facet)
|
98
|
+
ks_repos.find { |repo| repo[:name] == content_facet.kickstart_repository.label }
|
99
99
|
end
|
100
100
|
|
101
101
|
def matching_kickstart_repository?(content_facet)
|
@@ -52,8 +52,9 @@ module Katello
|
|
52
52
|
def kickstart_repos(host, content_facet: nil)
|
53
53
|
distros = distribution_repositories(host, content_facet: content_facet).where(distribution_bootable: true)
|
54
54
|
content_facet ||= host.content_facet
|
55
|
-
|
56
|
-
|
55
|
+
cs = content_facet&.content_source || host.try(:content_source)
|
56
|
+
if distros && cs
|
57
|
+
distros.map { |distro| distro.to_hash(cs) }
|
57
58
|
else
|
58
59
|
[]
|
59
60
|
end
|
@@ -10,7 +10,7 @@ Deface::Override.new(:virtual_path => "hostgroups/_form",
|
|
10
10
|
|
11
11
|
Deface::Override.new(:virtual_path => "hostgroups/_form",
|
12
12
|
:name => "hostgroups_update_environments_select",
|
13
|
-
:insert_before => 'erb[loud]:contains("
|
13
|
+
:insert_before => 'erb[loud]:contains("compute_resource_id")',
|
14
14
|
:partial => 'overrides/activation_keys/host_environment_select')
|
15
15
|
|
16
16
|
Deface::Override.new(:virtual_path => "common/os_selection/_operatingsystem",
|
@@ -13,30 +13,30 @@ module Katello
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# Package type is now an integer:
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
16
|
+
# 0. default
|
17
|
+
# 1. optional
|
18
|
+
# 2. conditional
|
19
|
+
# 3. mandatory
|
20
|
+
# 4. unknown
|
21
21
|
# https://github.com/rpm-software-management/libcomps/blob/01a4759894cccff64d2561614a58281adf5ce859/libcomps/src/comps_docpackage.h#L36
|
22
22
|
def default_package_names
|
23
|
-
package_names_of_type(
|
23
|
+
package_names_of_type(0)
|
24
24
|
end
|
25
25
|
|
26
26
|
def optional_package_names
|
27
|
-
package_names_of_type(
|
27
|
+
package_names_of_type(1)
|
28
28
|
end
|
29
29
|
|
30
30
|
def conditional_package_names
|
31
|
-
package_names_of_type(
|
31
|
+
package_names_of_type(2)
|
32
32
|
end
|
33
33
|
|
34
34
|
def mandatory_package_names
|
35
|
-
package_names_of_type(
|
35
|
+
package_names_of_type(3)
|
36
36
|
end
|
37
37
|
|
38
38
|
def unknown_package_names
|
39
|
-
package_names_of_type(
|
39
|
+
package_names_of_type(4)
|
40
40
|
end
|
41
41
|
|
42
42
|
def package_names_of_type(type)
|
@@ -191,21 +191,17 @@ module Katello
|
|
191
191
|
tasks
|
192
192
|
end
|
193
193
|
|
194
|
-
def copy_units(source_repository, content_unit_hrefs,
|
194
|
+
def copy_units(source_repository, content_unit_hrefs, remove_all)
|
195
|
+
remove_all = true if remove_all.nil?
|
195
196
|
tasks = []
|
196
197
|
|
197
198
|
if content_unit_hrefs.sort!.any?
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
}]
|
205
|
-
data.dependency_solving = dependency_solving
|
206
|
-
package_env_hrefs = packageenvironments({ :repository_version => source_repository.version_href }).map(&:pulp_href).sort
|
207
|
-
tasks << api.copy_api.copy_content(data)
|
208
|
-
tasks << add_content(package_env_hrefs) unless package_env_hrefs.empty?
|
199
|
+
content_unit_hrefs += packageenvironments({ :repository_version => source_repository.version_href }).map(&:pulp_href).sort
|
200
|
+
first_slice = remove_all
|
201
|
+
content_unit_hrefs.each_slice(UNIT_LIMIT) do |slice|
|
202
|
+
tasks << add_content(slice, first_slice)
|
203
|
+
first_slice = false
|
204
|
+
end
|
209
205
|
else
|
210
206
|
tasks << remove_all_content
|
211
207
|
end
|
@@ -319,11 +315,6 @@ module Katello
|
|
319
315
|
dest_repo_map[:content_unit_hrefs] = content_unit_hrefs.uniq.sort
|
320
316
|
end
|
321
317
|
|
322
|
-
errata_to_include = errata_to_include_from_map(repo_id_map)
|
323
|
-
repo_id_map.each do |_, dest_repo_map|
|
324
|
-
dest_repo_map[:content_unit_hrefs] |= errata_to_include.flat_map { |erratum| erratum.repository_errata.pluck(:erratum_pulp3_href) }
|
325
|
-
end
|
326
|
-
|
327
318
|
dependency_solving = options[:solve_dependencies] || false
|
328
319
|
|
329
320
|
multi_copy_units(repo_id_map, dependency_solving)
|
@@ -358,17 +349,10 @@ module Katello
|
|
358
349
|
blacklist_ids += modular_packages(source_repository, exclusion_modular_filters) unless exclusion_modular_filters.empty?
|
359
350
|
content_unit_hrefs = whitelist_ids - blacklist_ids
|
360
351
|
if content_unit_hrefs.any?
|
361
|
-
content_unit_hrefs += additional_content_hrefs(source_repository, content_unit_hrefs
|
352
|
+
content_unit_hrefs += additional_content_hrefs(source_repository, content_unit_hrefs)
|
362
353
|
end
|
363
354
|
content_unit_hrefs += source_repository.srpms.pluck(:pulp_id)
|
364
|
-
|
365
|
-
copy_units(source_repository, content_unit_hrefs.uniq, dependency_solving)
|
366
|
-
end
|
367
|
-
|
368
|
-
def errata_to_include_from_map(repo_id_map)
|
369
|
-
all_errata = ::Katello::Erratum.in_repositories(repo_id_map.keys.flatten.uniq)
|
370
|
-
all_content_units = repo_id_map.values.pluck(:content_unit_hrefs).flatten.uniq
|
371
|
-
filter_errata_by_pulp_href(all_errata, all_content_units)
|
355
|
+
copy_units(source_repository, content_unit_hrefs.uniq, options[:remove_all])
|
372
356
|
end
|
373
357
|
|
374
358
|
def modular_packages(source_repository, filters)
|
@@ -379,14 +363,13 @@ module Katello
|
|
379
363
|
list_ids
|
380
364
|
end
|
381
365
|
|
382
|
-
def additional_content_hrefs(source_repository, content_unit_hrefs
|
366
|
+
def additional_content_hrefs(source_repository, content_unit_hrefs)
|
383
367
|
repo_service = source_repository.backend_service(SmartProxy.pulp_primary)
|
384
368
|
options = { :repository_version => source_repository.version_href }
|
385
369
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
end
|
370
|
+
errata_to_include = filter_errata_by_pulp_href(source_repository.errata, content_unit_hrefs,
|
371
|
+
source_repository.rpms.pluck(:filename))
|
372
|
+
content_unit_hrefs += errata_to_include.collect { |erratum| erratum.repository_errata.pluck(:erratum_pulp3_href) }.flatten
|
390
373
|
|
391
374
|
package_groups_to_include = filter_package_groups_by_pulp_href(source_repository.package_groups, content_unit_hrefs)
|
392
375
|
content_unit_hrefs += package_groups_to_include.pluck(:pulp_id)
|
@@ -122,6 +122,7 @@ module Katello
|
|
122
122
|
remote_partial_update
|
123
123
|
else
|
124
124
|
create_remote
|
125
|
+
return nil #return nil, as create isn't async
|
125
126
|
end
|
126
127
|
end
|
127
128
|
end
|
@@ -454,9 +455,14 @@ module Katello
|
|
454
455
|
end
|
455
456
|
end
|
456
457
|
|
457
|
-
def add_content(content_unit_href)
|
458
|
+
def add_content(content_unit_href, remove_all_units = false)
|
458
459
|
content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
|
459
|
-
|
460
|
+
if remove_all_units
|
461
|
+
api.repositories_api.modify(repository_reference.repository_href, remove_content_units: ['*'])
|
462
|
+
api.repositories_api.modify(repository_reference.repository_href, add_content_units: content_unit_href)
|
463
|
+
else
|
464
|
+
api.repositories_api.modify(repository_reference.repository_href, add_content_units: content_unit_href)
|
465
|
+
end
|
460
466
|
end
|
461
467
|
|
462
468
|
def add_content_for_repo(repository_href, content_unit_href)
|
@@ -38,6 +38,7 @@ module Katello
|
|
38
38
|
|
39
39
|
#needed for serialization in dynflow
|
40
40
|
|
41
|
+
attr_reader :pulp_data
|
41
42
|
delegate :[], :key?, :dig, :to_hash, :to => :task_data
|
42
43
|
|
43
44
|
def initialize(smart_proxy, data)
|
@@ -83,7 +84,7 @@ module Katello
|
|
83
84
|
end
|
84
85
|
|
85
86
|
def done?
|
86
|
-
task_data[:
|
87
|
+
task_data[:finished_at] || FINISHED_STATES.include?(task_data[:state])
|
87
88
|
end
|
88
89
|
|
89
90
|
def progress_reports
|
@@ -100,7 +101,7 @@ module Katello
|
|
100
101
|
end
|
101
102
|
|
102
103
|
def started?
|
103
|
-
task_data[:
|
104
|
+
task_data[:started_at]
|
104
105
|
end
|
105
106
|
|
106
107
|
def error
|
@@ -37,9 +37,9 @@ end %>
|
|
37
37
|
|
38
38
|
<%= field(f, cs_select_attr, {:label => _("Content Source")}) do
|
39
39
|
if using_hostgroups_page?
|
40
|
-
select_tag cs_select_id, content_source_options(@hostgroup, :
|
41
|
-
:class => 'form-control', :name => cs_select_name
|
40
|
+
select_tag cs_select_id, content_source_options(@hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_source)), :data => {"spinner_path" => spinner_path},
|
41
|
+
:class => 'form-control', :name => cs_select_name
|
42
42
|
else
|
43
|
-
select_tag cs_select_id, content_source_options(@host, :selected_host_group => @host.hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_source)), :data => {"spinner_path" => spinner_path}, :class => 'form-control', :name => cs_select_name
|
43
|
+
select_tag cs_select_id, content_source_options(@host, :selected_host_group => @hostgroup || @host.hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_source)), :data => {"spinner_path" => spinner_path}, :class => 'form-control', :name => cs_select_name
|
44
44
|
end
|
45
45
|
end %>
|
@@ -101,7 +101,7 @@
|
|
101
101
|
<td bst-table-cell>{{ erratum.title }}</td>
|
102
102
|
<td class="small" bst-table-cell>{{ erratum.issued }}</td>
|
103
103
|
<td class="small" bst-table-cell class="number-cell">
|
104
|
-
<a href="{{ '/content_hosts?search=installable_errata%3D' + erratum.errata_id }}">
|
104
|
+
<a target="_blank" href="{{ '/content_hosts?search=installable_errata%3D' + erratum.errata_id }}">
|
105
105
|
<span> {{ erratum.affected_hosts_count }} </span>
|
106
106
|
<span class="fa fa-external-link"/>
|
107
107
|
</a>
|
@@ -10,14 +10,13 @@
|
|
10
10
|
* @requires ContentViewVersion
|
11
11
|
* @requires CurrentOrganization
|
12
12
|
* @requires Notification
|
13
|
-
* @requires BastionConfig
|
14
13
|
*
|
15
14
|
* @description
|
16
15
|
* Display confirmation screen and apply Errata.
|
17
16
|
*/
|
18
17
|
angular.module('Bastion.errata').controller('ApplyErrataController',
|
19
|
-
['$scope', '$window', 'translate', 'IncrementalUpdate', 'HostBulkAction', 'ContentViewVersion', 'CurrentOrganization', 'Notification',
|
20
|
-
function ($scope, $window, translate, IncrementalUpdate, HostBulkAction, ContentViewVersion, CurrentOrganization, Notification
|
18
|
+
['$scope', '$window', 'translate', 'IncrementalUpdate', 'HostBulkAction', 'ContentViewVersion', 'CurrentOrganization', 'Notification',
|
19
|
+
function ($scope, $window, translate, IncrementalUpdate, HostBulkAction, ContentViewVersion, CurrentOrganization, Notification) {
|
21
20
|
var applyErrata, incrementalUpdate;
|
22
21
|
|
23
22
|
function transitionToTask(task) {
|
@@ -32,8 +31,6 @@ angular.module('Bastion.errata').controller('ApplyErrataController',
|
|
32
31
|
|
33
32
|
$scope.applyingErrata = false;
|
34
33
|
|
35
|
-
$scope.remoteExecutionPresent = BastionConfig.remoteExecutionPresent;
|
36
|
-
$scope.remoteExecutionByDefault = BastionConfig.remoteExecutionByDefault;
|
37
34
|
$scope.errataActionFormValues = {
|
38
35
|
authenticityToken: $window.AUTH_TOKEN.replace(/"/g, ''),
|
39
36
|
errata: IncrementalUpdate.getErrataIds().join(','),
|
@@ -134,15 +131,11 @@ angular.module('Bastion.errata').controller('ApplyErrataController',
|
|
134
131
|
});
|
135
132
|
|
136
133
|
$scope.confirmApply = function() {
|
137
|
-
|
138
|
-
|
134
|
+
$scope.applyingErrata = true;
|
135
|
+
if ($scope.updates.length === 0) {
|
136
|
+
applyErrata();
|
139
137
|
} else {
|
140
|
-
|
141
|
-
if ($scope.updates.length === 0) {
|
142
|
-
applyErrata();
|
143
|
-
} else {
|
144
|
-
incrementalUpdate();
|
145
|
-
}
|
138
|
+
incrementalUpdate();
|
146
139
|
}
|
147
140
|
};
|
148
141
|
|
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.2.0.1.
|
4
|
+
version: 4.2.0.1.rc3
|
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-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -115,6 +115,9 @@ dependencies:
|
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.5.0
|
118
|
+
- - "<"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.6.0
|
118
121
|
type: :runtime
|
119
122
|
prerelease: false
|
120
123
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,6 +125,9 @@ dependencies:
|
|
122
125
|
- - ">="
|
123
126
|
- !ruby/object:Gem::Version
|
124
127
|
version: 1.5.0
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.6.0
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
132
|
name: activerecord-import
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|