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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/katello/containers/container.js +5 -5
- data/app/assets/javascripts/katello/hosts/activation_key_edit.js +1 -1
- data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +1 -1
- data/app/assets/javascripts/katello/sync_management/sync_management.js +6 -6
- data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +13 -4
- data/app/lib/actions/katello/content_view_puppet_environment/destroy.rb +3 -1
- data/app/lib/actions/katello/content_view_version/create_repos.rb +25 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +32 -12
- data/app/lib/actions/katello/environment/destroy.rb +5 -1
- data/app/lib/actions/katello/host/hypervisors_update.rb +12 -1
- data/app/lib/actions/katello/repository/clone_to_version.rb +3 -11
- data/app/lib/actions/pulp/repository/copy_units.rb +3 -6
- data/app/lib/actions/pulp/repository/refresh.rb +1 -1
- data/app/lib/actions/pulp/repository/sync.rb +3 -1
- data/app/lib/katello/resources/candlepin.rb +6 -0
- data/app/lib/katello/resources/candlepin/admin.rb +21 -0
- data/app/lib/katello/util/package_clause_generator.rb +10 -0
- data/app/lib/katello/util/support.rb +19 -0
- data/app/models/katello/glue/pulp/repo.rb +0 -13
- data/app/models/katello/host/subscription_facet.rb +2 -1
- data/app/models/katello/kt_environment.rb +1 -0
- data/app/models/katello/ping.rb +35 -3
- data/app/models/katello/repository.rb +5 -2
- data/app/models/katello/rhsm_fact_parser.rb +6 -1
- data/app/models/katello/root_repository.rb +1 -1
- data/app/services/katello/candlepin/consumer.rb +2 -1
- data/app/{lib/actions/candlepin/import_pool_handler.rb → services/katello/candlepin/event_handler.rb} +2 -2
- data/app/services/katello/candlepin_event_listener.rb +106 -0
- data/app/services/katello/candlepin_listening_service.rb +91 -0
- data/app/services/katello/event_daemon.rb +91 -0
- data/app/services/katello/event_monitor/poller_thread.rb +108 -0
- data/app/services/katello/event_queue.rb +4 -0
- data/app/services/katello/pulp/repository.rb +13 -6
- data/app/services/katello/pulp/repository/yum.rb +52 -12
- data/lib/katello/engine.rb +13 -14
- data/lib/katello/middleware/event_daemon.rb +14 -0
- data/lib/katello/plugin.rb +2 -0
- data/lib/katello/tasks/upgrade_check.rake +2 -7
- data/lib/katello/version.rb +1 -1
- data/locale/bn/katello.po +1 -1
- data/locale/cs/katello.po +1 -1
- data/locale/de/katello.po +2 -2
- data/locale/en/katello.po +1 -1
- data/locale/es/katello.po +2 -2
- data/locale/fr/katello.po +2 -2
- data/locale/gu/katello.po +1 -1
- data/locale/hi/katello.po +1 -1
- data/locale/it/katello.po +2 -2
- data/locale/ja/katello.po +2 -2
- data/locale/katello.pot +1 -1
- data/locale/kn/katello.po +1 -1
- data/locale/ko/katello.po +2 -2
- data/locale/mr/katello.po +1 -1
- data/locale/or/katello.po +1 -1
- data/locale/pa/katello.po +1 -1
- data/locale/pt/katello.po +1 -1
- data/locale/pt_BR/katello.po +2 -2
- data/locale/ru/katello.po +2 -2
- data/locale/ta/katello.po +1 -1
- data/locale/te/katello.po +1 -1
- data/locale/zh_CN/katello.po +2 -2
- data/locale/zh_TW/katello.po +2 -2
- data/webpack/components/Content/Details/__tests__/__snapshots__/ContentDetails.test.js.snap +2 -2
- data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -2
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +3 -3
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +2 -2
- data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +6 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +1 -1
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.fixtures.js +1 -1
- metadata +11 -10
- data/app/lib/actions/candlepin/candlepin_listening_service.rb +0 -114
- data/app/lib/actions/candlepin/listen_on_candlepin_events.rb +0 -216
- data/app/lib/actions/katello/event_queue/monitor.rb +0 -122
- data/app/lib/actions/katello/event_queue/poller_thread.rb +0 -83
- data/app/lib/actions/katello/event_queue/suspended_action.rb +0 -23
@@ -1,216 +0,0 @@
|
|
1
|
-
#
|
2
|
-
module Actions
|
3
|
-
module Candlepin
|
4
|
-
class SuspendedAction
|
5
|
-
def initialize(suspended_action)
|
6
|
-
@suspended_action = suspended_action
|
7
|
-
end
|
8
|
-
|
9
|
-
def notify_message_received(id, subject, content)
|
10
|
-
@suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Event[id, subject, content]
|
11
|
-
end
|
12
|
-
|
13
|
-
def notify_fatal(error)
|
14
|
-
@suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Fatal[error.backtrace && error.backtrace.join('\n'), error.message, error.class.name]
|
15
|
-
end
|
16
|
-
|
17
|
-
def notify_connected
|
18
|
-
@suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Connected
|
19
|
-
end
|
20
|
-
|
21
|
-
def notify_not_connected(message)
|
22
|
-
ForemanTasks.dynflow.world.clock.ping(@suspended_action, 5, Actions::Candlepin::ListenOnCandlepinEvents::Reconnect[message])
|
23
|
-
end
|
24
|
-
|
25
|
-
def notify_finished
|
26
|
-
@suspended_action << Actions::Candlepin::ListenOnCandlepinEvents::Close
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class ListenOnCandlepinEvents < Actions::Base
|
31
|
-
include ::Dynflow::Action::Singleton
|
32
|
-
|
33
|
-
Connected = Algebrick.atom
|
34
|
-
|
35
|
-
Reconnect = Algebrick.type do
|
36
|
-
fields! message: String
|
37
|
-
end
|
38
|
-
|
39
|
-
Event = Algebrick.type do
|
40
|
-
fields! message_id: String, subject: String, content: String
|
41
|
-
end
|
42
|
-
|
43
|
-
Fatal = Algebrick.type do
|
44
|
-
fields! backtrace: String, message: String, kind: String
|
45
|
-
end
|
46
|
-
|
47
|
-
Close = Algebrick.atom
|
48
|
-
|
49
|
-
class << self
|
50
|
-
attr_reader :triggered_action
|
51
|
-
|
52
|
-
def ensure_running(world = ForemanTasks.dynflow.world)
|
53
|
-
unless self.singleton_locked?(world)
|
54
|
-
@triggered_action = ForemanTasks.trigger self
|
55
|
-
end
|
56
|
-
rescue Dynflow::Coordinator::LockError
|
57
|
-
return false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def plan
|
62
|
-
# Make sure we don't have two concurrent listening services competing
|
63
|
-
plan_self
|
64
|
-
end
|
65
|
-
|
66
|
-
def run(event = nil)
|
67
|
-
match(event,
|
68
|
-
(on nil do
|
69
|
-
# initialize the listening service
|
70
|
-
initialize_service
|
71
|
-
end),
|
72
|
-
(on Reconnect do
|
73
|
-
connect_listening_service(event)
|
74
|
-
end),
|
75
|
-
(on Connected do
|
76
|
-
poll_listening_service(event)
|
77
|
-
end),
|
78
|
-
(on Event do
|
79
|
-
# react on the event, probably calling ForemanTasks.async_task
|
80
|
-
act_on_event(event)
|
81
|
-
end),
|
82
|
-
(on Close | Dynflow::Action::Cancellable::Cancel do
|
83
|
-
# we finished with the listening serivce
|
84
|
-
close_service
|
85
|
-
end),
|
86
|
-
(on Fatal do
|
87
|
-
close_service_with_error(event)
|
88
|
-
end),
|
89
|
-
(on Dynflow::Action::Skip do
|
90
|
-
# do nothing, just skip
|
91
|
-
end))
|
92
|
-
rescue => e
|
93
|
-
action_logger.error(e.message)
|
94
|
-
close_service
|
95
|
-
error!(e)
|
96
|
-
end
|
97
|
-
|
98
|
-
def close_service_with_error(event)
|
99
|
-
error = Exception.new("#{event.kind}: #{event.message}")
|
100
|
-
error.set_backtrace([event.backtrace])
|
101
|
-
error!(error)
|
102
|
-
ensure
|
103
|
-
close_service
|
104
|
-
end
|
105
|
-
|
106
|
-
def connect_listening_service(event)
|
107
|
-
CandlepinListeningService.instance.close
|
108
|
-
output[:error] = event.message
|
109
|
-
|
110
|
-
suspend do |suspended_action|
|
111
|
-
CandlepinListeningService.instance.start(SuspendedAction.new(suspended_action))
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def poll_listening_service(_event)
|
116
|
-
output[:connection] = "Connected"
|
117
|
-
output[:error] = nil
|
118
|
-
suspend do |suspended_action|
|
119
|
-
CandlepinListeningService.instance.poll_for_messages(SuspendedAction.new(suspended_action))
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def initialize_service
|
124
|
-
output[:messages] = 0
|
125
|
-
output[:last_message] = nil
|
126
|
-
suspend do |suspended_action|
|
127
|
-
#send back @event_type by wake up action like
|
128
|
-
# suspended_action << @event_type
|
129
|
-
begin
|
130
|
-
initialize_listening_service(SuspendedAction.new(suspended_action))
|
131
|
-
rescue => e
|
132
|
-
error!(e)
|
133
|
-
raise e
|
134
|
-
end
|
135
|
-
unless Rails.env.test?
|
136
|
-
world.before_termination do
|
137
|
-
finish_service
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def finish_service
|
144
|
-
log_prefix = "Finishing #{self.class.name} #{task.id}"
|
145
|
-
action_logger.info(log_prefix)
|
146
|
-
# make sure we close the service at exit to finish the listening action
|
147
|
-
suspended_action.ask(Close).wait
|
148
|
-
# if the triggered_action is nil, it means the action was resumed from
|
149
|
-
# previous run due to some unexpected termination of previous process
|
150
|
-
if self.class.triggered_action
|
151
|
-
self.class.triggered_action.finished.wait
|
152
|
-
else
|
153
|
-
max_attempts = 10
|
154
|
-
(1..max_attempts).each do |attempt|
|
155
|
-
task.reload
|
156
|
-
if !task.pending? || task.paused?
|
157
|
-
break
|
158
|
-
else
|
159
|
-
action_logger.info("#{log_prefix}: attempt #{attempt}/#{max_attempts}")
|
160
|
-
if attempt == max_attempts
|
161
|
-
action_logger.info("#{log_prefix} failed, skipping")
|
162
|
-
else
|
163
|
-
sleep 1
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def act_on_event(event)
|
171
|
-
begin
|
172
|
-
output[:connection] = "Connected"
|
173
|
-
Actions::Candlepin::ImportPoolHandler.new(Rails.logger).handle(event)
|
174
|
-
output[:last_message] = "#{event.message_id} - #{event.subject}"
|
175
|
-
output[:last_message_time] = Time.now.to_s
|
176
|
-
output[:messages] = event.message_id
|
177
|
-
rescue => e
|
178
|
-
output[:last_event_error] = e.message
|
179
|
-
action_logger.error("Failed Candlepin Event: #{e.message}")
|
180
|
-
action_logger.error(e.backtrace.join('\n'))
|
181
|
-
end
|
182
|
-
suspend
|
183
|
-
end
|
184
|
-
|
185
|
-
def configured?
|
186
|
-
SETTINGS[:katello].key?(:qpid) &&
|
187
|
-
SETTINGS[:katello][:qpid].key?(:url) &&
|
188
|
-
SETTINGS[:katello][:qpid].key?(:subscriptions_queue_address)
|
189
|
-
end
|
190
|
-
|
191
|
-
def initialize_listening_service(suspended_action)
|
192
|
-
if configured?
|
193
|
-
CandlepinListeningService.initialize(world.logger,
|
194
|
-
SETTINGS[:katello][:qpid][:url],
|
195
|
-
SETTINGS[:katello][:qpid][:subscriptions_queue_address])
|
196
|
-
suspended_action.notify_not_connected("initialized...have not connected yet")
|
197
|
-
else
|
198
|
-
action_logger.error("katello has not been configured for qpid.url and qpid.subscriptions_queue_address")
|
199
|
-
suspended_action.notify_finished
|
200
|
-
end
|
201
|
-
rescue => e
|
202
|
-
Rails.logger.error(e.message)
|
203
|
-
Rails.logger.error(e.backtrace)
|
204
|
-
error!(e)
|
205
|
-
end
|
206
|
-
|
207
|
-
def error_message(error_id)
|
208
|
-
CandlepinListeningService.instance.errors[error_id]
|
209
|
-
end
|
210
|
-
|
211
|
-
def close_service
|
212
|
-
CandlepinListeningService.close
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Katello
|
3
|
-
module EventQueue
|
4
|
-
class Monitor < Actions::Base
|
5
|
-
include ::Dynflow::Action::Singleton
|
6
|
-
|
7
|
-
Count = Algebrick.type do
|
8
|
-
fields! count: Integer, time: Time
|
9
|
-
end
|
10
|
-
|
11
|
-
Fatal = Algebrick.type do
|
12
|
-
fields! backtrace: String, message: String, kind: String
|
13
|
-
end
|
14
|
-
|
15
|
-
Ready = Algebrick.atom
|
16
|
-
Close = Algebrick.atom
|
17
|
-
|
18
|
-
class << self
|
19
|
-
attr_reader :triggered_action
|
20
|
-
|
21
|
-
def ensure_running(world = ForemanTasks.dynflow.world)
|
22
|
-
unless self.singleton_locked?(world)
|
23
|
-
@triggered_action = ForemanTasks.trigger self
|
24
|
-
end
|
25
|
-
rescue Dynflow::Coordinator::LockError
|
26
|
-
return false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def plan
|
31
|
-
# Make sure we don't have two concurrent listening services competing
|
32
|
-
plan_self
|
33
|
-
end
|
34
|
-
|
35
|
-
def run(event = nil)
|
36
|
-
action_logger.debug("message_queue_event: #{event}")
|
37
|
-
match(event,
|
38
|
-
(on nil do
|
39
|
-
initialize_service
|
40
|
-
end),
|
41
|
-
(on Ready do
|
42
|
-
listen_for_events
|
43
|
-
end),
|
44
|
-
(on Count do
|
45
|
-
update_count(event)
|
46
|
-
end),
|
47
|
-
(on Close | Dynflow::Action::Cancellable::Cancel do
|
48
|
-
close_service
|
49
|
-
end),
|
50
|
-
(on Fatal do
|
51
|
-
restart_poller(event)
|
52
|
-
end),
|
53
|
-
(on Dynflow::Action::Skip do
|
54
|
-
# do nothing, just skip
|
55
|
-
end))
|
56
|
-
rescue => e
|
57
|
-
action_logger.error(e.message)
|
58
|
-
close_service
|
59
|
-
error!(e)
|
60
|
-
end
|
61
|
-
|
62
|
-
def restart_poller(_event)
|
63
|
-
suspend do |suspended_action|
|
64
|
-
SuspendedAction.new(suspended_action).notify_ready
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def close_service
|
69
|
-
PollerThread.close
|
70
|
-
end
|
71
|
-
|
72
|
-
def initialize_service
|
73
|
-
::Katello::EventQueue.reset_in_progress
|
74
|
-
PollerThread.initialize(world.logger)
|
75
|
-
suspend do |suspended_action|
|
76
|
-
SuspendedAction.new(suspended_action).notify_ready
|
77
|
-
|
78
|
-
unless Rails.env.test?
|
79
|
-
world.before_termination do
|
80
|
-
finish_service
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def finish_service
|
87
|
-
suspended_action.ask(Close).wait
|
88
|
-
if self.class.triggered_action
|
89
|
-
self.class.triggered_action.finished.wait
|
90
|
-
else
|
91
|
-
max_attempts = 10
|
92
|
-
(1..max_attempts).each do |attempt|
|
93
|
-
task.reload
|
94
|
-
if !task.pending? || task.paused?
|
95
|
-
break
|
96
|
-
else
|
97
|
-
sleep 1 if attempt != max_attempts
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def listen_for_events
|
104
|
-
suspend do |suspended_action|
|
105
|
-
PollerThread.instance.poll_for_events(SuspendedAction.new(suspended_action))
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def update_count(event)
|
110
|
-
output[:count] ||= 0
|
111
|
-
output[:count] += event.count
|
112
|
-
output[:last_count_update] = event.time
|
113
|
-
suspend
|
114
|
-
end
|
115
|
-
|
116
|
-
def humanized_name
|
117
|
-
_('Monitor Event Queue')
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Katello
|
3
|
-
module EventQueue
|
4
|
-
class PollerThread
|
5
|
-
SLEEP_INTERVAL = 2
|
6
|
-
COUNT_UPDATE_INTERVAL = 250
|
7
|
-
cattr_accessor :instance
|
8
|
-
|
9
|
-
def self.initialize(logger)
|
10
|
-
self.instance ||= self.new(logger)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.close
|
14
|
-
self.instance.close if self.instance
|
15
|
-
self.instance = nil
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(logger)
|
19
|
-
@logger = logger
|
20
|
-
end
|
21
|
-
|
22
|
-
def close
|
23
|
-
@thread.kill if @thread
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_event(event)
|
27
|
-
@logger.debug("event_queue_event: type=#{event.event_type}, object_id=#{event.object_id}")
|
28
|
-
|
29
|
-
event_instance = nil
|
30
|
-
begin
|
31
|
-
::User.as_anonymous_admin do
|
32
|
-
event_instance = ::Katello::EventQueue.create_instance(event)
|
33
|
-
event_instance.run
|
34
|
-
end
|
35
|
-
rescue => e
|
36
|
-
@logger.error("event_queue_error: type=#{event.event_type}, object_id=#{event.object_id}")
|
37
|
-
@logger.error(e.message)
|
38
|
-
@logger.error(e.backtrace.join("\n"))
|
39
|
-
ensure
|
40
|
-
if event_instance.try(:retry)
|
41
|
-
result = ::Katello::EventQueue.reschedule_event(event)
|
42
|
-
if result == :expired
|
43
|
-
@logger.warn("event_queue_event_expired: type=#{event.event_type} object_id=#{event.object_id}")
|
44
|
-
elsif !result.nil?
|
45
|
-
@logger.warn("event_queue_rescheduled: type=#{event.event_type} object_id=#{event.object_id}")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
::Katello::EventQueue.clear_events(event.event_type, event.object_id, event.created_at)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def poll_for_events(suspended_action)
|
53
|
-
@thread.kill if @thread
|
54
|
-
@thread = Thread.new do
|
55
|
-
loop do
|
56
|
-
Rails.application.executor.wrap do
|
57
|
-
begin
|
58
|
-
count = 0
|
59
|
-
|
60
|
-
until (event = ::Katello::EventQueue.next_event).nil?
|
61
|
-
run_event(event)
|
62
|
-
count += 1
|
63
|
-
|
64
|
-
if count > COUNT_UPDATE_INTERVAL
|
65
|
-
suspended_action.notify_count(count)
|
66
|
-
count = 0
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
suspended_action.notify_count(count) if count > 0
|
71
|
-
sleep SLEEP_INTERVAL
|
72
|
-
rescue => e
|
73
|
-
suspended_action.notify_fatal(e)
|
74
|
-
raise e
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Katello
|
3
|
-
module EventQueue
|
4
|
-
class SuspendedAction
|
5
|
-
def initialize(suspended_action)
|
6
|
-
@suspended_action = suspended_action
|
7
|
-
end
|
8
|
-
|
9
|
-
def notify_count(processed_count)
|
10
|
-
@suspended_action << Monitor::Count[processed_count, Time.now]
|
11
|
-
end
|
12
|
-
|
13
|
-
def notify_ready
|
14
|
-
@suspended_action << Monitor::Ready
|
15
|
-
end
|
16
|
-
|
17
|
-
def notify_fatal(error)
|
18
|
-
@suspended_action << Monitor::Fatal[error.backtrace && error.backtrace.join('\n'), error.message, error.class.name]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|