katello 4.7.1 → 4.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8fd9bf94317048633ae54a2cf106cc08d6248b531e3da56bc68fb43fe5f018e
4
- data.tar.gz: 76539311bac6cda0b3cceec6b5d6bdf5407ad5c836807df5f35a48f5a5395212
3
+ metadata.gz: caf8ccd185806f397ab47aff3a18c1419e93ae534a597bdf08467f865690c2d4
4
+ data.tar.gz: c19cceba74ca69d6b839f9c0b6f1de58853c8d3b36103f0c002a17873c9d8da3
5
5
  SHA512:
6
- metadata.gz: 8de554bb59b8f31e882f41926695708f1b92107c1da3a6479aaad00f6abe3f4477d3ce010af4f6ee846796ffb7c7782cbe4df545f52caee7ce93cb24e7f8cefd
7
- data.tar.gz: 6835bc877ac980afa81cd3166812972c0d8caac75407f670d55f8537027aab8b2f9f9e69351835ac54373a7d10f80090e02384ea9d61381b5d2eb37598a3406b
6
+ metadata.gz: f1df0d7b2063005b81247f8a0038893753927855909583f19a10510c50c8c68cd22aba87d1b2629d74875b764fef70322b4d978c0b8fe4d4299d55601217e86b
7
+ data.tar.gz: bd9f1f8a869ef9a1307dcaf306b649a128f1833b03f8af9f722b40c4c82c59a2165669c06d534fe34077af8b684297a6891c46d62cab8ebf8b836a7534c7b514
@@ -341,6 +341,7 @@ module Katello
341
341
  end
342
342
 
343
343
  def validate_release_version
344
+ @organization ||= find_organization
344
345
  if params[:release_version].present? && !@organization.library.available_releases.include?(params[:release_version])
345
346
  fail HttpErrors::BadRequest, _("Invalid release version: [%s]") % params[:release_version]
346
347
  end
@@ -1,7 +1,6 @@
1
1
  module Katello
2
2
  class Api::V2::SimpleContentAccessController < Api::V2::ApiController
3
3
  before_action :find_organization
4
- before_action :check_upstream_connection
5
4
 
6
5
  resource_description do
7
6
  description "Red Hat subscriptions management platform."
@@ -11,7 +10,8 @@ module Katello
11
10
  api :GET, "/organizations/:organization_id/simple_content_access/eligible",
12
11
  N_("Check if the specified organization is eligible for Simple Content Access")
13
12
  def eligible
14
- eligible = @organization.upstream_consumer.simple_content_access_eligible?
13
+ ::Foreman::Deprecation.api_deprecation_warning("This endpoint is deprecated and will be removed in a future release. All organizations are now eligible for Simple Content Access.")
14
+ eligible = @organization.simple_content_access_eligible?
15
15
  render json: { simple_content_access_eligible: eligible }
16
16
  end
17
17
 
@@ -9,6 +9,7 @@ module Actions
9
9
  action_subject root.library_instance
10
10
 
11
11
  repo_params[:url] = nil if repo_params[:url] == ''
12
+ repo_params[:checksum_type] = nil if repo_params[:download_policy] == ::Katello::RootRepository::DOWNLOAD_ON_DEMAND
12
13
  update_cv_cert_protected = repo_params.key?(:unprotected) && (repo_params[:unprotected] != repository.unprotected)
13
14
  create_acs = create_acs?(repository.url, repo_params[:url])
14
15
  delete_acs = delete_acs?(repository.url, repo_params[:url])
@@ -90,6 +90,10 @@ module Katello
90
90
  self.providers.anonymous.first
91
91
  end
92
92
 
93
+ def simple_content_access_eligible?
94
+ self.content_access_mode_list.include?('org_environment')
95
+ end
96
+
93
97
  def manifest_imported?(cached: false)
94
98
  Rails.cache.fetch("#{self.label}_manifest_imported?", expires_in: 1.minute, force: !cached) do
95
99
  owner_details['upstreamConsumer'].present?
@@ -238,10 +242,6 @@ module Katello
238
242
  # doesn't provide much benefit for the frustration it creates.
239
243
  self.save(validate: false)
240
244
  end
241
-
242
- def upstream_consumer
243
- Katello::Candlepin::UpstreamConsumer.new(self)
244
- end
245
245
  end
246
246
  end
247
247
  end
@@ -45,6 +45,10 @@ module Katello
45
45
  self.owner_details['contentAccessMode']
46
46
  end
47
47
 
48
+ def content_access_mode_list
49
+ self.owner_details['contentAccessModeList'].split(',')
50
+ end
51
+
48
52
  def simple_content_access?(cached: true)
49
53
  Rails.cache.fetch("#{self.label}_simple_content_access?", expires_in: 1.minute, force: !cached) do
50
54
  content_access_mode == "org_environment"
@@ -30,22 +30,25 @@ module Katello
30
30
  end
31
31
 
32
32
  def self.insert_child_associations(units, pulp_id_to_id)
33
- tag_names = units.map { |unit| unit['tags'].map { |tag| tag[:name] } }.flatten
34
- tag_rows = tag_names.map { |name| {name: name } }
35
- Katello::AnsibleTag.insert_all(tag_rows, unique_by: [:name]) if tag_rows.any?
36
-
33
+ insert_tags units
37
34
  collection_tag_rows = []
38
35
  units.each do |unit|
39
36
  katello_id = pulp_id_to_id[unit['pulp_href']]
40
37
  #delete old tags
41
- unit_tags = unit['tags'].map { |tag| tag[:name] }
38
+ unit_tags = unit['tags']&.map { |tag| tag[:name] }
42
39
  Katello::AnsibleCollectionTag.where(:ansible_collection_id => katello_id).where.not(:ansible_tag_id => Katello::AnsibleTag.where(:name => unit_tags)).delete_all
43
- collection_tag_rows += Katello::AnsibleTag.where(:name => unit_tags).pluck(:id).map { |tag_id| {ansible_collection_id: katello_id, ansible_tag_id: tag_id} }
40
+ collection_tag_rows += Katello::AnsibleTag.where(:name => unit_tags)&.pluck(:id)&.map { |tag_id| {ansible_collection_id: katello_id, ansible_tag_id: tag_id} }
44
41
  end
45
42
 
46
43
  collection_tag_rows.flatten!
47
44
  Katello::AnsibleCollectionTag.insert_all(collection_tag_rows, unique_by: [:ansible_collection_id, :ansible_tag_id]) unless collection_tag_rows.empty?
48
45
  end
46
+
47
+ def self.insert_tags(units)
48
+ tag_names = units.map { |unit| unit['tags']&.map { |tag| tag[:name] } }&.flatten
49
+ tag_rows = tag_names&.compact&.map { |name| {name: name } }
50
+ Katello::AnsibleTag.insert_all(tag_rows, unique_by: [:name]) if tag_rows.any?
51
+ end
49
52
  end
50
53
  end
51
54
  end
@@ -385,6 +385,8 @@ module Katello
385
385
  remote_options[:download_concurrency] = root.download_concurrency unless root.download_concurrency.blank?
386
386
  remote_options.merge!(username: root&.upstream_username,
387
387
  password: root&.upstream_password)
388
+ remote_options[:username] = nil if remote_options[:username] == ''
389
+ remote_options[:password] = nil if remote_options[:password] == ''
388
390
  remote_options.merge!(ssl_remote_options)
389
391
  end
390
392
 
@@ -26,7 +26,7 @@ module Katello
26
26
  api = repo_type.pulp3_api(smart_proxy)
27
27
  version_hrefs = api.repository_versions
28
28
  orphan_version_hrefs = api.list_all.collect do |pulp_repo|
29
- mirror_repo_versions = api.versions_list_for_repository(pulp_repo.pulp_href, ordering: :_created)
29
+ mirror_repo_versions = api.versions_list_for_repository(pulp_repo.pulp_href, ordering: ['-pulp_created'])
30
30
  version_hrefs = mirror_repo_versions.select { |repo_version| repo_version.number != 0 }.collect { |version| version.pulp_href }
31
31
 
32
32
  version_hrefs - [pulp_repo.latest_version_href]
@@ -104,7 +104,7 @@ module Katello
104
104
 
105
105
  remotes.each do |remote|
106
106
  if !repo_names.include?(remote.name) && !acs_remotes.include?(remote.pulp_href)
107
- tasks << api.delete_remote(href: remote.pulp_href)
107
+ tasks << api.delete_remote(remote.pulp_href)
108
108
  end
109
109
  end
110
110
  end
@@ -0,0 +1,9 @@
1
+ class EnsureRepoUsernamePasswordNilNotBlank < ActiveRecord::Migration[6.1]
2
+ def change
3
+ ::Katello::Repository.library.each do |repo|
4
+ if repo.upstream_username == '' && repo.upstream_password == ''
5
+ repo.update(upstream_username: nil, upstream_password: nil)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -21,17 +21,17 @@
21
21
  angular.module('Bastion').value('simpleContentAccessEnabled', <%= Organization.current.simple_content_access? if Organization.current %>);
22
22
  angular.module('Bastion').value('isManifestImported', <%= !!Organization.current&.manifest_imported?(cached: true) %>)
23
23
  angular.module('Bastion').value('foreman', tfm);
24
- angular.module('Bastion').value('repositoryTypes', angular.fromJson('<%= Katello::RepositoryTypeManager.enabled_repository_types.values.to_json.html_safe %>'));
25
- angular.module('Bastion').value('deleteHostOnUnregister', angular.fromJson('<%= Setting[:unregister_delete_host] %>'));
26
- angular.module('Bastion').value('globalContentProxy', angular.fromJson('<%= Setting[:content_default_http_proxy].empty? ? nil.to_json : Setting[:content_default_http_proxy].to_json.html_safe %>'));
24
+ angular.module('Bastion').value('repositoryTypes', angular.fromJson(`<%= Katello::RepositoryTypeManager.enabled_repository_types.values.to_json.html_safe %>`));
25
+ angular.module('Bastion').value('deleteHostOnUnregister', angular.fromJson(`<%= Setting[:unregister_delete_host] %>`));
26
+ angular.module('Bastion').value('globalContentProxy', angular.fromJson(`<%= Setting[:content_default_http_proxy].empty? ? nil.to_json : Setting[:content_default_http_proxy].to_json.html_safe %>`));
27
27
  angular.module('Bastion').value('entriesPerPage', "<%= Setting[:entries_per_page] %>");
28
28
  angular.module('Bastion').value('contentViewSolveDependencies', "<%= Setting[:content_view_solve_dependencies] %>");
29
- angular.module('Bastion').constant('BastionConfig', angular.fromJson('<%= Bastion.config.to_json.html_safe %>'));
29
+ angular.module('Bastion').constant('BastionConfig', angular.fromJson(`<%= Bastion.config.to_json.html_safe %>`));
30
30
  angular.module('Bastion.auth').value('CurrentUser', {
31
31
  id: <%= User.current.id %>,
32
32
  admin: <%= User.current.admin || User.current.usergroups.any? { |group| group.admin } %>
33
33
  });
34
- angular.module('Bastion.auth').value('Permissions', angular.fromJson('<%= User.current.cached_roles.collect { |role| role.permissions }.flatten.to_json.html_safe %>'));
34
+ angular.module('Bastion.auth').value('Permissions', angular.fromJson(`<%= User.current.cached_roles.collect { |role| role.permissions }.flatten.to_json.html_safe %>`));
35
35
  angular.module('Bastion').value('newHostDetailsUI', "<%= Setting[:host_details_ui] %>");
36
36
  </script>
37
37
  <% Bastion.plugins.each do |name, plugin| %>
@@ -30,6 +30,7 @@ angular.module('Bastion.repositories').controller('RepositoryDetailsInfoControll
30
30
  $scope.repository['ignore_srpms'] = $scope.repository['ignorable_content'] && $scope.repository['ignorable_content'].includes("srpm");
31
31
  $scope.repository['ansible_collection_auth_exists'] = $scope.repository['ansible_collection_auth_url'] && $scope.repository['ansible_collection_auth_token'];
32
32
  $scope.genericContentTypes = RepositoryTypesService.genericContentTypes($scope.repository['content_type']);
33
+ $scope.immediateDownloadPolicy = $scope.repository['download_policy'] === 'immediate';
33
34
  });
34
35
 
35
36
  $scope.gpgKeys = function () {
@@ -140,6 +141,7 @@ angular.module('Bastion.repositories').controller('RepositoryDetailsInfoControll
140
141
  repository.os_versions = $scope.osVersionsParam();
141
142
  repository.$update(function (response) {
142
143
  deferred.resolve(response);
144
+ $scope.immediateDownloadPolicy = repository['download_policy'] === 'immediate';
143
145
  $scope.repository.ignore_srpms = $scope.repository.ignorable_content && $scope.repository.ignorable_content.includes("srpm");
144
146
  if (!_.isEmpty(response["include_tags"])) {
145
147
  repository.commaIncludeTags = repository["include_tags"].join(", ");
@@ -315,6 +315,13 @@
315
315
  options-format="id as name for (id, name) in options"
316
316
  on-save="save(repository)">
317
317
  </dd>
318
+ <dd>
319
+ <p bst-alert='info' ng-show="immediateDownloadPolicy && repository.download_policy == 'on_demand'">
320
+ <span translate>
321
+ Changing download policy to "On Demand" will also clear the checksum type if set. The repository will use the upstream checksum type to verify downloads.
322
+ </span>
323
+ </p>
324
+ </dd>
318
325
  </span>
319
326
  <span>
320
327
  <dt translate>Mirroring Policy</dt>
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "4.7.1".freeze
2
+ VERSION = "4.7.2".freeze
3
3
  end
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.7.1
4
+ version: 4.7.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-01-23 00:00:00.000000000 Z
11
+ date: 2023-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1485,7 +1485,6 @@ files:
1485
1485
  - app/services/katello/candlepin/message_handler.rb
1486
1486
  - app/services/katello/candlepin/pool_service.rb
1487
1487
  - app/services/katello/candlepin/system_purpose.rb
1488
- - app/services/katello/candlepin/upstream_consumer.rb
1489
1488
  - app/services/katello/candlepin_event_listener.rb
1490
1489
  - app/services/katello/component_view_presenter.rb
1491
1490
  - app/services/katello/content_unit_indexer.rb
@@ -2235,6 +2234,7 @@ files:
2235
2234
  - db/migrate/20220920173656_add_http_proxy_to_smart_proxy.rb
2236
2235
  - db/migrate/20220920180858_remove_http_proxy_from_katello_alternate_content_sources.rb
2237
2236
  - db/migrate/20221206170122_update_ignore_srpm_to_false_for_mirror_complete.rb
2237
+ - db/migrate/20230119003859_ensure_repo_username_password_nil_not_blank.rb
2238
2238
  - db/seeds.d/101-locations.rb
2239
2239
  - db/seeds.d/102-organizations.rb
2240
2240
  - db/seeds.d/104-proxy.rb
@@ -1,28 +0,0 @@
1
- module Katello
2
- module Candlepin
3
- class UpstreamConsumer
4
- def initialize(organization)
5
- @organization = organization
6
- end
7
-
8
- def simple_content_access_eligible?
9
- eligible = true
10
- ::Organization.as_org(@organization) do
11
- content_modes = resource_class.content_access
12
-
13
- if content_modes.key?(:contentAccessModeList)
14
- eligible = content_modes[:contentAccessModeList].include?('org_environment')
15
- end
16
- end
17
-
18
- eligible
19
- end
20
-
21
- private
22
-
23
- def resource_class
24
- Katello::Resources::Candlepin::UpstreamConsumer
25
- end
26
- end
27
- end
28
- end