katello 4.8.0 → 4.8.2
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/api/v2/simple_content_access_controller.rb +3 -1
- data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +2 -9
- data/app/lib/actions/katello/host/update_content_view.rb +4 -2
- data/app/lib/actions/katello/organization/simple_content_access/enable.rb +10 -0
- data/app/lib/actions/katello/organization/simple_content_access/prepare_content_overrides.rb +36 -0
- data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +12 -2
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
- data/app/lib/katello/resources/cdn/katello_cdn.rb +8 -4
- data/app/lib/katello/util/content_overrides_migrator.rb +98 -0
- data/app/models/katello/concerns/host_managed_extensions.rb +33 -1
- data/app/models/katello/content_view.rb +10 -6
- data/app/models/katello/host/content_facet.rb +10 -3
- data/app/models/katello/product_content.rb +35 -1
- data/app/services/katello/product_content_finder.rb +4 -0
- data/app/views/katello/api/v2/repository_sets/show.json.rabl +2 -2
- data/db/migrate/20220110223754_update_disconnected_settings.rb +8 -4
- data/db/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb +1 -1
- data/lib/katello/version.rb +1 -1
- data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +2 -2
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +1 -1
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dbc6ac50280ac62f64e850e0d16444abed94953b491ac51db4530e8e377edb
|
4
|
+
data.tar.gz: e5d4e0fb485fcbdfd73d56c3f7e1d9952bdec57110447c683d55c2e81784a0f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56f172e039b743a27fddb7af888d01bfd42699da833b1afddeea3ea5d44b96abf38870d1fcc95481c538725974ccf343bfef35230a51ba916352054d9f0f8eee
|
7
|
+
data.tar.gz: 7ac8d7121b1d41d28417ed65904cb29444935f429c02d285766a8ada60c2f76d29f4015291045c583e4729c7ac5d9839a5d6bec50beaae06d09c7dcff2461ccc
|
@@ -26,8 +26,10 @@ module Katello
|
|
26
26
|
api :PUT, "/organizations/:organization_id/simple_content_access/enable",
|
27
27
|
N_("Enable simple content access for a manifest")
|
28
28
|
param :organization_id, :number, :desc => N_("Organization ID"), :required => true
|
29
|
+
param :auto_create_overrides, :bool, :desc => N_("Automatically create disabled content overrides for custom products which do not have an attached subscription"), :required => false, :default => true
|
29
30
|
def enable
|
30
|
-
|
31
|
+
auto_create = params.key?(:auto_create_overrides) ? ::Foreman::Cast.to_bool(params[:auto_create_overrides]) : true
|
32
|
+
task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Enable, params[:organization_id], auto_create_overrides: auto_create)
|
31
33
|
respond_for_async :resource => task
|
32
34
|
end
|
33
35
|
|
@@ -6,7 +6,7 @@ module Katello
|
|
6
6
|
before_action :set_up_content_view_environment, only: [:update]
|
7
7
|
|
8
8
|
def set_up_content_view_environment
|
9
|
-
return unless
|
9
|
+
return unless @host&.content_facet.present? && params[:host]&.[](:content_facet_attributes)&.present?
|
10
10
|
cv_id = params[:host][:content_facet_attributes].delete(:content_view_id)
|
11
11
|
env_id = params[:host][:content_facet_attributes].delete(:lifecycle_environment_id)
|
12
12
|
Rails.logger.info "set_up_content_view_environment: cv_id=#{cv_id}, env_id=#{env_id}"
|
@@ -112,15 +112,8 @@ module Actions
|
|
112
112
|
version.update_content_counts!
|
113
113
|
# update errata applicability counts for all hosts in the CV & Library
|
114
114
|
unless input[:skip_promotion]
|
115
|
-
|
116
|
-
|
117
|
-
::Katello::Host::ContentFacet.in_content_views_and_environments(
|
118
|
-
content_views: [content_view],
|
119
|
-
lifecycle_environments: [lifecycle_environment]
|
120
|
-
).each do |facet|
|
121
|
-
facet.update_applicability_counts
|
122
|
-
facet.update_errata_status
|
123
|
-
end
|
115
|
+
environment = ::Katello::KTEnvironment.find(input[:environment_id])
|
116
|
+
::Katello::ContentView.find(input[:content_view_id]).update_host_statuses(environment)
|
124
117
|
end
|
125
118
|
|
126
119
|
history = ::Katello::ContentViewHistory.find(input[:history_id])
|
@@ -4,8 +4,10 @@ module Actions
|
|
4
4
|
class UpdateContentView < Actions::EntryAction
|
5
5
|
def plan(host, content_view_id, lifecycle_environment_id)
|
6
6
|
if host.content_facet
|
7
|
-
host.content_facet.
|
8
|
-
|
7
|
+
host.content_facet.assign_single_environment(
|
8
|
+
content_view_id: content_view_id,
|
9
|
+
lifecycle_environment_id: lifecycle_environment_id
|
10
|
+
)
|
9
11
|
host.update_candlepin_associations
|
10
12
|
plan_self(:hostname => host.name)
|
11
13
|
else
|
@@ -3,6 +3,16 @@ module Actions
|
|
3
3
|
module Organization
|
4
4
|
module SimpleContentAccess
|
5
5
|
class Enable < Toggle
|
6
|
+
def plan(organization_id, auto_create_overrides: true)
|
7
|
+
input[:auto_create_overrides] = auto_create_overrides
|
8
|
+
sequence do
|
9
|
+
if auto_create_overrides
|
10
|
+
plan_action(PrepareContentOverrides, organization_id)
|
11
|
+
end
|
12
|
+
super(organization_id) # puts plan_self inside the sequence
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
def content_access_mode_value
|
7
17
|
SIMPLE_CONTENT_ACCESS_ENABLED_VALUE
|
8
18
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Organization
|
4
|
+
module SimpleContentAccess
|
5
|
+
class PrepareContentOverrides < Actions::Base
|
6
|
+
def plan(organization_id)
|
7
|
+
Rails.logger.info "PrepareContentOverrides plan: #{organization_id.inspect}"
|
8
|
+
organization = ::Organization.find(organization_id.to_i)
|
9
|
+
org_name = organization.name
|
10
|
+
|
11
|
+
plan_self(organization_id: organization_id, organization_name: org_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
organization = ::Organization.find(input[:organization_id].to_i)
|
16
|
+
migrator = ::Katello::Util::ContentOverridesMigrator.new(organization: organization)
|
17
|
+
|
18
|
+
output[:migrator_result] = migrator.execute_non_sca_overrides!
|
19
|
+
end
|
20
|
+
|
21
|
+
def rescue_strategy
|
22
|
+
Dynflow::Action::Rescue::Skip
|
23
|
+
end
|
24
|
+
|
25
|
+
def humanized_name
|
26
|
+
N_("Prepare content overrides for Simple Content Access")
|
27
|
+
end
|
28
|
+
|
29
|
+
def humanized_input
|
30
|
+
_("for organization %s") % input[:organization_name]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -12,9 +12,15 @@ module Actions
|
|
12
12
|
attr_reader :organization
|
13
13
|
|
14
14
|
def plan(organization_id)
|
15
|
-
|
15
|
+
organization = ::Organization.find(organization_id.to_i)
|
16
|
+
input[:organization_name] = organization.name
|
17
|
+
input[:organization_label] = organization.label
|
16
18
|
action_subject organization
|
17
|
-
|
19
|
+
plan_self(organization_id: organization_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
::Katello::Resources::Candlepin::Owner.update(input[:organization_label], contentAccessMode: content_access_mode_value)
|
18
24
|
end
|
19
25
|
|
20
26
|
def failure_notification(plan)
|
@@ -30,6 +36,10 @@ module Actions
|
|
30
36
|
)
|
31
37
|
end
|
32
38
|
|
39
|
+
def humanized_input
|
40
|
+
_("for organization %s") % input[:organization_name]
|
41
|
+
end
|
42
|
+
|
33
43
|
private
|
34
44
|
|
35
45
|
def consumer
|
@@ -161,7 +161,7 @@ module Katello
|
|
161
161
|
returns String, desc: 'Package version'
|
162
162
|
end
|
163
163
|
def host_latest_applicable_rpm_version(host, package)
|
164
|
-
::Katello::Rpm.latest(host.applicable_rpms.where(name: package))
|
164
|
+
::Katello::Rpm.latest(host.applicable_rpms.where(name: package))&.first&.nvra
|
165
165
|
end
|
166
166
|
|
167
167
|
apipie :method, 'Loads Pool objects' do
|
@@ -11,10 +11,14 @@ module Katello
|
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def fetch_repo_set(content_path)
|
15
15
|
url = "/katello/api/v2/repository_sets?organization_id=#{organization['id']}&search=#{CGI.escape("path = #{content_path}")}"
|
16
16
|
response = get(url)
|
17
|
-
|
17
|
+
JSON.parse(response)['results'].first
|
18
|
+
end
|
19
|
+
|
20
|
+
def fetch_paths(content_path)
|
21
|
+
repo_set = fetch_repo_set(content_path)
|
18
22
|
|
19
23
|
fail _("Upstream organization %s does not provide this content path") % @organization_label if repo_set.nil?
|
20
24
|
|
@@ -33,8 +37,8 @@ module Katello
|
|
33
37
|
results = json_body['results']
|
34
38
|
|
35
39
|
results.map do |repo|
|
36
|
-
Katello::Content.substitute_content_path(arch: repo[
|
37
|
-
releasever: repo[
|
40
|
+
Katello::Content.substitute_content_path(arch: repo['arch'],
|
41
|
+
releasever: repo['minor'],
|
38
42
|
content_path: content_path)
|
39
43
|
end
|
40
44
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Katello
|
2
|
+
module Util
|
3
|
+
class ContentOverridesMigrator # used in Actions::Katello::Organization::SimpleContentAccess::PrepareContentOverrides
|
4
|
+
include ActionView::Helpers::TextHelper
|
5
|
+
|
6
|
+
def initialize(organization:)
|
7
|
+
@organization = organization
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute_non_sca_overrides!
|
11
|
+
host_errors = create_disabled_overrides_for_non_sca_org_hosts(organization: @organization)
|
12
|
+
ak_errors = create_disabled_overrides_for_non_sca_org_activation_keys(organization: @organization)
|
13
|
+
|
14
|
+
total_errors = host_errors + ak_errors
|
15
|
+
finish_message = "Finished creating overrides in non-SCA org; #{total_errors == 0 ? "no errors" : "#{pluralize(total_errors, "error")}"}"
|
16
|
+
messages = { result: finish_message, errors: total_errors }
|
17
|
+
messages[:host_errors] = "Hosts - #{pluralize(host_errors, "error")} creating disabled overrides for unsubscribed content; see log messages above" if host_errors > 0
|
18
|
+
messages[:ak_errors] = "Activation keys - #{pluralize(ak_errors, "error")} creating disabled overrides for unsubscribed content; see log messages above" if ak_errors > 0
|
19
|
+
messages[:success_message] = "Organization may now be switched to Simple Content Access mode without any change in access to content." if total_errors == 0
|
20
|
+
Rails.logger.info finish_message
|
21
|
+
Rails.logger.info messages[:host_errors] if messages[:host_errors]
|
22
|
+
Rails.logger.info messages[:ak_errors] if messages[:ak_errors]
|
23
|
+
Rails.logger.info messages[:success_message] if messages[:success_message]
|
24
|
+
messages
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_disabled_overrides_for_non_sca(consumable:)
|
28
|
+
content_finder = ::Katello::ProductContentFinder.new(
|
29
|
+
match_subscription: false,
|
30
|
+
match_environment: false,
|
31
|
+
consumable: consumable
|
32
|
+
)
|
33
|
+
subscribed_content_finder = ::Katello::ProductContentFinder.new(
|
34
|
+
match_subscription: true,
|
35
|
+
match_environment: false,
|
36
|
+
consumable: consumable
|
37
|
+
)
|
38
|
+
candlepin_resource = consumable.is_a?(::Katello::Host::SubscriptionFacet) ? ::Katello::Resources::Candlepin::Consumer : ::Katello::Resources::Candlepin::ActivationKey
|
39
|
+
consumable_id = consumable.is_a?(::Katello::Host::SubscriptionFacet) ? consumable.uuid : consumable.cp_id
|
40
|
+
repos_with_existing_overrides = candlepin_resource.content_overrides(consumable_id).map do |override|
|
41
|
+
override[:contentLabel]
|
42
|
+
end
|
43
|
+
unsubscribed_content = content_finder.custom_content_labels - subscribed_content_finder.custom_content_labels - repos_with_existing_overrides
|
44
|
+
new_overrides = unsubscribed_content.map do |repo_label|
|
45
|
+
::Katello::ContentOverride.new(
|
46
|
+
repo_label,
|
47
|
+
{ name: "enabled", value: "0" } # Override to disabled
|
48
|
+
)
|
49
|
+
end
|
50
|
+
return if new_overrides.blank?
|
51
|
+
if consumable.is_a? ::Katello::Host::SubscriptionFacet
|
52
|
+
::Katello::Resources::Candlepin::Consumer.update_content_overrides(
|
53
|
+
consumable.uuid,
|
54
|
+
new_overrides.map(&:to_entitlement_hash)
|
55
|
+
)
|
56
|
+
else
|
57
|
+
::Katello::Resources::Candlepin::ActivationKey.update_content_overrides(
|
58
|
+
consumable.cp_id,
|
59
|
+
new_overrides.map(&:to_entitlement_hash)
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_disabled_overrides_for_non_sca_org_hosts(organization:)
|
65
|
+
errors = 0
|
66
|
+
fail _("Organization must be specified") if organization.blank?
|
67
|
+
return 0 if organization.simple_content_access? # subscription attachment is meaningless with SCA
|
68
|
+
Rails.logger.info("Hosts - Creating disabled overrides for unsubscribed content in organization #{organization.name}")
|
69
|
+
# only registered hosts with content!
|
70
|
+
hosts_to_update = organization.hosts.joins(:subscription_facet).where.not("#{Katello::Host::SubscriptionFacet.table_name}.host_id" => nil)
|
71
|
+
hosts_to_update.each do |host|
|
72
|
+
create_disabled_overrides_for_non_sca(consumable: host.subscription_facet)
|
73
|
+
rescue => e
|
74
|
+
errors += 1
|
75
|
+
Rails.logger.error("Failed to update host #{host.name}: #{e.message}")
|
76
|
+
Rails.logger.debug e.backtrace.join("\n")
|
77
|
+
end
|
78
|
+
errors
|
79
|
+
end
|
80
|
+
|
81
|
+
def create_disabled_overrides_for_non_sca_org_activation_keys(organization:)
|
82
|
+
errors = 0
|
83
|
+
fail _("Organization must be specified") if organization.blank?
|
84
|
+
return 0 if organization.simple_content_access? # subscription attachment is meaningless with SCA
|
85
|
+
Rails.logger.info("Activation keys - Creating disabled overrides for unsubscribed content in organization #{organization.name}")
|
86
|
+
aks_to_update = organization.activation_keys
|
87
|
+
aks_to_update.each do |ak|
|
88
|
+
create_disabled_overrides_for_non_sca(consumable: ak)
|
89
|
+
rescue => e
|
90
|
+
errors += 1
|
91
|
+
Rails.logger.error("Failed to update activation key #{ak.name}: #{e.message}")
|
92
|
+
Rails.logger.debug e.backtrace.join("\n")
|
93
|
+
end
|
94
|
+
errors
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -6,7 +6,7 @@ module Katello
|
|
6
6
|
include ForemanTasks::Concerns::ActionSubject
|
7
7
|
|
8
8
|
module Overrides
|
9
|
-
def
|
9
|
+
def check_cve_attributes(attrs)
|
10
10
|
if attrs[:content_facet_attributes]
|
11
11
|
cv_id = attrs[:content_facet_attributes].delete(:content_view_id)
|
12
12
|
lce_id = attrs[:content_facet_attributes].delete(:lifecycle_environment_id)
|
@@ -17,6 +17,16 @@ module Katello
|
|
17
17
|
fail "content_view_id and lifecycle_environment_id must be provided together"
|
18
18
|
end
|
19
19
|
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def attributes=(attrs)
|
23
|
+
check_cve_attributes(attrs)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(attrs)
|
28
|
+
return super if self.content_facet.blank?
|
29
|
+
check_cve_attributes(attrs)
|
20
30
|
super
|
21
31
|
end
|
22
32
|
|
@@ -30,6 +40,28 @@ module Katello
|
|
30
40
|
inherited_attrs
|
31
41
|
end
|
32
42
|
|
43
|
+
def apply_inherited_attributes(attributes, initialized = true)
|
44
|
+
attributes = super(attributes, initialized)
|
45
|
+
facet_attrs = attributes['content_facet_attributes']
|
46
|
+
return attributes if facet_attrs.blank?
|
47
|
+
cv_id = facet_attrs['content_view_id']
|
48
|
+
lce_id = facet_attrs['lifecycle_environment_id']
|
49
|
+
if initialized && (cv_id.blank? || lce_id.blank?)
|
50
|
+
if cv_id.blank?
|
51
|
+
Rails.logger.info "Hostgroup has no content view assigned; using host's existing content view"
|
52
|
+
facet_attrs['content_view_id'] = content_facet&.single_content_view&.id
|
53
|
+
end
|
54
|
+
if lce_id.blank?
|
55
|
+
Rails.logger.info "Hostgroup has no lifecycle environment assigned; using host's existing lifecycle environment"
|
56
|
+
facet_attrs['lifecycle_environment_id'] = content_facet&.single_lifecycle_environment&.id
|
57
|
+
end
|
58
|
+
attributes['content_facet_attributes'] = facet_attrs
|
59
|
+
else
|
60
|
+
Rails.logger.info "Hostgroup has content view and lifecycle environment assigned; using those"
|
61
|
+
end
|
62
|
+
attributes
|
63
|
+
end
|
64
|
+
|
33
65
|
def smart_proxy_ids
|
34
66
|
ids = super
|
35
67
|
ids << content_source_id
|
@@ -652,12 +652,16 @@ module Katello
|
|
652
652
|
end
|
653
653
|
|
654
654
|
def check_orphaned_content_facets!(environments: [])
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
655
|
+
Location.no_taxonomy_scope do
|
656
|
+
User.as_anonymous_admin do
|
657
|
+
::Katello::Host::ContentFacet.in_content_views_and_environments(
|
658
|
+
content_views: [self],
|
659
|
+
lifecycle_environments: environments
|
660
|
+
).each do |facet|
|
661
|
+
unless facet.host
|
662
|
+
fail _("Orphaned content facets for deleted hosts exist for the content view and environment. Please run rake task : katello:clean_orphaned_facets and try again!")
|
663
|
+
end
|
664
|
+
end
|
661
665
|
end
|
662
666
|
end
|
663
667
|
end
|
@@ -298,19 +298,26 @@ module Katello
|
|
298
298
|
end
|
299
299
|
|
300
300
|
def katello_agent_installed?
|
301
|
-
self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => 'katello-agent').any?
|
301
|
+
self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => 'katello-agent').any? ||
|
302
|
+
self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => 'katello-agent').any?
|
302
303
|
end
|
303
304
|
|
304
305
|
def tracer_installed?
|
305
306
|
self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => [ "python-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
|
306
307
|
"python3-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
|
307
|
-
HOST_TOOLS_TRACER_PACKAGE_NAME ]).any?
|
308
|
+
HOST_TOOLS_TRACER_PACKAGE_NAME ]).any? ||
|
309
|
+
self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => [ "python-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
|
310
|
+
"python3-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
|
311
|
+
HOST_TOOLS_TRACER_PACKAGE_NAME ]).any?
|
308
312
|
end
|
309
313
|
|
310
314
|
def host_tools_installed?
|
311
315
|
host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => [ "python-#{HOST_TOOLS_PACKAGE_NAME}",
|
312
316
|
"python3-#{HOST_TOOLS_PACKAGE_NAME}",
|
313
|
-
HOST_TOOLS_PACKAGE_NAME ]).any?
|
317
|
+
HOST_TOOLS_PACKAGE_NAME ]).any? ||
|
318
|
+
host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => [ "python-#{HOST_TOOLS_PACKAGE_NAME}",
|
319
|
+
"python3-#{HOST_TOOLS_PACKAGE_NAME}",
|
320
|
+
HOST_TOOLS_PACKAGE_NAME ]).any?
|
314
321
|
end
|
315
322
|
|
316
323
|
def update_errata_status
|
@@ -15,6 +15,10 @@ module Katello
|
|
15
15
|
where(:product_id => Product.redhat.select(:id))
|
16
16
|
}
|
17
17
|
|
18
|
+
scope :custom, -> {
|
19
|
+
where.not(:product_id => Product.redhat.select(:id))
|
20
|
+
}
|
21
|
+
|
18
22
|
scoped_search :on => :name, :relation => :content
|
19
23
|
scoped_search :relation => :product, :on => :name, :rename => :product
|
20
24
|
scoped_search :on => :content_type, :relation => :content, :complete_value => true
|
@@ -37,9 +41,39 @@ module Katello
|
|
37
41
|
where(:product_id => Katello::PoolProduct.where(:pool_id => organization.pools).select(:product_id))
|
38
42
|
end
|
39
43
|
|
40
|
-
# used by Katello::Api::V2::RepositorySetsController#index
|
44
|
+
# following 4 methods used by Katello::Api::V2::RepositorySetsController#index
|
41
45
|
def repositories
|
42
46
|
Katello::Repository.in_default_view.where(:root_id => product.root_repositories.has_url.where(:content_id => content.cp_content_id))
|
43
47
|
end
|
48
|
+
|
49
|
+
def unfiltered_repositories
|
50
|
+
# don't filter by url, as we want to show all repos in the product
|
51
|
+
Katello::Repository.in_default_view.where(:root_id => product.root_repositories.where(:content_id => content.cp_content_id))
|
52
|
+
end
|
53
|
+
|
54
|
+
def arch
|
55
|
+
unfiltered_repositories.first&.arch
|
56
|
+
end
|
57
|
+
|
58
|
+
def os_versions
|
59
|
+
unfiltered_repositories.first&.os_versions || []
|
60
|
+
end
|
61
|
+
|
62
|
+
def enabled_value_from_candlepin
|
63
|
+
cp_product = ::Katello::Resources::Candlepin::Product.get(product.organization.label, product.cp_id).first
|
64
|
+
cp_content = cp_product['productContent'].find { |pc| pc['content']['id'] == content.cp_content_id }
|
65
|
+
cp_content['enabled']
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_enabled_from_candlepin!
|
69
|
+
new_value = enabled_value_from_candlepin
|
70
|
+
if self.enabled != new_value
|
71
|
+
Rails.logger.info "Setting enabled to #{new_value} for Candlepin content #{content.cp_content_id}, ProductContent #{self.id}"
|
72
|
+
self.update!(:enabled => new_value)
|
73
|
+
else
|
74
|
+
Rails.logger.info "No change in enabled value for Candlepin content #{content.cp_content_id}, ProductContent #{self.id}"
|
75
|
+
false
|
76
|
+
end
|
77
|
+
end
|
44
78
|
end
|
45
79
|
end
|
@@ -33,6 +33,10 @@ module Katello
|
|
33
33
|
consumable.organization.enabled_product_content_for(roots)
|
34
34
|
end
|
35
35
|
|
36
|
+
def custom_content_labels
|
37
|
+
product_content.custom.map { |pc| pc.product.root_repositories.map(&:custom_content_label) }.flatten.uniq
|
38
|
+
end
|
39
|
+
|
36
40
|
def self.wrap_with_overrides(product_contents:, overrides:, status: nil)
|
37
41
|
pc_with_overrides = product_contents.map { |pc| ProductContentPresenter.new(pc, overrides) }
|
38
42
|
if status
|
@@ -38,11 +38,11 @@ child @resource.repositories => :repositories do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
node :archRestricted do |pc|
|
41
|
-
pc.
|
41
|
+
pc.arch
|
42
42
|
end
|
43
43
|
|
44
44
|
node :osRestricted do |pc|
|
45
|
-
pc.
|
45
|
+
pc.os_versions&.first
|
46
46
|
end
|
47
47
|
|
48
48
|
node :override do |pc|
|
@@ -1,19 +1,23 @@
|
|
1
1
|
class UpdateDisconnectedSettings < ActiveRecord::Migration[6.0]
|
2
|
+
class FakeSetting < Katello::Model
|
3
|
+
self.table_name = 'settings'
|
4
|
+
end
|
5
|
+
|
2
6
|
def up
|
3
|
-
setting_disconnected =
|
7
|
+
setting_disconnected = FakeSetting.find_by(name: 'content_disconnected')
|
4
8
|
setting = Setting.find_by(name: 'subscription_connection_enabled')
|
5
9
|
|
6
10
|
setting&.update!(
|
7
11
|
value: !setting_disconnected&.value
|
8
12
|
)
|
9
|
-
|
13
|
+
FakeSetting.where(:name => 'content_disconnected').delete_all
|
10
14
|
end
|
11
15
|
|
12
16
|
def down
|
13
17
|
remove_column :katello_cdn_configurations, :airgapped
|
14
18
|
setting_disconnected = Setting.find_by(name: 'subscription_connection_enabled')
|
15
|
-
|
16
|
-
|
19
|
+
FakeSetting.set('content_disconnected', N_("A server operating in disconnected mode does not communicate with the Red Hat CDN."),
|
20
|
+
!setting_disconnected.value, N_('Disconnected mode'))
|
17
21
|
|
18
22
|
Setting.where(:name => 'subscription_connection_enabled').delete_all
|
19
23
|
end
|
@@ -2,7 +2,7 @@ class EnsureRepoUsernamePasswordNilNotBlank < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
::Katello::Repository.library.each do |repo|
|
4
4
|
if repo.upstream_username == '' && repo.upstream_password == ''
|
5
|
-
repo.update(upstream_username: nil, upstream_password: nil)
|
5
|
+
repo.root.update(upstream_username: nil, upstream_password: nil)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/lib/katello/version.rb
CHANGED
@@ -49,8 +49,8 @@ import {
|
|
49
49
|
const moduleStreamSupported = ({ os, version }) =>
|
50
50
|
os.match(/RedHat|RHEL|CentOS|Rocky|AlmaLinux|OracleLinux/i) && Number(version) > 7;
|
51
51
|
export const hideModuleStreamsTab = ({ hostDetails }) => {
|
52
|
-
const osMatch = hostDetails?.operatingsystem_name?.match(/(\
|
53
|
-
if (!osMatch) return
|
52
|
+
const osMatch = hostDetails?.operatingsystem_name?.match(/(\D+) (\d+)/);
|
53
|
+
if (!osMatch) return false;
|
54
54
|
const [, os, version] = osMatch;
|
55
55
|
return !(osMatch && moduleStreamSupported({ os, version }));
|
56
56
|
};
|
@@ -137,7 +137,7 @@ export default ({
|
|
137
137
|
selectRPMPackagesComparison(state, versionOneId, versionTwoId, viewBy),
|
138
138
|
statusSelector: state =>
|
139
139
|
selectRPMPackagesComparisonStatus(state, versionOneId, versionTwoId, viewBy),
|
140
|
-
autocompleteEndpoint: 'katello/api/v2/packages',
|
140
|
+
autocompleteEndpoint: '/katello/api/v2/packages',
|
141
141
|
bookmarkController: 'katello_content_view_components',
|
142
142
|
fetchItems: params => getRPMPackagesComparison(
|
143
143
|
versionOneId,
|
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.8.
|
4
|
+
version: 4.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- N/A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,14 +86,20 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 7.2.1
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 8.0.0
|
90
93
|
type: :runtime
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
97
|
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
99
|
+
version: 7.2.1
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 8.0.0
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: foreman_remote_execution
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -923,6 +929,7 @@ files:
|
|
923
929
|
- app/lib/actions/katello/organization/manifest_refresh.rb
|
924
930
|
- app/lib/actions/katello/organization/simple_content_access/disable.rb
|
925
931
|
- app/lib/actions/katello/organization/simple_content_access/enable.rb
|
932
|
+
- app/lib/actions/katello/organization/simple_content_access/prepare_content_overrides.rb
|
926
933
|
- app/lib/actions/katello/organization/simple_content_access/toggle.rb
|
927
934
|
- app/lib/actions/katello/orphan_cleanup/remove_orphans.rb
|
928
935
|
- app/lib/actions/katello/product/content_create.rb
|
@@ -1141,6 +1148,7 @@ files:
|
|
1141
1148
|
- app/lib/katello/resources/registry.rb
|
1142
1149
|
- app/lib/katello/util/candlepin_repository_checker.rb
|
1143
1150
|
- app/lib/katello/util/cdn_var_substitutor.rb
|
1151
|
+
- app/lib/katello/util/content_overrides_migrator.rb
|
1144
1152
|
- app/lib/katello/util/data.rb
|
1145
1153
|
- app/lib/katello/util/deduplication_migrator.rb
|
1146
1154
|
- app/lib/katello/util/docker_manifest_clause_generator.rb
|