killbill-kpm-ui 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/kpm/nodes_info_controller.rb +5 -5
- data/config/routes.rb +2 -2
- data/lib/kpm.rb +6 -6
- data/lib/kpm/client.rb +12 -12
- data/lib/kpm/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +57 -30
- data/test/dummy/log/test.log +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 525be1974e3fff33c6523e2042ee3c6510e40c7c
|
4
|
+
data.tar.gz: 0c8ca1aac74c3d99e1908a1b829561d96dfbf8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec09d119fb4f1a3355530918236e83c32c4ed12775dc705e23888100cde1bedfeb8ac3f9ea5a64f56dd007e9bc652838fb4ea91e26d7845a2d9f62f3ee3e3d3c
|
7
|
+
data.tar.gz: 873f1e309fff26406e1022c85c23a1cf97f80e3f8dc2bf9bebfa1fabdf90645a25aa906e90c0876c812b5f20a2b02d491fcf7fa2cd3ca20337564584e91d5c35
|
@@ -39,7 +39,7 @@ module KPM
|
|
39
39
|
sse_client = nil
|
40
40
|
begin
|
41
41
|
# Kaui -> Browser
|
42
|
-
sse = ActionController::Live::SSE.new(response.stream, :
|
42
|
+
sse = ActionController::Live::SSE.new(response.stream, retry: 300, event: 'refresh')
|
43
43
|
|
44
44
|
# Kill Bill -> Kaui
|
45
45
|
sse_client = ::Killbill::KPM::KPMClient.stream_osgi_logs(sse, params[:kb_host], last_event_id_ref)
|
@@ -50,7 +50,7 @@ module KPM
|
|
50
50
|
i += 1
|
51
51
|
# Keep the thread alive (Kill Bill should send us a heartbeat as well though)
|
52
52
|
# Note that we set the id as the last log id, so that we can easily resume
|
53
|
-
sse.write('heartbeat', :
|
53
|
+
sse.write('heartbeat', id: last_event_id_ref.get)
|
54
54
|
sleep 5
|
55
55
|
end
|
56
56
|
rescue ActionController::Live::ClientDisconnected
|
@@ -58,11 +58,11 @@ module KPM
|
|
58
58
|
ensure
|
59
59
|
begin
|
60
60
|
begin
|
61
|
-
sse_client
|
61
|
+
sse_client&.close
|
62
62
|
rescue StandardError
|
63
63
|
# ignored
|
64
64
|
end
|
65
|
-
sse
|
65
|
+
sse&.close
|
66
66
|
ensure
|
67
67
|
# Clear dead DB connections
|
68
68
|
# Very lame, but I couldn't do better... Rails will checkout a DB connection
|
@@ -78,7 +78,7 @@ module KPM
|
|
78
78
|
|
79
79
|
def install_plugin
|
80
80
|
trigger_node_plugin_command('INSTALL_PLUGIN')
|
81
|
-
redirect_to nodes_info_index_path(:
|
81
|
+
redirect_to nodes_info_index_path(i: 1)
|
82
82
|
end
|
83
83
|
|
84
84
|
def uninstall_plugin
|
data/config/routes.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
KPM::Engine.routes.draw do
|
4
4
|
root to: 'nodes_info#index'
|
5
5
|
|
6
|
-
resources :nodes_info, :
|
7
|
-
resources :plugins, :
|
6
|
+
resources :nodes_info, only: [:index]
|
7
|
+
resources :plugins, only: [:index]
|
8
8
|
|
9
9
|
scope '/nodes_info' do
|
10
10
|
match '/refresh' => 'nodes_info#refresh', :via => :get, :as => 'nodes_info_refresh'
|
data/lib/kpm.rb
CHANGED
@@ -8,17 +8,17 @@ module KPM
|
|
8
8
|
|
9
9
|
self.current_tenant_user = lambda { |_session, _user|
|
10
10
|
{
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
11
|
+
username: 'admin',
|
12
|
+
password: 'password',
|
13
|
+
session_id: nil,
|
14
|
+
api_key: KillBillClient.api_key,
|
15
|
+
api_secret: KillBillClient.api_secret
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
19
19
|
def self.config
|
20
20
|
{
|
21
|
-
:
|
21
|
+
layout: layout || 'kpm/layouts/kpm_application'
|
22
22
|
}
|
23
23
|
end
|
24
24
|
end
|
data/lib/kpm/client.rb
CHANGED
@@ -14,27 +14,27 @@ module Killbill
|
|
14
14
|
# (we rarely deploy SNAPSHOT jars)
|
15
15
|
captures = kb_version_maybe_snapshot.scan(/0.(\d+)(\.)?(\d+)?(-SNAPSHOT)?/)
|
16
16
|
# [["20", ".", "1", "-SNAPSHOT"]]
|
17
|
-
if !captures.nil? && !captures.first.nil? && !captures.first[3].nil?
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
kb_version = if !captures.nil? && !captures.first.nil? && !captures.first[3].nil?
|
18
|
+
if captures.first[2].to_i.positive?
|
19
|
+
'0.' + captures.first[0] + '.' + (captures.first[2].to_i - 1).to_s
|
20
|
+
else
|
21
|
+
'0.' + (captures.first[0].to_i - 1).to_s + '.0'
|
22
|
+
end
|
23
|
+
else
|
24
|
+
kb_version_maybe_snapshot
|
25
|
+
end
|
26
26
|
|
27
27
|
path = "#{KILLBILL_KPM_PREFIX}/plugins"
|
28
|
-
response = KillBillClient::API.get path, { :
|
28
|
+
response = KillBillClient::API.get path, { kbVersion: kb_version, latest: latest }, options
|
29
29
|
JSON.parse(response.body)
|
30
30
|
end
|
31
31
|
|
32
32
|
def stream_osgi_logs(writer, host, last_event_id_ref)
|
33
33
|
url = host
|
34
34
|
url = "http://#{url}" unless url.starts_with?('http:')
|
35
|
-
SSE::Client.new(url + KILLBILL_OSGI_LOGGER_PREFIX, :
|
35
|
+
SSE::Client.new(url + KILLBILL_OSGI_LOGGER_PREFIX, last_event_id: last_event_id_ref.get, logger: Rails.logger) do |client|
|
36
36
|
client.on_event do |event|
|
37
|
-
writer.write(event.data, :
|
37
|
+
writer.write(event.data, id: event.id)
|
38
38
|
last_event_id_ref.set(event.id)
|
39
39
|
end
|
40
40
|
end
|
data/lib/kpm/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -11,7 +11,7 @@ require 'rails/test_help'
|
|
11
11
|
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
12
12
|
|
13
13
|
# Load support files
|
14
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
15
15
|
|
16
16
|
# Load fixtures from the engine
|
17
17
|
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-kpm-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-datatables-rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sass-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: font-awesome-rails
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: gem-release
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: json
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +184,14 @@ dependencies:
|
|
156
184
|
requirements:
|
157
185
|
- - "~>"
|
158
186
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
187
|
+
version: 0.88.0
|
160
188
|
type: :development
|
161
189
|
prerelease: false
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
163
191
|
requirements:
|
164
192
|
- - "~>"
|
165
193
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
194
|
+
version: 0.88.0
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
196
|
name: simplecov
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +270,6 @@ files:
|
|
242
270
|
- test/dummy/config/locales/en.yml
|
243
271
|
- test/dummy/config/routes.rb
|
244
272
|
- test/dummy/config/secrets.yml
|
245
|
-
- test/dummy/log/test.log
|
246
273
|
- test/integration/navigation_test.rb
|
247
274
|
- test/kpm_test.rb
|
248
275
|
- test/test_helper.rb
|
@@ -265,43 +292,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
292
|
- !ruby/object:Gem::Version
|
266
293
|
version: '0'
|
267
294
|
requirements: []
|
268
|
-
|
295
|
+
rubyforge_project:
|
296
|
+
rubygems_version: 2.6.13
|
269
297
|
signing_key:
|
270
298
|
specification_version: 4
|
271
299
|
summary: Kill Bill KPM UI mountable engine
|
272
300
|
test_files:
|
301
|
+
- test/kpm_test.rb
|
273
302
|
- test/test_helper.rb
|
274
303
|
- test/integration/navigation_test.rb
|
275
|
-
- test/dummy/
|
276
|
-
- test/dummy/
|
277
|
-
- test/dummy/
|
278
|
-
- test/dummy/
|
304
|
+
- test/dummy/config.ru
|
305
|
+
- test/dummy/bin/yarn
|
306
|
+
- test/dummy/bin/update
|
307
|
+
- test/dummy/bin/rake
|
308
|
+
- test/dummy/bin/setup
|
309
|
+
- test/dummy/bin/bundle
|
310
|
+
- test/dummy/bin/rails
|
279
311
|
- test/dummy/config/routes.rb
|
280
|
-
- test/dummy/config/
|
281
|
-
- test/dummy/config/environments/production.rb
|
282
|
-
- test/dummy/config/environments/development.rb
|
283
|
-
- test/dummy/config/initializers/new_framework_defaults_5_1.rb
|
284
|
-
- test/dummy/config/initializers/inflections.rb
|
285
|
-
- test/dummy/config/initializers/assets.rb
|
286
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
287
|
-
- test/dummy/config/initializers/killbill_client.rb
|
288
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
312
|
+
- test/dummy/config/boot.rb
|
289
313
|
- test/dummy/config/initializers/mime_types.rb
|
290
314
|
- test/dummy/config/initializers/application_controller_renderer.rb
|
291
|
-
- test/dummy/config/initializers/
|
315
|
+
- test/dummy/config/initializers/killbill_client.rb
|
316
|
+
- test/dummy/config/initializers/assets.rb
|
292
317
|
- test/dummy/config/initializers/session_store.rb
|
293
318
|
- test/dummy/config/initializers/wrap_parameters.rb
|
294
|
-
- test/dummy/config/
|
319
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
320
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
321
|
+
- test/dummy/config/initializers/new_framework_defaults_5_1.rb
|
322
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
323
|
+
- test/dummy/config/initializers/inflections.rb
|
324
|
+
- test/dummy/config/locales/en.yml
|
325
|
+
- test/dummy/config/secrets.yml
|
326
|
+
- test/dummy/config/environment.rb
|
327
|
+
- test/dummy/config/environments/production.rb
|
328
|
+
- test/dummy/config/environments/development.rb
|
329
|
+
- test/dummy/config/environments/test.rb
|
295
330
|
- test/dummy/config/application.rb
|
296
|
-
- test/dummy/Rakefile
|
297
331
|
- test/dummy/README.rdoc
|
332
|
+
- test/dummy/Rakefile
|
298
333
|
- test/dummy/app/controllers/application_controller.rb
|
299
334
|
- test/dummy/app/helpers/application_helper.rb
|
300
|
-
- test/dummy/config.ru
|
301
|
-
- test/dummy/bin/rake
|
302
|
-
- test/dummy/bin/bundle
|
303
|
-
- test/dummy/bin/update
|
304
|
-
- test/dummy/bin/setup
|
305
|
-
- test/dummy/bin/yarn
|
306
|
-
- test/dummy/bin/rails
|
307
|
-
- test/kpm_test.rb
|
data/test/dummy/log/test.log
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---------------------------------
|
2
|
-
KPMTest: test_can_load_KPM_module
|
3
|
-
---------------------------------
|
4
|
-
------------------------------------------------
|
5
|
-
NavigationTest: test_can_see_the_nodes_info_page
|
6
|
-
------------------------------------------------
|
7
|
-
Started GET "/kpm" for 127.0.0.1 at 2018-05-18 09:08:53 +0000
|
8
|
-
Processing by KPM::NodesInfoController#index as HTML
|
9
|
-
Request method='GET', uri='http://127.0.0.1:8080/1.0/kb/nodesInfo'
|
10
|
-
accept='application/json', user-agent='killbill/2.2.3; ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]', accept-encoding='gzip;q=1.0,deflate;q=0.6,identity;q=0.3', x-killbill-apikey='bob', x-killbill-apisecret='lazar', authorization='Basic [FILTERED]'
|
11
|
-
Completed 500 Internal Server Error in 1ms
|
12
|
-
---------------------------------------
|
13
|
-
NavigationTest: test_can_restart_bundle
|
14
|
-
---------------------------------------
|
15
|
-
Started POST "/kpm/nodes_info/plugin/restart?plugin_name=org.apache.felix.shell" for 127.0.0.1 at 2018-05-18 09:08:53 +0000
|
16
|
-
Processing by KPM::NodesInfoController#restart_plugin as HTML
|
17
|
-
Parameters: {"plugin_name"=>"org.apache.felix.shell"}
|
18
|
-
Request method='POST', uri='http://127.0.0.1:8080/1.0/kb/nodesInfo?localNodeOnly=false'
|
19
|
-
accept='application/json', user-agent='killbill/2.2.3; ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]', accept-encoding='gzip;q=1.0,deflate;q=0.6,identity;q=0.3', x-killbill-apikey='bob', x-killbill-apisecret='lazar', authorization='Basic [FILTERED]', content-type='application/json', x-killbill-createdby='admin'
|
20
|
-
requestBody='{"systemCommandType":true,"nodeCommandType":"RESTART_PLUGIN","nodeCommandProperties":[{"key":"pluginKey"},{"key":"pluginName","value":"org.apache.felix.shell"},{"key":"pluginVersion"}]}'
|
21
|
-
Completed 500 Internal Server Error in 1ms
|