katello 3.14.0.rc1 → 3.14.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.

Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/containers/container.js +5 -5
  3. data/app/assets/javascripts/katello/hosts/activation_key_edit.js +1 -1
  4. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +1 -1
  5. data/app/assets/javascripts/katello/sync_management/sync_management.js +6 -6
  6. data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
  7. data/app/lib/actions/katello/content_view/publish.rb +13 -4
  8. data/app/lib/actions/katello/content_view_puppet_environment/destroy.rb +3 -1
  9. data/app/lib/actions/katello/content_view_version/create_repos.rb +25 -0
  10. data/app/lib/actions/katello/content_view_version/incremental_update.rb +32 -12
  11. data/app/lib/actions/katello/environment/destroy.rb +5 -1
  12. data/app/lib/actions/katello/host/hypervisors_update.rb +12 -1
  13. data/app/lib/actions/katello/repository/clone_to_version.rb +3 -11
  14. data/app/lib/actions/pulp/repository/copy_units.rb +3 -6
  15. data/app/lib/actions/pulp/repository/refresh.rb +1 -1
  16. data/app/lib/actions/pulp/repository/sync.rb +3 -1
  17. data/app/lib/katello/resources/candlepin.rb +6 -0
  18. data/app/lib/katello/resources/candlepin/admin.rb +21 -0
  19. data/app/lib/katello/util/package_clause_generator.rb +10 -0
  20. data/app/lib/katello/util/support.rb +19 -0
  21. data/app/models/katello/glue/pulp/repo.rb +0 -13
  22. data/app/models/katello/host/subscription_facet.rb +2 -1
  23. data/app/models/katello/kt_environment.rb +1 -0
  24. data/app/models/katello/ping.rb +35 -3
  25. data/app/models/katello/repository.rb +5 -2
  26. data/app/models/katello/rhsm_fact_parser.rb +6 -1
  27. data/app/models/katello/root_repository.rb +1 -1
  28. data/app/services/katello/candlepin/consumer.rb +2 -1
  29. data/app/{lib/actions/candlepin/import_pool_handler.rb → services/katello/candlepin/event_handler.rb} +2 -2
  30. data/app/services/katello/candlepin_event_listener.rb +106 -0
  31. data/app/services/katello/candlepin_listening_service.rb +91 -0
  32. data/app/services/katello/event_daemon.rb +91 -0
  33. data/app/services/katello/event_monitor/poller_thread.rb +108 -0
  34. data/app/services/katello/event_queue.rb +4 -0
  35. data/app/services/katello/pulp/repository.rb +13 -6
  36. data/app/services/katello/pulp/repository/yum.rb +52 -12
  37. data/lib/katello/engine.rb +13 -14
  38. data/lib/katello/middleware/event_daemon.rb +14 -0
  39. data/lib/katello/plugin.rb +2 -0
  40. data/lib/katello/tasks/upgrade_check.rake +2 -7
  41. data/lib/katello/version.rb +1 -1
  42. data/locale/bn/katello.po +1 -1
  43. data/locale/cs/katello.po +1 -1
  44. data/locale/de/katello.po +2 -2
  45. data/locale/en/katello.po +1 -1
  46. data/locale/es/katello.po +2 -2
  47. data/locale/fr/katello.po +2 -2
  48. data/locale/gu/katello.po +1 -1
  49. data/locale/hi/katello.po +1 -1
  50. data/locale/it/katello.po +2 -2
  51. data/locale/ja/katello.po +2 -2
  52. data/locale/katello.pot +1 -1
  53. data/locale/kn/katello.po +1 -1
  54. data/locale/ko/katello.po +2 -2
  55. data/locale/mr/katello.po +1 -1
  56. data/locale/or/katello.po +1 -1
  57. data/locale/pa/katello.po +1 -1
  58. data/locale/pt/katello.po +1 -1
  59. data/locale/pt_BR/katello.po +2 -2
  60. data/locale/ru/katello.po +2 -2
  61. data/locale/ta/katello.po +1 -1
  62. data/locale/te/katello.po +1 -1
  63. data/locale/zh_CN/katello.po +2 -2
  64. data/locale/zh_TW/katello.po +2 -2
  65. data/webpack/components/Content/Details/__tests__/__snapshots__/ContentDetails.test.js.snap +2 -2
  66. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -2
  67. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +3 -3
  68. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +2 -2
  69. data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +6 -0
  70. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +1 -1
  71. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.fixtures.js +1 -1
  72. metadata +11 -10
  73. data/app/lib/actions/candlepin/candlepin_listening_service.rb +0 -114
  74. data/app/lib/actions/candlepin/listen_on_candlepin_events.rb +0 -216
  75. data/app/lib/actions/katello/event_queue/monitor.rb +0 -122
  76. data/app/lib/actions/katello/event_queue/poller_thread.rb +0 -83
  77. data/app/lib/actions/katello/event_queue/suspended_action.rb +0 -23
@@ -0,0 +1,91 @@
1
+ module Katello
2
+ class EventDaemon
3
+ class << self
4
+ def initialize
5
+ FileUtils.touch(lock_file)
6
+ @cache = ActiveSupport::Cache::MemoryStore.new
7
+ end
8
+
9
+ def settings
10
+ SETTINGS[:katello][:event_daemon]
11
+ end
12
+
13
+ def pid
14
+ return unless pid_file && File.exist?(pid_file)
15
+
16
+ File.open(pid_file) { |f| f.read.to_i }
17
+ end
18
+
19
+ def pid_file
20
+ pid_dir.join('katello_event_daemon.pid')
21
+ end
22
+
23
+ def pid_dir
24
+ Rails.root.join('tmp', 'pids')
25
+ end
26
+
27
+ def lock_file
28
+ Rails.root.join('tmp', 'katello_event_daemon.lock')
29
+ end
30
+
31
+ def write_pid_file
32
+ return unless pid_file
33
+
34
+ FileUtils.mkdir_p(pid_dir)
35
+ File.open(pid_file, 'w') { |f| f.puts Process.pid }
36
+ end
37
+
38
+ def stop
39
+ return unless pid == Process.pid
40
+ services.values.each(&:close)
41
+ File.unlink(pid_file) if pid_file && File.exist?(pid_file)
42
+ end
43
+
44
+ def start
45
+ return unless runnable?
46
+
47
+ lockfile = File.open(lock_file, 'r')
48
+ begin
49
+ lockfile.flock(File::LOCK_EX)
50
+ return if started? # ensure it wasn't started while we waited for the lock
51
+
52
+ start_services
53
+ write_pid_file
54
+
55
+ at_exit do
56
+ stop
57
+ end
58
+
59
+ Rails.logger.info("Katello event daemon started process=#{Process.pid}")
60
+ ensure
61
+ lockfile.flock(File::LOCK_UN)
62
+ end
63
+ end
64
+
65
+ def started?
66
+ Process.kill(0, pid)
67
+ true
68
+ rescue Errno::ESRCH, TypeError # process no longer exists or we had no PID cached
69
+ false
70
+ end
71
+
72
+ def start_services
73
+ services.values.each(&:run)
74
+ end
75
+
76
+ def runnable?
77
+ # avoid accessing the disk on each request
78
+ @cache.fetch('katello_event_daemon_runnable', expires_in: 1.minute) do
79
+ !started? && settings[:enabled] && !::Foreman.in_rake? && !Rails.env.test?
80
+ end
81
+ end
82
+
83
+ def services
84
+ {
85
+ candlepin_events: ::Katello::CandlepinEventListener,
86
+ katello_events: ::Katello::EventMonitor::PollerThread
87
+ }
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,108 @@
1
+ module Katello
2
+ module EventMonitor
3
+ class PollerThread
4
+ SLEEP_INTERVAL = 3
5
+ PROCESSED_COUNT_CACHE_KEY = 'katello_events_processed'.freeze
6
+ FAILED_COUNT_CACHE_KEY = 'katello_events_failed'.freeze
7
+
8
+ cattr_accessor :instance
9
+
10
+ def self.initialize(logger = nil)
11
+ self.instance ||= self.new(logger)
12
+ end
13
+
14
+ def self.close
15
+ if self.instance
16
+ self.instance.close
17
+ self.instance = nil
18
+ end
19
+ reset_status
20
+ end
21
+
22
+ def self.run
23
+ initialize
24
+ ::Katello::EventQueue.reset_in_progress
25
+ instance.poll_for_events
26
+ end
27
+
28
+ def self.status
29
+ {
30
+ processed_count: Rails.cache.fetch(PROCESSED_COUNT_CACHE_KEY) { 0 },
31
+ failed_count: Rails.cache.fetch(FAILED_COUNT_CACHE_KEY) { 0 },
32
+ queue_depth: Katello::EventQueue.queue_depth
33
+ }
34
+ end
35
+
36
+ def self.reset_status
37
+ Rails.cache.write(PROCESSED_COUNT_CACHE_KEY, 0)
38
+ Rails.cache.write(FAILED_COUNT_CACHE_KEY, 0)
39
+ end
40
+
41
+ def initialize(logger = nil)
42
+ @logger = logger || ::Foreman::Logging.logger('katello/katello_events')
43
+ @failed_count = 0
44
+ @processed_count = 0
45
+ end
46
+
47
+ def close
48
+ @logger.info("Stopping Katello Event Monitor")
49
+ @thread.kill if @thread
50
+ end
51
+
52
+ def run_event(event)
53
+ @logger.debug("event_queue_event: type=#{event.event_type}, object_id=#{event.object_id}")
54
+
55
+ event_instance = nil
56
+ begin
57
+ ::User.as_anonymous_admin do
58
+ event_instance = ::Katello::EventQueue.create_instance(event)
59
+ event_instance.run
60
+ end
61
+ rescue => e
62
+ @failed_count += 1
63
+ Rails.cache.write(FAILED_COUNT_CACHE_KEY, @failed_count, expires_in: 24.hours)
64
+
65
+ @logger.error("event_queue_error: type=#{event.event_type}, object_id=#{event.object_id}")
66
+ @logger.error(e.message)
67
+ @logger.error(e.backtrace.join("\n"))
68
+ ensure
69
+ if event_instance.try(:retry)
70
+ result = ::Katello::EventQueue.reschedule_event(event)
71
+ if result == :expired
72
+ @logger.warn("event_queue_event_expired: type=#{event.event_type} object_id=#{event.object_id}")
73
+ elsif !result.nil?
74
+ @logger.warn("event_queue_rescheduled: type=#{event.event_type} object_id=#{event.object_id}")
75
+ end
76
+ end
77
+ ::Katello::EventQueue.clear_events(event.event_type, event.object_id, event.created_at)
78
+ end
79
+ end
80
+
81
+ def poll_for_events
82
+ @thread.kill if @thread
83
+ @thread = Thread.new do
84
+ begin
85
+ @logger.info("Polling Katello Event Queue")
86
+ loop do
87
+ Rails.application.executor.wrap do
88
+ Katello::Util::Support.with_db_connection(@logger) do
89
+ until (event = ::Katello::EventQueue.next_event).nil?
90
+ run_event(event)
91
+ @processed_count += 1
92
+ Rails.cache.write(PROCESSED_COUNT_CACHE_KEY, @processed_count, expires_in: 24.hours)
93
+ end
94
+ end
95
+ end
96
+
97
+ sleep SLEEP_INTERVAL
98
+ end
99
+ rescue => e
100
+ @logger.error(e.message)
101
+ @logger.error("Fatal error in Katello Event Monitor")
102
+ self.class.close
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -12,6 +12,10 @@ module Katello
12
12
  end
13
13
  end
14
14
 
15
+ def self.queue_depth
16
+ ::Katello::Event.all.size
17
+ end
18
+
15
19
  def self.runnable_events
16
20
  Katello::Event.where(process_after: nil).or(Katello::Event.where(process_after: Date.new..Time.zone.now))
17
21
  end
@@ -11,8 +11,10 @@ module Katello
11
11
  end
12
12
 
13
13
  def backend_data(force = false)
14
- return smart_proxy.pulp_api.extensions.repository.retrieve_with_details(repo.pulp_id) if (repo.pulp_id && force)
15
- @backend_data ||= smart_proxy.pulp_api.extensions.repository.retrieve_with_details(repo.pulp_id) if repo.pulp_id
14
+ if (repo.pulp_id && (force || @backend_data.nil?))
15
+ @backend_data = smart_proxy.pulp_api.extensions.repository.retrieve_with_details(repo.pulp_id)
16
+ end
17
+ @backend_data
16
18
  rescue RestClient::ResourceNotFound
17
19
  nil
18
20
  end
@@ -84,6 +86,10 @@ module Katello
84
86
  end
85
87
 
86
88
  def mirror_needs_updates?
89
+ needs_update?
90
+ end
91
+
92
+ def needs_update?
87
93
  needs_importer_updates? || needs_distributor_updates?
88
94
  end
89
95
 
@@ -195,8 +201,8 @@ module Katello
195
201
  distributor['id']
196
202
  end
197
203
 
198
- def proxy_host_importer_value
199
- root.ignore_global_proxy ? "" : nil
204
+ def refresh_if_needed
205
+ refresh if needs_update?
200
206
  end
201
207
 
202
208
  def refresh
@@ -259,10 +265,11 @@ module Katello
259
265
  tasks
260
266
  end
261
267
 
262
- def copy_units(destination_repo, units, override_config = {})
268
+ def copy_units(destination_repo, units, incremental_update: false)
269
+ override_config = {}
270
+ override_config = build_override_config(destination_repo, incremental_update: incremental_update) if respond_to? :build_override_config
263
271
  content_type = units.first.class::CONTENT_TYPE
264
272
  unit_ids = units.pluck(:pulp_id)
265
-
266
273
  smart_proxy.pulp_api.extensions.send(content_type).copy(repo.pulp_id, destination_repo.pulp_id, ids: unit_ids, override_config: override_config)
267
274
  end
268
275
 
@@ -75,11 +75,45 @@ module Katello
75
75
  smart_proxy.pulp_api.extensions.repository.regenerate_applicability_by_ids([repo.pulp_id], true)
76
76
  end
77
77
 
78
- def copy_contents(destination_repo, options = {})
79
- override_config = Katello::Repository.build_override_config(options)
80
- rpm_copy_clauses, rpm_remove_clauses = generate_copy_clauses(options[:filters]&.yum(false), options[:rpm_filenames])
81
- tasks = [smart_proxy.pulp_api.extensions.rpm.copy(repo.pulp_id, destination_repo.pulp_id,
82
- rpm_copy_clauses.merge(:override_config => override_config))]
78
+ def generate_mapping(destination_repo)
79
+ source_repo_map = {}
80
+ repo.siblings.yum_type.each do |sibling|
81
+ key = sibling.library_instance? ? sibling.id : sibling.library_instance_id
82
+ source_repo_map[key] = sibling.pulp_id
83
+ end
84
+
85
+ Hash[destination_repo.siblings.yum_type.map { |sibling| [source_repo_map[sibling.library_instance_id], sibling.pulp_id] }]
86
+ end
87
+
88
+ def build_override_config(destination_repo, incremental_update: false,
89
+ solve_dependencies: false,
90
+ filters: [])
91
+ config = {}
92
+ if incremental_update ||
93
+ (filters.present? && solve_dependencies)
94
+ if Setting[:dependency_solving_algorithm] == 'greedy'
95
+ config[:recursive] = true
96
+ else
97
+ config[:recursive_conservative] = true
98
+ end
99
+ config[:additional_repos] = generate_mapping(destination_repo)
100
+ end
101
+ config
102
+ end
103
+
104
+ def copy_contents(destination_repo, filters: nil,
105
+ solve_dependencies: false,
106
+ rpm_filenames: [])
107
+ rpm_copy_clauses, rpm_remove_clauses = generate_copy_clauses(filters&.yum(false), rpm_filenames)
108
+ tasks = []
109
+ if rpm_copy_clauses
110
+ override_config = build_override_config(destination_repo,
111
+ filters: filters,
112
+ solve_dependencies: solve_dependencies)
113
+
114
+ tasks << smart_proxy.pulp_api.extensions.rpm.copy(repo.pulp_id, destination_repo.pulp_id,
115
+ rpm_copy_clauses.merge(:override_config => override_config))
116
+ end
83
117
 
84
118
  if rpm_remove_clauses
85
119
  tasks << smart_proxy.pulp_api.extensions.repository.unassociate_units(destination_repo.pulp_id,
@@ -87,7 +121,10 @@ module Katello
87
121
  filters: {unit: rpm_remove_clauses})
88
122
  end
89
123
 
90
- tasks.concat(copy_module_contents(destination_repo, options[:filters], override_config))
124
+ tasks.concat(copy_module_contents(destination_repo,
125
+ filters: filters,
126
+ solve_dependencies: solve_dependencies))
127
+
91
128
  [:srpm, :errata, :package_group, :package_environment,
92
129
  :yum_repo_metadata_file, :distribution, :module_default].each do |type|
93
130
  tasks << smart_proxy.pulp_api.extensions.send(type).copy(repo.pulp_id, destination_repo.pulp_id)
@@ -155,10 +192,12 @@ module Katello
155
192
  smart_proxy.pulp_api.extensions.repository.unassociate_units(repo.pulp_id, :filters => criteria)
156
193
  end
157
194
 
158
- def copy_module_contents(destination_repo, filters, override_config)
159
- if filters
160
- filters = filters.module_stream.or(filters.errata)
161
- end
195
+ def copy_module_contents(destination_repo, filters:, solve_dependencies:)
196
+ override_config = build_override_config(destination_repo,
197
+ filters: filters,
198
+ solve_dependencies: solve_dependencies)
199
+
200
+ filters = filters.module_stream.or(filters.errata) if filters
162
201
 
163
202
  copy_clauses, remove_clauses = generate_module_stream_copy_clauses(filters)
164
203
  tasks = [smart_proxy.pulp_api.extensions.module.copy(repo.pulp_id, destination_repo.pulp_id,
@@ -203,11 +242,12 @@ module Katello
203
242
  remove = clause_gen.remove_clause
204
243
  remove_clauses = {filters: {unit: remove}} if remove
205
244
  else
206
- copy_clauses = {filters: {unit: ContentViewPackageFilter.generate_rpm_clauses(::Katello::Rpm.in_repositories(repo).non_modular.pluck(:filename))}}
245
+ non_modular_rpms = ::Katello::Rpm.in_repositories(repo).non_modular.pluck(:filename)
246
+ copy_clauses = non_modular_rpms.blank? ? nil : {filters: {unit: ContentViewPackageFilter.generate_rpm_clauses(non_modular_rpms)}}
207
247
  remove_clauses = nil
208
248
  end
209
249
 
210
- copy_clauses.merge!(fields: ::Katello::Pulp::Rpm::PULP_SELECT_FIELDS)
250
+ copy_clauses.merge!(fields: ::Katello::Pulp::Rpm::PULP_SELECT_FIELDS) if copy_clauses
211
251
  [copy_clauses, remove_clauses]
212
252
  end
213
253
  end
@@ -4,13 +4,16 @@ module Katello
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace Katello
6
6
 
7
- initializer 'katello.selective_params_parser', :before => :build_middleware_stack do |app|
7
+ initializer 'katello.middleware', :before => :build_middleware_stack do |app|
8
8
  require 'katello/prevent_json_parsing'
9
9
  app.middleware.insert_after(
10
10
  Rack::MethodOverride,
11
11
  Katello::PreventJsonParsing,
12
12
  ->(env) { env['PATH_INFO'] =~ /consumers/ && env['PATH_INFO'] =~ /profile|packages/ }
13
13
  )
14
+
15
+ require 'katello/middleware/event_daemon'
16
+ app.middleware.use(Katello::Middleware::EventDaemon)
14
17
  end
15
18
 
16
19
  initializer 'katello.mount_engine', :before => :sooner_routes_load, :after => :build_middleware_stack do |app|
@@ -26,6 +29,9 @@ module Katello
26
29
  :redhat_repository_url => 'https://cdn.redhat.com',
27
30
  :consumer_cert_rpm => 'katello-ca-consumer-latest.noarch.rpm',
28
31
  :consumer_cert_sh => 'katello-rhsm-consumer',
32
+ :event_daemon => {
33
+ enabled: true
34
+ },
29
35
  :pulp => {
30
36
  :default_login => 'admin',
31
37
  :url => 'https://localhost/pulp/api/v2/',
@@ -85,15 +91,6 @@ module Katello
85
91
  end
86
92
  end
87
93
 
88
- initializer "katello.initialize_cp_listener", :before => :finisher_hook do
89
- unless Rails.env.test?
90
- ForemanTasks.dynflow.config.post_executor_init do |world|
91
- ::Actions::Candlepin::ListenOnCandlepinEvents.ensure_running(world)
92
- ::Actions::Katello::EventQueue::Monitor.ensure_running(world)
93
- end
94
- end
95
- end
96
-
97
94
  initializer "katello.load_app_instance_data" do |app|
98
95
  app.config.filter_parameters += [:_json] #package profile parameter
99
96
  Katello::Engine.paths['db/migrate'].existent.each do |path|
@@ -196,10 +193,6 @@ module Katello
196
193
  ::Api::V2::HostgroupsController.send :include, Katello::Concerns::Api::V2::HostgroupsControllerExtensions
197
194
  ::Api::V2::SmartProxiesController.send :include, Katello::Concerns::Api::V2::SmartProxiesControllerExtensions
198
195
 
199
- Katello::EventQueue.register_event(Katello::Events::ImportHostApplicability::EVENT_TYPE, Katello::Events::ImportHostApplicability)
200
- Katello::EventQueue.register_event(Katello::Events::ImportPool::EVENT_TYPE, Katello::Events::ImportPool)
201
- Katello::EventQueue.register_event(Katello::Events::AutoPublishCompositeView::EVENT_TYPE, Katello::Events::AutoPublishCompositeView)
202
-
203
196
  ::HostsController.class_eval do
204
197
  helper Katello::Concerns::HostsAndHostgroupsHelperExtensions
205
198
  end
@@ -212,6 +205,12 @@ module Katello
212
205
 
213
206
  load 'katello/repository_types.rb'
214
207
  load 'katello/scheduled_jobs.rb'
208
+
209
+ Katello::EventQueue.register_event(Katello::Events::ImportHostApplicability::EVENT_TYPE, Katello::Events::ImportHostApplicability)
210
+ Katello::EventQueue.register_event(Katello::Events::ImportPool::EVENT_TYPE, Katello::Events::ImportPool)
211
+ Katello::EventQueue.register_event(Katello::Events::AutoPublishCompositeView::EVENT_TYPE, Katello::Events::AutoPublishCompositeView)
212
+
213
+ Katello::EventDaemon.initialize
215
214
  end
216
215
 
217
216
  rake_tasks do
@@ -0,0 +1,14 @@
1
+ module Katello
2
+ module Middleware
3
+ class EventDaemon
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ Katello::EventDaemon.start
10
+ @app.call(env)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -236,6 +236,8 @@ Foreman::Plugin.register :katello do
236
236
  logger :action, :enabled => true
237
237
  logger :manifest_import_logger, :enabled => true
238
238
  logger :registry_proxy, :enabled => true
239
+ logger :katello_events, :enabled => true
240
+ logger :candlepin_events, :enabled => true
239
241
 
240
242
  widget 'errata_widget', :name => 'Latest Errata', :sizey => 1, :sizex => 6
241
243
  widget 'content_views_widget', :name => 'Content Views', :sizey => 1, :sizex => 6
@@ -1,18 +1,13 @@
1
1
  namespace :katello do
2
2
  task :upgrade_check => ['environment'] do
3
3
  desc "Task that can be run before upgrading Katello to check if system is upgrade ready"
4
- CP_LISTEN_ACTION = Actions::Candlepin::ListenOnCandlepinEvents.to_s
5
- EVENT_QUEUE_ACTION = Actions::Katello::EventQueue::Monitor.to_s
6
-
7
- success = "PASS"
8
- fail = "FAIL"
9
4
 
10
5
  puts "This script makes no modifications and can be re-run multiple times for the most up to date results."
11
6
  puts "Checking upgradeability...\n\n"
12
7
 
13
8
  # check for any running tasks
14
- task_count = ::ForemanTasks::Task.active.where("label NOT IN (?)", [CP_LISTEN_ACTION, EVENT_QUEUE_ACTION]).where("state != 'scheduled'").count
15
- task_status = task_count > 0 ? fail : success
9
+ task_count = ::ForemanTasks::Task.active.where("state != 'scheduled'").count
10
+ task_status = task_count > 0 ? "FAIL" : "SUCCESS"
16
11
  puts "Checking for running tasks..."
17
12
  puts "[#{task_status}] - There are #{task_count} active tasks. "
18
13
  if task_count > 0