smart_proxy_dynflow 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebb495fc4f587cc0d94521bec26020bad3948109
4
- data.tar.gz: 87a7ba0afc1876f92f336edbf5b38e523de11101
3
+ metadata.gz: 23e6132a792409de0a63851c335a1cbbbbe6c539
4
+ data.tar.gz: d9eeb7b70c68915fc84b36008e043942cbbcddd9
5
5
  SHA512:
6
- metadata.gz: 1764f5ec0797cbafa4182dd848f7faffb3aae8cdc6053cf08e127cbd0ff9a654acd6994b985caea64267cceea3cde1256bddfb3d232f359b933c0f546c34ced9
7
- data.tar.gz: 65494db608d5c67aed31219afb9c289ca900ed26911b034e1bf55dcb1472f17dab1d7537539f54f28407484d94e7ed27052e0a2a5f007dbc92392662b5641ee2
6
+ metadata.gz: 38be1713aabfeea11b229752bd65fe925b30bf05f1bf15a9105bc70066f3181bdedef45a966c377874efae42e8fa01abb2aefcc1c6caa93b1ba00ca6365bccca
7
+ data.tar.gz: 740e626094df5c0f64580bb94159a03dc1b075409f5b602be0dd8ed1490c6a3efe9e79b439c497056bfc4a6ba3998137a7d7edaf8d54a830126e20fd917f01ae
data/Gemfile CHANGED
@@ -7,16 +7,16 @@ group :development do
7
7
  end
8
8
 
9
9
  group :test do
10
- gem 'smart_proxy_dynflow', :path => '.'
11
10
  gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy", :branch => "develop"
11
+ gem 'smart_proxy_dynflow', :path => '.'
12
12
 
13
13
  if RUBY_VERSION < '2.1'
14
14
  gem 'public_suffix', '< 3'
15
- gem 'rubocop', '< 0.51.0'
16
15
  gem 'rainbow', '< 3'
16
+ gem 'rubocop', '< 0.51.0'
17
17
  else
18
- gem 'rubocop', '~> 0.52.1'
19
18
  gem 'public_suffix'
19
+ gem 'rubocop', '~> 0.52.1'
20
20
  end
21
21
 
22
22
  if RUBY_VERSION < '2.2'
@@ -27,11 +27,11 @@ group :test do
27
27
  end
28
28
 
29
29
  if RUBY_VERSION < '2.2'
30
- gem 'sinatra', '< 2'
31
30
  gem 'rack', '>= 1.1', '< 2.0.0'
31
+ gem 'sinatra', '< 2'
32
32
  else
33
- gem 'sinatra'
34
33
  gem 'rack', '>= 1.1'
34
+ gem 'sinatra'
35
35
  end
36
36
 
37
37
  # load bundler.d
@@ -20,7 +20,6 @@ module Proxy
20
20
  end
21
21
  end
22
22
 
23
-
24
23
  # TODO: move this to foreman-proxy to reduce code duplicities
25
24
  def do_authorize_with_trusted_hosts
26
25
  # When :trusted_hosts is given, we check the client against the list
@@ -28,7 +27,7 @@ module Proxy
28
27
  # HTTP: test the reverse DNS entry of the remote IP
29
28
  trusted_hosts = Proxy::SETTINGS.trusted_hosts
30
29
  if trusted_hosts
31
- if [ 'yes', 'on', 1 ].include? request.env['HTTPS'].to_s
30
+ if ['yes', 'on', 1].include? request.env['HTTPS'].to_s
32
31
  fqdn = https_cert_cn
33
32
  source = 'SSL_CLIENT_CERT'
34
33
  else
@@ -39,13 +38,14 @@ module Proxy
39
38
  logger.debug "verifying remote client #{fqdn} (based on #{source}) against trusted_hosts #{trusted_hosts}"
40
39
 
41
40
  unless Proxy::SETTINGS.trusted_hosts.include?(fqdn)
42
- log_halt 403, "Untrusted client #{fqdn} attempted to access #{request.path_info}. Check :trusted_hosts: in settings.yml"
41
+ log_halt 403, "Untrusted client #{fqdn} attempted " \
42
+ "to access #{request.path_info}. Check :trusted_hosts: in settings.yml"
43
43
  end
44
44
  end
45
45
  end
46
46
 
47
47
  def do_authorize_with_ssl_client
48
- if ['yes', 'on', '1'].include? request.env['HTTPS'].to_s
48
+ if %w[yes on 1].include? request.env['HTTPS'].to_s
49
49
  if request.env['SSL_CLIENT_CERT'].to_s.empty?
50
50
  log_halt 403, "No client SSL certificate supplied"
51
51
  end
@@ -10,12 +10,13 @@ module Proxy
10
10
 
11
11
  def relay(request, from, to)
12
12
  path = request.path.gsub(from, to)
13
- Proxy::LogBuffer::Decorator.instance.debug "Proxy request from #{request.host_with_port}#{request.path} to #{uri.to_s}#{path}"
13
+ message = "Proxy request from #{request.host_with_port}#{request.path} to #{uri}#{path}"
14
+ Proxy::LogBuffer::Decorator.instance.debug message
14
15
  req = case request.env['REQUEST_METHOD']
15
- when 'GET'
16
- request_factory.create_get path, request.env['rack.request.query_hash']
17
- when 'POST'
18
- request_factory.create_post path, request.body.read
16
+ when 'GET'
17
+ request_factory.create_get path, request.env['rack.request.query_hash']
18
+ when 'POST'
19
+ request_factory.create_post path, request.body.read
19
20
  end
20
21
  req['X-Forwarded-For'] = request.env['HTTP_HOST']
21
22
  req['AUTHORIZATION'] = request.env['HTTP_AUTHORIZATION']
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  class Dynflow
3
3
  module Helpers
4
- def relay_request(from = /^\/dynflow/, to = '')
4
+ def relay_request(from = %r{^/dynflow}, to = '')
5
5
  response = Proxy::Dynflow::Callback::Core.relay(request, from, to)
6
6
  content_type response.content_type
7
7
  status response.code
@@ -1,7 +1,7 @@
1
1
  require 'smart_proxy_dynflow/api'
2
2
 
3
3
  map "/dynflow" do
4
- map '/'do
4
+ map '/' do
5
5
  run Proxy::Dynflow::Api
6
6
  end
7
7
  end
@@ -18,13 +18,15 @@ class Proxy::Dynflow
18
18
  default_settings :core_url => 'http://localhost:8008'
19
19
  plugin :dynflow, Proxy::Dynflow::VERSION
20
20
 
21
+ # rubocop:disable Lint/HandleExceptions
21
22
  after_activation do
22
23
  begin
23
24
  require 'smart_proxy_dynflow_core'
24
- rescue LoadError => e
25
+ rescue LoadError
25
26
  # Dynflow core is not available in the proxy, will be handled
26
27
  # by standalone Dynflow core
27
28
  end
28
29
  end
30
+ # rubocop:enable Lint/HandleExceptions
29
31
  end
30
32
  end
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  class Dynflow
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_dynflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-20 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,75 +25,75 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: mocha
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1'
55
55
  - !ruby/object:Gem::Dependency
56
- name: mocha
56
+ name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: webmock
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1'
75
+ version: '10.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1'
82
+ version: '10.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rack-test
84
+ name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '1'
97
97
  description: " Use the Dynflow inside Foreman smart proxy\n"
98
98
  email:
99
99
  - inecas@redhat.com