invoker 1.5.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/invoker/cli.rb +20 -5
- data/lib/invoker/daemon.rb +1 -1
- data/lib/invoker/power/balancer.rb +4 -2
- data/lib/invoker/power/http_response.rb +1 -1
- data/lib/invoker/power/setup.rb +2 -2
- data/lib/invoker/version.rb +1 -1
- data/lib/invoker.rb +1 -1
- data/spec/invoker/power/balancer_spec.rb +31 -0
- data/spec/invoker/power/setup/linux_setup_spec.rb +1 -1
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a7d6cd0f3813f71b87e23b50c9567824af843b071669ca621403c8f67a4a467
|
4
|
+
data.tar.gz: 345781951e90374a1678c10c0ac646db757147edea30350c095fe0ccb9da8aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd2cde6b1eee858f0ede71af4f58ef1c46bb29326b99e0fa2fa4196b9276c519a07e81633bebc4163962063cce3849599ed34159d4df791c763d401a62ff0a5c
|
7
|
+
data.tar.gz: ded01a508b2f643f0e6f74fcf39e28ab75546db85e85007149335b8d0c277297598d93bed35903d4f3c17c35981bd552dec053b59702efd96ecb1ed6f14cd359
|
data/lib/invoker/cli.rb
CHANGED
@@ -98,12 +98,27 @@ module Invoker
|
|
98
98
|
type: :boolean,
|
99
99
|
banner: "Print process list in raw text format",
|
100
100
|
aliases: [:r]
|
101
|
+
option :wait,
|
102
|
+
type: :boolean,
|
103
|
+
banner: "wait for update",
|
104
|
+
aliases: [:w]
|
101
105
|
def list
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
106
|
+
if options[:wait]
|
107
|
+
Signal.trap("INT") { exit(0) }
|
108
|
+
loop do
|
109
|
+
puts "\e[H\e[2J"
|
110
|
+
unix_socket.send_command('list') do |response_object|
|
111
|
+
Invoker::ProcessPrinter.new(response_object).tap { |printer| printer.print_table }
|
112
|
+
end
|
113
|
+
sleep(5)
|
114
|
+
end
|
115
|
+
else
|
116
|
+
unix_socket.send_command('list') do |response_object|
|
117
|
+
if options[:raw]
|
118
|
+
Invoker::ProcessPrinter.new(response_object).tap { |printer| printer.print_raw_text }
|
119
|
+
else
|
120
|
+
Invoker::ProcessPrinter.new(response_object).tap { |printer| printer.print_table }
|
121
|
+
end
|
107
122
|
end
|
108
123
|
end
|
109
124
|
end
|
data/lib/invoker/daemon.rb
CHANGED
@@ -13,7 +13,7 @@ module Invoker
|
|
13
13
|
Invoker::Logger.puts "Invoker daemon is already running"
|
14
14
|
exit(0)
|
15
15
|
elsif dead?
|
16
|
-
File.delete(pid_file) if File.
|
16
|
+
File.delete(pid_file) if File.exist?(pid_file)
|
17
17
|
end
|
18
18
|
Invoker::Logger.puts "Running Invoker daemon"
|
19
19
|
daemonize
|
@@ -65,12 +65,14 @@ module Invoker
|
|
65
65
|
return
|
66
66
|
end
|
67
67
|
@session = UUID.generate()
|
68
|
-
|
68
|
+
headers = headers.transform_keys(&:downcase)
|
69
|
+
|
70
|
+
if !headers['host'] || headers['host'].empty?
|
69
71
|
return_error_page(400)
|
70
72
|
return
|
71
73
|
end
|
72
74
|
|
73
|
-
dns_check_response = UrlRewriter.new.select_backend_config(headers['
|
75
|
+
dns_check_response = UrlRewriter.new.select_backend_config(headers['host'])
|
74
76
|
if dns_check_response && dns_check_response.port
|
75
77
|
connection.server(session, host: dns_check_response.ip, port: dns_check_response.port)
|
76
78
|
else
|
data/lib/invoker/power/setup.rb
CHANGED
@@ -56,7 +56,7 @@ module Invoker
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def check_if_setup_can_run?
|
59
|
-
!File.
|
59
|
+
!File.exist?(Invoker::Power::Config.config_file)
|
60
60
|
end
|
61
61
|
|
62
62
|
def create_config_file
|
@@ -86,7 +86,7 @@ module Invoker
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def safe_remove_file(file)
|
89
|
-
File.delete(file) if File.
|
89
|
+
File.delete(file) if File.exist?(file)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
data/lib/invoker/version.rb
CHANGED
data/lib/invoker.rb
CHANGED
@@ -6,6 +6,37 @@ describe Invoker::Power::Balancer do
|
|
6
6
|
@balancer = Invoker::Power::Balancer.new(@http_connection, "http")
|
7
7
|
end
|
8
8
|
|
9
|
+
context "when Host field is not capitalized" do
|
10
|
+
before(:all) do
|
11
|
+
@original_invoker_config = Invoker.config
|
12
|
+
end
|
13
|
+
|
14
|
+
def mock_invoker_tld_as(domain)
|
15
|
+
Invoker.config = mock
|
16
|
+
Invoker.config.stubs(:tld).returns(domain)
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:all) do
|
20
|
+
Invoker.config = @original_invoker_config
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not return 400 when host is lowercase" do
|
24
|
+
headers = { 'host' => 'somehost.com' }
|
25
|
+
mock_invoker_tld_as('test')
|
26
|
+
@http_connection.expects(:send_data).with() { |value| value =~ /404 Not Found/i }
|
27
|
+
@http_connection.expects(:close_connection_after_writing)
|
28
|
+
@balancer.headers_received(headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should not return 400 when host is written as HoSt" do
|
32
|
+
headers = { 'HoSt' => 'somehost.com' }
|
33
|
+
mock_invoker_tld_as('test')
|
34
|
+
@http_connection.expects(:send_data).with() { |value| value =~ /404 Not Found/i }
|
35
|
+
@http_connection.expects(:close_connection_after_writing)
|
36
|
+
@balancer.headers_received(headers)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
9
40
|
context "when Host field is missing in the request" do
|
10
41
|
it "should return 400 as response when Host is missing" do
|
11
42
|
headers = {}
|
@@ -147,7 +147,7 @@ describe Invoker::Power::Distro::Base, docker: true do
|
|
147
147
|
describe '.distro_installer' do
|
148
148
|
it 'correctly recognizes the current distro' do
|
149
149
|
case ENV['DISTRO']
|
150
|
-
when 'archlinux
|
150
|
+
when 'archlinux', 'manjarolinux/base'
|
151
151
|
expect(described_class.distro_installer('')).to be_a Invoker::Power::Distro::Arch
|
152
152
|
when 'debian'
|
153
153
|
expect(described_class.distro_installer('')).to be_a Invoker::Power::Distro::Debian
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hemant Kumar
|
8
8
|
- Amitava Basak
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -135,14 +135,14 @@ dependencies:
|
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0
|
138
|
+
version: '1.0'
|
139
139
|
type: :runtime
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0
|
145
|
+
version: '1.0'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: dotenv
|
148
148
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,15 +319,15 @@ files:
|
|
319
319
|
- spec/invoker/process_manager_spec.rb
|
320
320
|
- spec/invoker/reactor_spec.rb
|
321
321
|
- spec/spec_helper.rb
|
322
|
-
homepage: https://invoker.
|
322
|
+
homepage: https://invoker.c9s.dev
|
323
323
|
licenses:
|
324
324
|
- MIT
|
325
325
|
metadata:
|
326
326
|
bug_tracker_uri: https://github.com/code-mancers/invoker/issues
|
327
327
|
changelog_uri: https://github.com/code-mancers/invoker/blob/master/CHANGELOG.md
|
328
|
-
documentation_uri: https://invoker.
|
329
|
-
source_code_uri: https://github.com/code-mancers/invoker/tree/
|
330
|
-
post_install_message:
|
328
|
+
documentation_uri: https://invoker.c9s.dev/
|
329
|
+
source_code_uri: https://github.com/code-mancers/invoker/tree/v2.0.0
|
330
|
+
post_install_message:
|
331
331
|
rdoc_options: []
|
332
332
|
require_paths:
|
333
333
|
- lib
|
@@ -335,42 +335,42 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
335
335
|
requirements:
|
336
336
|
- - ">="
|
337
337
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
338
|
+
version: 3.0.0
|
339
339
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
340
340
|
requirements:
|
341
341
|
- - ">="
|
342
342
|
- !ruby/object:Gem::Version
|
343
343
|
version: '0'
|
344
344
|
requirements: []
|
345
|
-
rubygems_version: 3.
|
346
|
-
signing_key:
|
345
|
+
rubygems_version: 3.4.10
|
346
|
+
signing_key:
|
347
347
|
specification_version: 4
|
348
348
|
summary: Something small for Process management
|
349
349
|
test_files:
|
350
|
-
- spec/spec_helper.rb
|
351
|
-
- spec/invoker/power/port_finder_spec.rb
|
352
|
-
- spec/invoker/power/config_spec.rb
|
353
|
-
- spec/invoker/power/setup_spec.rb
|
354
|
-
- spec/invoker/power/setup/osx_setup_spec.rb
|
355
|
-
- spec/invoker/power/setup/linux_setup_spec.rb
|
356
|
-
- spec/invoker/power/http_parser_spec.rb
|
357
|
-
- spec/invoker/power/url_rewriter_spec.rb
|
358
|
-
- spec/invoker/power/balancer_spec.rb
|
359
|
-
- spec/invoker/power/web_sockets_spec.rb
|
360
|
-
- spec/invoker/power/http_response_spec.rb
|
361
|
-
- spec/invoker/config_spec.rb
|
362
|
-
- spec/invoker/invoker_spec.rb
|
363
|
-
- spec/invoker/cli_spec.rb
|
364
|
-
- spec/invoker/command_worker_spec.rb
|
365
|
-
- spec/invoker/reactor_spec.rb
|
366
350
|
- spec/invoker/cli/pinger_spec.rb
|
367
351
|
- spec/invoker/cli/tail_watcher_spec.rb
|
352
|
+
- spec/invoker/cli_spec.rb
|
353
|
+
- spec/invoker/command_worker_spec.rb
|
354
|
+
- spec/invoker/commander_spec.rb
|
355
|
+
- spec/invoker/config_spec.rb
|
368
356
|
- spec/invoker/daemon_spec.rb
|
369
|
-
- spec/invoker/
|
357
|
+
- spec/invoker/event/manager_spec.rb
|
358
|
+
- spec/invoker/invoker_spec.rb
|
359
|
+
- spec/invoker/ipc/client_handler_spec.rb
|
360
|
+
- spec/invoker/ipc/dns_check_command_spec.rb
|
370
361
|
- spec/invoker/ipc/message/list_response_spec.rb
|
371
362
|
- spec/invoker/ipc/message_spec.rb
|
372
|
-
- spec/invoker/ipc/
|
373
|
-
- spec/invoker/
|
374
|
-
- spec/invoker/
|
363
|
+
- spec/invoker/ipc/unix_client_spec.rb
|
364
|
+
- spec/invoker/power/balancer_spec.rb
|
365
|
+
- spec/invoker/power/config_spec.rb
|
366
|
+
- spec/invoker/power/http_parser_spec.rb
|
367
|
+
- spec/invoker/power/http_response_spec.rb
|
368
|
+
- spec/invoker/power/port_finder_spec.rb
|
369
|
+
- spec/invoker/power/setup/linux_setup_spec.rb
|
370
|
+
- spec/invoker/power/setup/osx_setup_spec.rb
|
371
|
+
- spec/invoker/power/setup_spec.rb
|
372
|
+
- spec/invoker/power/url_rewriter_spec.rb
|
373
|
+
- spec/invoker/power/web_sockets_spec.rb
|
375
374
|
- spec/invoker/process_manager_spec.rb
|
376
|
-
- spec/invoker/
|
375
|
+
- spec/invoker/reactor_spec.rb
|
376
|
+
- spec/spec_helper.rb
|