katello 4.8.1 → 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.

Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +1 -1
  3. data/app/lib/actions/katello/host/update_content_view.rb +4 -2
  4. data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
  5. data/app/lib/katello/resources/cdn/katello_cdn.rb +8 -4
  6. data/app/lib/katello/util/content_overrides_migrator.rb +2 -2
  7. data/app/models/katello/concerns/host_managed_extensions.rb +33 -1
  8. data/app/models/katello/product_content.rb +35 -1
  9. data/app/services/katello/product_content_finder.rb +4 -0
  10. data/app/views/katello/api/v2/repository_sets/show.json.rabl +2 -2
  11. data/lib/katello/version.rb +1 -1
  12. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +1 -1
  13. metadata +2 -25
  14. data/locale/bn/LC_MESSAGES/katello.mo +0 -0
  15. data/locale/cs/LC_MESSAGES/katello.mo +0 -0
  16. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  17. data/locale/en/LC_MESSAGES/katello.mo +0 -0
  18. data/locale/es/LC_MESSAGES/katello.mo +0 -0
  19. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  20. data/locale/gu/LC_MESSAGES/katello.mo +0 -0
  21. data/locale/hi/LC_MESSAGES/katello.mo +0 -0
  22. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  23. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  24. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  25. data/locale/kn/LC_MESSAGES/katello.mo +0 -0
  26. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  27. data/locale/mr/LC_MESSAGES/katello.mo +0 -0
  28. data/locale/or/LC_MESSAGES/katello.mo +0 -0
  29. data/locale/pa/LC_MESSAGES/katello.mo +0 -0
  30. data/locale/pt/LC_MESSAGES/katello.mo +0 -0
  31. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  32. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  33. data/locale/ta/LC_MESSAGES/katello.mo +0 -0
  34. data/locale/te/LC_MESSAGES/katello.mo +0 -0
  35. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  36. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81c709207089041832e6dd1b447a01d0d40dc228480d4b4e43b536c853242662
4
- data.tar.gz: 94ec8c4161ff3f63d2a48d4be430b5942b7a40684c4bc39a6c734597ed9f39bf
3
+ metadata.gz: 50dbc6ac50280ac62f64e850e0d16444abed94953b491ac51db4530e8e377edb
4
+ data.tar.gz: e5d4e0fb485fcbdfd73d56c3f7e1d9952bdec57110447c683d55c2e81784a0f1
5
5
  SHA512:
6
- metadata.gz: 1923b0ae05a6bb6c92b7b807793ce795e4ed90a26e598124a0441b49cb30270ec4829eb0ae0a95944de20bb4db5366b9219ac247667e194b8de88c6a7a933e82
7
- data.tar.gz: 062cd9f6c371824bbe22b4b686735eba4ac0ee5ebd316fe4e06fa74b942e58da6f891ef6c3d5ed92158e9d32878bfc533574419b63836d4f4078a3b85eca54bb
6
+ metadata.gz: 56f172e039b743a27fddb7af888d01bfd42699da833b1afddeea3ea5d44b96abf38870d1fcc95481c538725974ccf343bfef35230a51ba916352054d9f0f8eee
7
+ data.tar.gz: 7ac8d7121b1d41d28417ed65904cb29444935f429c02d285766a8ada60c2f76d29f4015291045c583e4729c7ac5d9839a5d6bec50beaae06d09c7dcff2461ccc
@@ -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 params[:host] && params[:host][:content_facet_attributes]
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}"
@@ -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.content_view = ::Katello::ContentView.find(content_view_id)
8
- host.content_facet.lifecycle_environment = ::Katello::KTEnvironment.find(lifecycle_environment_id)
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
@@ -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)).first.nvra
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 fetch_paths(content_path)
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
- repo_set = JSON.parse(response)['results'].first
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[:arch],
37
- releasever: repo[:minor],
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
@@ -12,11 +12,11 @@ module Katello
12
12
  ak_errors = create_disabled_overrides_for_non_sca_org_activation_keys(organization: @organization)
13
13
 
14
14
  total_errors = host_errors + ak_errors
15
- finish_message = "Finished creating overrides in non-SCA orgs; #{total_errors == 0 ? "no errors" : "#{pluralize(total_errors, "error")}"}"
15
+ finish_message = "Finished creating overrides in non-SCA org; #{total_errors == 0 ? "no errors" : "#{pluralize(total_errors, "error")}"}"
16
16
  messages = { result: finish_message, errors: total_errors }
17
17
  messages[:host_errors] = "Hosts - #{pluralize(host_errors, "error")} creating disabled overrides for unsubscribed content; see log messages above" if host_errors > 0
18
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] = "You may now switch all organizations to Simple Content Access mode without any change in access to content." if total_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
20
  Rails.logger.info finish_message
21
21
  Rails.logger.info messages[:host_errors] if messages[:host_errors]
22
22
  Rails.logger.info messages[:ak_errors] if messages[:ak_errors]
@@ -6,7 +6,7 @@ module Katello
6
6
  include ForemanTasks::Concerns::ActionSubject
7
7
 
8
8
  module Overrides
9
- def update(attrs)
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
@@ -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.repositories&.first&.arch
41
+ pc.arch
42
42
  end
43
43
 
44
44
  node :osRestricted do |pc|
45
- pc.repositories&.first&.os_versions&.first
45
+ pc.os_versions&.first
46
46
  end
47
47
 
48
48
  node :override do |pc|
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "4.8.1".freeze
2
+ VERSION = "4.8.2".freeze
3
3
  end
@@ -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.1
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-05-25 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -4434,53 +4434,30 @@ files:
4434
4434
  - locale/Makefile
4435
4435
  - locale/README
4436
4436
  - locale/action_names.rb
4437
- - locale/bn/LC_MESSAGES/katello.mo
4438
4437
  - locale/bn/katello.po
4439
- - locale/cs/LC_MESSAGES/katello.mo
4440
4438
  - locale/cs/katello.po
4441
- - locale/de/LC_MESSAGES/katello.mo
4442
4439
  - locale/de/katello.po
4443
- - locale/en/LC_MESSAGES/katello.mo
4444
4440
  - locale/en/katello.po
4445
- - locale/es/LC_MESSAGES/katello.mo
4446
4441
  - locale/es/katello.po
4447
- - locale/fr/LC_MESSAGES/katello.mo
4448
4442
  - locale/fr/katello.po
4449
- - locale/gu/LC_MESSAGES/katello.mo
4450
4443
  - locale/gu/katello.po
4451
- - locale/hi/LC_MESSAGES/katello.mo
4452
4444
  - locale/hi/katello.po
4453
- - locale/it/LC_MESSAGES/katello.mo
4454
4445
  - locale/it/katello.po
4455
- - locale/ja/LC_MESSAGES/katello.mo
4456
4446
  - locale/ja/katello.po
4457
- - locale/ka/LC_MESSAGES/katello.mo
4458
4447
  - locale/ka/katello.po
4459
4448
  - locale/katello.pot
4460
- - locale/kn/LC_MESSAGES/katello.mo
4461
4449
  - locale/kn/katello.po
4462
- - locale/ko/LC_MESSAGES/katello.mo
4463
4450
  - locale/ko/katello.po
4464
- - locale/mr/LC_MESSAGES/katello.mo
4465
4451
  - locale/mr/katello.po
4466
- - locale/or/LC_MESSAGES/katello.mo
4467
4452
  - locale/or/katello.po
4468
- - locale/pa/LC_MESSAGES/katello.mo
4469
4453
  - locale/pa/katello.po
4470
- - locale/pt/LC_MESSAGES/katello.mo
4471
4454
  - locale/pt/katello.po
4472
- - locale/pt_BR/LC_MESSAGES/katello.mo
4473
4455
  - locale/pt_BR/katello.po
4474
- - locale/ru/LC_MESSAGES/katello.mo
4475
4456
  - locale/ru/katello.po
4476
- - locale/ta/LC_MESSAGES/katello.mo
4477
4457
  - locale/ta/katello.po
4478
- - locale/te/LC_MESSAGES/katello.mo
4479
4458
  - locale/te/katello.po
4480
4459
  - locale/update-i18n
4481
- - locale/zh_CN/LC_MESSAGES/katello.mo
4482
4460
  - locale/zh_CN/katello.po
4483
- - locale/zh_TW/LC_MESSAGES/katello.mo
4484
4461
  - locale/zh_TW/katello.po
4485
4462
  - package.json
4486
4463
  - vendor/assets/images/katello/add2.png
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file