katello 3.8.0 → 3.8.1

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
  SHA1:
3
- metadata.gz: 47586318c412278d01e596abf029eb1ac5daf00c
4
- data.tar.gz: c6b70b2b09c74778a46cd0e9956bf1dea2026e7b
3
+ metadata.gz: 93cb21818ee2cbe71bd6c1397c5bcb3e654be074
4
+ data.tar.gz: 1e38b306b83721ab0dbd4ccdf775a75086eb8b2f
5
5
  SHA512:
6
- metadata.gz: e34da099dcbe80e6719c48e0aaca5384612b1b12c4aa629f1a573ba1608e36a1526f215b154dcacebcb01bc4fec32bc266ea3017b771025e0a7dedbf6949f438
7
- data.tar.gz: b5a4629b88bb63be9fc35de61179d7db463b7dc5ee7d3c8c6b6f8a9bc0afe071c6529894612f3a3ecf338e28c3ea3da6d7e0484d66a79fff0d1566f920ddd445
6
+ metadata.gz: 7b963f48b6f230b4cd16b47863186afc3912be25fd40feb4527fb64cc72c09a9727081b50b3ab410a97baa0f02d1b34881422e1cd8c9f3395b17461456b7b467
7
+ data.tar.gz: b84f6c7e67ad83144190bb5c14e9373db5a327f2899eb49efc931d4f6fcfa7c6dc41ae0244b872fffda803bf93ae827cabe66479adb661c1f415f138403cac9f
@@ -19,8 +19,11 @@ module Katello
19
19
  prepend Overrides
20
20
 
21
21
  def destroy
22
- Katello::RegistrationManager.unregister_host(@host, :unregistering => false)
23
- process_success
22
+ if Katello::RegistrationManager.unregister_host(@host, :unregistering => false)
23
+ process_success(:success_redirect => hosts_path)
24
+ else
25
+ process_error :redirect => :back, :error_msg => _("Failed to delete %{host}: %{errors}") % { :host => @host, :errors => @host.errors.full_messages }
26
+ end
24
27
  rescue StandardError => ex
25
28
  process_error(:object => @host, :error_msg => ex.message, :redirect => saved_redirect_url_or(send("#{controller_name}_url")))
26
29
  end
@@ -1,10 +1,8 @@
1
1
  class CreatePulpDiskSpaceNotifications < ApplicationJob
2
- after_perform do
3
- self.class.set(:wait => 12.hours).perform_later
4
- end
5
-
6
2
  def perform
7
3
  Katello::UINotifications::Pulp::ProxyDiskSpace.deliver!
4
+ ensure
5
+ self.class.set(:wait => 12.hours).perform_later
8
6
  end
9
7
 
10
8
  def humanized_name
@@ -1,10 +1,8 @@
1
1
  class SendExpireSoonNotifications < ApplicationJob
2
- after_perform do
3
- self.class.set(:wait => 12.hours).perform_later
4
- end
5
-
6
2
  def perform
7
3
  Katello::UINotifications::Subscriptions::ExpireSoon.deliver!
4
+ ensure
5
+ self.class.set(:wait => 12.hours).perform_later
8
6
  end
9
7
 
10
8
  def humanized_name
@@ -16,18 +16,20 @@ module Actions
16
16
  end
17
17
 
18
18
  def finalize
19
- environment = ::Katello::KTEnvironment.find(input[:environment_id])
20
- content_view = ::Katello::ContentView.find(input[:content_view_id])
21
- repository = ::Katello::Repository.find(input[:repository_id]) if input[:repository_id]
19
+ User.as_anonymous_admin do
20
+ environment = ::Katello::KTEnvironment.find(input[:environment_id])
21
+ content_view = ::Katello::ContentView.find(input[:content_view_id])
22
+ repository = ::Katello::Repository.find(input[:repository_id]) if input[:repository_id]
22
23
 
23
- if content_view.default? && repository
24
- if repository.distribution_bootable?
25
- os = Redhat.find_or_create_operating_system(repository)
26
- arch = Architecture.where(:name => repository.distribution_arch).first_or_create!
27
- os.architectures << arch unless os.architectures.include?(arch)
24
+ if content_view.default? && repository
25
+ if repository.distribution_bootable?
26
+ os = Redhat.find_or_create_operating_system(repository)
27
+ arch = Architecture.where(:name => repository.distribution_arch).first_or_create!
28
+ os.architectures << arch unless os.architectures.include?(arch)
29
+ end
30
+ else
31
+ ::Katello::Foreman.update_puppet_environment(content_view, environment)
28
32
  end
29
- else
30
- ::Katello::Foreman.update_puppet_environment(content_view, environment)
31
33
  end
32
34
  end
33
35
  end
@@ -9,10 +9,10 @@ module Actions
9
9
  def finalize
10
10
  ::User.current = ::User.anonymous_admin
11
11
  repo = ::Katello::Repository.find(input[:repo_id])
12
- found_checksum = repo.pulp_checksum_type
13
12
 
14
- if found_checksum && repo.checksum_type != found_checksum
15
- repo.checksum_type = found_checksum
13
+ if repo.pulp_scratchpad_checksum_type &&
14
+ repo.pulp_scratchpad_checksum_type != repo.source_repo_checksum_type
15
+ repo.source_repo_checksum_type = repo.pulp_scratchpad_checksum_type
16
16
  repo.save!
17
17
  end
18
18
  ensure
@@ -50,7 +50,7 @@ module Katello
50
50
  scoped_search :on => :hypervisor, :relation => :subscription_facet, :complete_value => true
51
51
  scoped_search :on => :name, :relation => :hypervisor_host, :complete_value => true, :rename => :hypervisor_host, :ext_method => :find_by_hypervisor_host
52
52
  scoped_search :on => :name, :relation => :subscriptions, :rename => :subscription_name, :complete_value => true, :ext_method => :find_by_subscription_name
53
- scoped_search :on => :id, :relation => :pools, :rename => :subscription_id, :complete_value => true, :ext_method => :find_by_subscription_id
53
+ scoped_search :on => :id, :relation => :pools, :rename => :subscription_id, :complete_value => true, :ext_method => :find_by_subscription_id, :only_explicit => true
54
54
  end
55
55
 
56
56
  module ClassMethods
@@ -126,8 +126,8 @@ module Katello
126
126
  pulp_repo_facts.merge(as_json).merge(:sync_state => sync_state)
127
127
  end
128
128
 
129
- def pulp_checksum_type
130
- find_distributor['config']['checksum_type'] if self.try(:yum?) && find_distributor
129
+ def pulp_scratchpad_checksum_type
130
+ pulp_repo_facts&.dig('scratchpad', 'checksum_type')
131
131
  end
132
132
 
133
133
  def pulp_counts_differ?
@@ -83,13 +83,14 @@ module Katello
83
83
  end
84
84
 
85
85
  def update_applicability_counts
86
- self.update_attributes!(
86
+ self.assign_attributes(
87
87
  :installable_security_errata_count => self.installable_errata.security.count,
88
88
  :installable_bugfix_errata_count => self.installable_errata.bugfix.count,
89
89
  :installable_enhancement_errata_count => self.installable_errata.enhancement.count,
90
90
  :applicable_rpm_count => self.content_facet_applicable_rpms.count,
91
91
  :upgradable_rpm_count => self.installable_rpms.count
92
92
  )
93
+ self.save!(:validate => false)
93
94
  end
94
95
 
95
96
  def import_rpm_applicability(partial)
@@ -253,6 +253,10 @@ module Katello
253
253
  content_view_version && content_view_version.default_content_view?
254
254
  end
255
255
 
256
+ def on_demand?
257
+ download_policy == Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND
258
+ end
259
+
256
260
  def self.in_environments_products(env_ids, product_ids)
257
261
  in_environment(env_ids).in_product(product_ids)
258
262
  end
@@ -470,10 +474,10 @@ module Katello
470
474
  :content_id => self.content_id,
471
475
  :content_view_version => to_version,
472
476
  :content_type => self.content_type,
477
+ :checksum_type => checksum_type || source_repo_checksum_type,
473
478
  :docker_upstream_name => self.docker_upstream_name,
474
479
  :download_policy => download_policy,
475
480
  :unprotected => self.unprotected) do |clone|
476
- clone.checksum_type = self.checksum_type
477
481
  options = {
478
482
  :repository => self,
479
483
  :environment => to_env,
@@ -16,7 +16,7 @@ module Katello
16
16
  scoped_search :on => :release, :complete_value => true, :ext_method => :scoped_search_release
17
17
  scoped_search :on => :arch, :complete_value => true
18
18
  scoped_search :on => :epoch, :complete_value => true
19
- scoped_search :on => :evr, :ext_method => :scoped_search_evr
19
+ scoped_search :on => :evr, :ext_method => :scoped_search_evr, :only_explicit => true
20
20
  scoped_search :on => :filename, :complete_value => true
21
21
  scoped_search :on => :sourcerpm, :complete_value => true
22
22
  scoped_search :on => :checksum
@@ -1,5 +1,8 @@
1
1
  class AddForeignKeyToHypervisorId < ActiveRecord::Migration[5.1]
2
2
  def up
3
+ # Update all pools that have a hypervisor reference that's not a host before we add the FK
4
+ ::Katello::Pool.where.not(hypervisor_id: nil).where.not(hypervisor_id: Host::Managed.all).update_all(hypervisor_id: nil)
5
+
3
6
  add_foreign_key(:katello_pools, :hosts,
4
7
  :name => 'katello_pools_hypervisor_fk', :column => 'hypervisor_id')
5
8
  end
@@ -0,0 +1,5 @@
1
+ class AddSourceRepoChecksumTypeToKatelloRepositories < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :katello_repositories, :source_repo_checksum_type, :string
4
+ end
5
+ end
@@ -65,6 +65,7 @@ angular.module('Bastion.content-views').controller('ContentViewCompositeAvailabl
65
65
  components: components}, function () {
66
66
  var newContentIds = _.map(selectedRows, 'id');
67
67
  $scope.saveSuccess();
68
+ $scope.fetchContentView();
68
69
  params['without[]'] = params["without[]"].concat(newContentIds);
69
70
  nutupane.setParams(params);
70
71
  nutupane.refresh();
@@ -42,17 +42,17 @@ namespace :katello do
42
42
  def cleanup_hosts(cleaner)
43
43
  cleaner.hosts_with_nil_facets.each do |host|
44
44
  print "Host #{host.id} #{host.name} is partially missing subscription information. Un-registering\n"
45
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
45
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
46
46
  end
47
47
 
48
48
  cleaner.hosts_with_no_subscriptions.each do |host|
49
49
  print "Host #{host.id} #{host.name} #{host.subscription_facet.try(:uuid)} is partially missing subscription information. Un-registering\n"
50
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
50
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
51
51
  end
52
52
 
53
53
  cleaner.hosts_with_no_content.each do |host|
54
54
  print "Host #{host.id} #{host.name} #{host.content_facet.try(:uuid)} is partially missing content information. Un-registering\n"
55
- execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host) }
55
+ execute("Failed to delete host") { Katello::RegistrationManager.unregister_host(host, host_unregister_options(host)) }
56
56
  end
57
57
  end
58
58
 
@@ -72,6 +72,15 @@ namespace :katello do
72
72
  end
73
73
  end
74
74
 
75
+ def host_unregister_options(host)
76
+ if host.managed? || host.compute_resource
77
+ print "Leaving provisioning record for #{host.name} in place, it is either managed or assigned to a compute resource."
78
+ {:unregistering => true}
79
+ else
80
+ {}
81
+ end
82
+ end
83
+
75
84
  # rubocop:disable HandleExceptions
76
85
  def execute(error_msg)
77
86
  if ENV['COMMIT'] == 'true'
@@ -0,0 +1,32 @@
1
+ namespace :katello do
2
+ namespace :upgrades do
3
+ namespace '3.8' do
4
+ desc "Clear checksum type for on-demand repositories"
5
+ task :clear_checksum_type => %w(environment) do
6
+ User.current = User.anonymous_admin
7
+
8
+ Katello::Repository.yum_type.find_each do |repo|
9
+ repo.transaction do
10
+ begin
11
+ if repo.on_demand? && repo.url.present?
12
+ repo.update_attribute(:checksum_type, nil)
13
+
14
+ if repo.find_distributor[:config]&.delete(:checksum_type)
15
+ Katello.pulp_server.resources.repository.update_distributor(
16
+ repo.pulp_id, repo.find_distributor[:id], repo.find_distributor[:config])
17
+ end
18
+ end
19
+
20
+ if repo.library_instance?
21
+ repo.update_attributes!(
22
+ source_repo_checksum_type: repo.pulp_scratchpad_checksum_type)
23
+ end
24
+ # rubocop:disable HandleExceptions
25
+ rescue RestClient::ResourceNotFound
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.8.0".freeze
2
+ VERSION = "3.8.1".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: 3.8.0
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1568,6 +1568,7 @@ files:
1568
1568
  - db/migrate/20180614184822_add_unauthenticated_pull.rb
1569
1569
  - db/migrate/20180618195941_add_description_to_repository.rb
1570
1570
  - db/migrate/20180626160422_add_upstream_pool_id_to_katello_pool.rb
1571
+ - db/migrate/20180917173645_add_source_repo_checksum_type_to_katello_repositories.rb
1571
1572
  - db/seeds.d/101-locations.rb
1572
1573
  - db/seeds.d/102-organizations.rb
1573
1574
  - db/seeds.d/104-proxy.rb
@@ -2169,6 +2170,7 @@ files:
2169
2170
  - lib/katello/tasks/upgrades/3.6/republish_file_repos.rake
2170
2171
  - lib/katello/tasks/upgrades/3.7/import_pools.rake
2171
2172
  - lib/katello/tasks/upgrades/3.7/make_all_ks_repos_bootable.rake
2173
+ - lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
2172
2174
  - lib/katello/tasks/virt_who_report.rake
2173
2175
  - lib/katello/url_constrained_cookie_store.rb
2174
2176
  - lib/katello/version.rb