invoker 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55217109e2c3f44ebbbfd25c36f3b4d8d3dedff2c8380cc262cb12653cc1a1b1
4
- data.tar.gz: 7f9e9a0d4a100d44549400473a81686d09773ee0d9d5ec8f193ccbee999bebe9
3
+ metadata.gz: b853190df0eac206efeac859446934d0e1b6df0fa93ad88d1ef950c2b9e30143
4
+ data.tar.gz: 127d6df5d280e555ed05b8b3449bfcc100ae6d9efb5bb447e01eaeedef16bef9
5
5
  SHA512:
6
- metadata.gz: 4221997cbbcf54911d116f2dde24cc30ba91e36013f72b3ed1e392fcb96c0be43186f2837be0735da43932e09ddd1725452784ee2a3e7fd0b12928daebd7f337
7
- data.tar.gz: f4c3a7697a1ce22121cce85e58770ad0a3fd8f816d731b82115c5b0dcba5cda404822d3a56b1710766171bf776c2cccb44223e8759974f9e231956e2125e2ef6
6
+ metadata.gz: 75ce1dd71098a4f5306797a8bc7ef82b7dafdbf21160a8633526fa697a4925b420d6f7ba8a3fcb230009fafa3d95e269bc384bffaa3dc7313996b689f2d00383
7
+ data.tar.gz: 3328f736e84fd2e681c59338c416b111c77199f0cdc01d06e2297ec5b82b3b9cc7b63d94bcaf77f6b68dd7c1be315936786e66014f135ad1be77fa68ef8631dd
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
- unix_socket.send_command('list') do |response_object|
103
- if options[:raw]
104
- Invoker::ProcessPrinter.new(response_object).tap { |printer| printer.print_raw_text }
105
- else
106
- Invoker::ProcessPrinter.new(response_object).tap { |printer| printer.print_table }
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
@@ -65,12 +65,14 @@ module Invoker
65
65
  return
66
66
  end
67
67
  @session = UUID.generate()
68
- if !headers['Host'] || headers['Host'].empty?
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['Host'])
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
@@ -43,5 +43,5 @@ module Invoker
43
43
  Version.new(next_splits.join('.'))
44
44
  end
45
45
  end
46
- VERSION = "1.5.7"
46
+ VERSION = "1.5.8"
47
47
  end
@@ -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/base', 'manjarolinux/base'
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: 1.5.7
4
+ version: 1.5.8
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: 2020-04-24 00:00:00.000000000 Z
12
+ date: 2021-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -326,8 +326,8 @@ 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
328
  documentation_uri: https://invoker.codemancers.com/
329
- source_code_uri: https://github.com/code-mancers/invoker/tree/v1.5.7
330
- post_install_message:
329
+ source_code_uri: https://github.com/code-mancers/invoker/tree/v1.5.8
330
+ post_install_message:
331
331
  rdoc_options: []
332
332
  require_paths:
333
333
  - lib
@@ -342,8 +342,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.1.2
346
- signing_key:
345
+ rubygems_version: 3.1.4
346
+ signing_key:
347
347
  specification_version: 4
348
348
  summary: Something small for Process management
349
349
  test_files: