katello 3.12.0.rc1 → 3.12.0.rc2

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: de90074d2a8e2705d398aa2eb12738fe464db7c9c2faf3290756ff5f65dca379
4
- data.tar.gz: 366d93dcaea3017282c693fced4b10199af8722e5b12ec849bb45fdbfe272bd3
3
+ metadata.gz: d0a559345d7e312acbfda66d5aabecce6e5660d1b483939c8bcc7d5aa997c080
4
+ data.tar.gz: 877fa0b949c590d3264b4d9504a03572d6831d0debdd83f968320d39c3c13bde
5
5
  SHA512:
6
- metadata.gz: 7ec11a64c64efdcfa27c3eb0cf5326e3fb6e7dd60bf82d394dea14b3c82da3ba2cbf3f642cd529cb1e041955b379a4aa9bb3ca469ea7986065a00a6f349529ce
7
- data.tar.gz: 0cd6d05e64ba6ffc5f10dc3c34a7877dc9ca4128d5055605eef98bdecb2d7ecff818d75275d000d8e8d882b249d17b8ed0ab97beebc1cb26ed671f8d8ce2d820
6
+ metadata.gz: f4b0220844a897184e3c24a8e95216500842aa73388a5207cd396f02a91a0e08fb1fc2b4084eae2f1c3acbc4ccccafb626fc319c430d80d3243a1077cee29c99
7
+ data.tar.gz: 6f1187da5a113f91e04acb2c25334923bd2db31f97bc106bd8e5668fe8511def1ddf5acb827cc362603c1045f6393a2bd217917642d150af5fe7b78f305965f8
@@ -48,9 +48,9 @@ module Katello
48
48
  .preload(:subscription_facet, :host_statuses, :operatingsystem,
49
49
  :applicable_rpms, :lifecycle_environment, :content_view)
50
50
  csv_response(@hosts,
51
- [:name, :subscription_status_label, 'applicable_errata.security.size',
52
- 'applicable_errata.bugfix.size', 'applicable_errata.enhancement.size',
53
- 'applicable_rpms.size', :operatingsystem, :lifecycle_environment, :content_view,
51
+ [:name, :subscription_status_label, 'content_facet.installable_security_errata_count',
52
+ 'content_facet.installable_bugfix_errata_count', 'content_facet.installable_enhancement_errata_count',
53
+ 'content_facet.upgradable_rpm_count', :operatingsystem, :lifecycle_environment, :content_view,
54
54
  'subscription_facet.registered_at', 'subscription_facet.last_checkin'],
55
55
  ['Name', 'Subscription Status', 'Installable Updates - Security',
56
56
  'Installable Updates - Bug Fixes', 'Installable Updates - Enhancements',
@@ -43,6 +43,12 @@ module Actions
43
43
  end
44
44
 
45
45
  def finalize
46
+ # update errata applicability counts for all hosts in the CV & LE
47
+ ::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
48
+ :lifecycle_environment_id => input[:environment_id]).each do |facet|
49
+ facet.update_applicability_counts
50
+ end
51
+
46
52
  history = ::Katello::ContentViewHistory.find(input[:history_id])
47
53
  history.status = ::Katello::ContentViewHistory::SUCCESSFUL
48
54
  history.save!
@@ -107,6 +107,12 @@ module Actions
107
107
  end
108
108
 
109
109
  def finalize
110
+ # update errata applicability counts for all hosts in the CV & Library
111
+ ::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
112
+ :lifecycle_environment_id => input[:environment_id]).each do |facet|
113
+ facet.update_applicability_counts
114
+ end
115
+
110
116
  history = ::Katello::ContentViewHistory.find(input[:history_id])
111
117
  history.status = ::Katello::ContentViewHistory::SUCCESSFUL
112
118
  history.save!
@@ -21,6 +21,7 @@ module Katello
21
21
  rescue_from Errors::UnsupportedActionException, :with => :rescue_from_unsupported_action_exception
22
22
  rescue_from Errors::MaxHostsReachedException, :with => :rescue_from_max_hosts_reached_exception
23
23
  rescue_from Errors::CdnSubstitutionError, :with => :rescue_from_bad_data
24
+ rescue_from Errors::RegistrationError, :with => :rescue_from_bad_data
24
25
  rescue_from ActionController::ParameterMissing, :with => :rescue_from_missing_param
25
26
  end
26
27
 
@@ -41,14 +41,20 @@ module Katello
41
41
  # rubocop:disable Metrics/MethodLength
42
42
  def load_errata_applications(filter_errata_type: 'all', include_last_reboot: 'yes', since: nil, up_to: nil, status: nil)
43
43
  result = []
44
+
44
45
  search_up_to = up_to.present? ? "ended_at < \"#{up_to}\"" : nil
45
46
  search_since = since.present? ? "ended_at > \"#{since}\"" : nil
46
47
  search_result = status.present? ? "result = #{status}" : nil
47
-
48
48
  search = [search_up_to, search_since, search_result].compact.join(' and ')
49
49
 
50
+ if Katello.with_remote_execution?
51
+ condition = ["state != 'stoppped' AND (label = 'Actions::RemoteExecution::RunHostJob' AND templates.id = ?) OR label = 'Actions::Katello::Host::Erratum::Install'", RemoteExecutionFeature.feature('katello_errata_install').job_template_id]
52
+ else
53
+ condition = "state != 'stoppped' AND label = 'Actions::Katello::Host::Erratum::Install'"
54
+ end
55
+
50
56
  tasks = load_resource(klass: ForemanTasks::Task,
51
- where: ["state != 'stoppped' AND (label = 'Actions::RemoteExecution::RunHostJob' AND templates.id = ?) OR label = 'Actions::Katello::Host::Erratum::Install'", RemoteExecutionFeature.feature('katello_errata_install').job_template_id],
57
+ where: condition,
52
58
  permission: 'view_tasks',
53
59
  joins: 'LEFT OUTER JOIN template_invocations ON foreman_tasks_tasks.id = template_invocations.run_host_job_task_id LEFT OUTER JOIN templates ON template_invocations.template_id = templates.id',
54
60
  select: 'foreman_tasks_tasks.*,template_invocations.id AS template_invocation_id',
@@ -8,6 +8,8 @@ module Katello
8
8
 
9
9
  class NotFound < StandardError; end
10
10
 
11
+ class RegistrationError < StandardError; end
12
+
11
13
  # unauthorized access
12
14
  class SecurityViolation < StandardError; end
13
15
 
@@ -244,31 +244,30 @@ module Katello
244
244
 
245
245
  def self.find_host(facts, organization)
246
246
  host_name = propose_existing_hostname(facts)
247
+ host_uuid = facts['dmi.system.uuid']
247
248
  uuid_fact_id = RhsmFactName.find_by(name: 'dmi::system::uuid')&.id || -1
249
+
248
250
  hosts = ::Host.unscoped.distinct.left_outer_joins(:fact_values)
249
251
  .where("#{::Host.table_name}.name = ? OR (#{FactValue.table_name}.fact_name_id = ?
250
- AND #{FactValue.table_name}.value = ?)", host_name, uuid_fact_id, facts['dmi.system.uuid'])
252
+ AND #{FactValue.table_name}.value = ?)", host_name, uuid_fact_id, host_uuid)
253
+
254
+ return if hosts.empty?
251
255
 
252
- return nil if hosts.empty?
256
+ hosts = hosts.where(organization_id: [organization.id, nil])
257
+ hosts_size = hosts.size
253
258
 
254
- if hosts.where("organization_id = #{organization.id} OR organization_id is NULL").empty? #not in the correct org
259
+ if hosts_size == 0 # not in the correct org
255
260
  #TODO: http://projects.theforeman.org/issues/11532
256
- fail _("Host with name %{host_name} is currently registered to a different org, please migrate host to %{org_name}.") %
261
+ fail Katello::Errors::RegistrationError, _("Host with name %{host_name} is currently registered to a different org, please migrate host to %{org_name}.") %
257
262
  {:org_name => organization.name, :host_name => host_name }
258
263
  end
259
264
 
260
- if hosts.size > 1
261
- hostnames = hosts.pluck(:name).sort
262
- fail _("Multiple profiles found. Consider removing %s which match this host.") % hostnames.join(', ')
263
- end
264
-
265
- # check for hosts that were matched by dmi.system.uuid but whose name didn't match
266
- if hosts.where(name: host_name).empty?
267
- fail _("The host %{existing} matches this registration. Remove or rename it to %{new_host} before registering.") %
268
- {existing: hosts.pluck(:name).first, new_host: host_name}
265
+ if hosts_size == 1 && hosts.joins(:subscription_facet).empty?
266
+ return hosts.first
269
267
  end
270
268
 
271
- hosts.first
269
+ hostnames = hosts.pluck(:name).sort.join(', ')
270
+ fail Katello::Errors::RegistrationError, _("Please unregister or remove hosts which match this host before registering: %{existing}") % {existing: hostnames}
272
271
  end
273
272
 
274
273
  def self.sanitize_name(name)
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.12.0.rc1".freeze
2
+ VERSION = "3.12.0.rc2".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.12.0.rc1
4
+ version: 3.12.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -4353,7 +4353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
4353
4353
  version: 1.3.1
4354
4354
  requirements: []
4355
4355
  rubyforge_project:
4356
- rubygems_version: 2.7.6
4356
+ rubygems_version: 2.7.6.2
4357
4357
  signing_key:
4358
4358
  specification_version: 4
4359
4359
  summary: Content and Subscription Management plugin for Foreman