orchestrator_client 0.4.1 → 0.4.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 +4 -4
- data/lib/orchestrator_client.rb +7 -3
- data/lib/orchestrator_client/config.rb +18 -5
- data/lib/orchestrator_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1655b1aa31a89732df80a7f25e81539f1573e19f
|
4
|
+
data.tar.gz: e543181e950953e5c4a23b1b41ff7ff0086c4c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0bf2e0130058d42004f2da6ec971f1cb19882d08a7e519d21862b35234ed8ed6118c5c29d04b42c891f445b96c9d324a1242b8702cfff794260c4fdd3f3f1c5
|
7
|
+
data.tar.gz: 717521ef116e26505e8e5aef2410ae7de8474e7290f87f482782a572a143a5bdbfe26396d5930b6b354bc17d6c9bdece5a5d31c0cd1e12c0420592e13491c3ff
|
data/lib/orchestrator_client.rb
CHANGED
@@ -3,7 +3,6 @@ require 'uri'
|
|
3
3
|
require 'json'
|
4
4
|
require 'openssl'
|
5
5
|
require 'faraday'
|
6
|
-
require 'net/http/persistent'
|
7
6
|
|
8
7
|
class OrchestratorClient
|
9
8
|
require 'orchestrator_client/error'
|
@@ -28,8 +27,13 @@ class OrchestratorClient
|
|
28
27
|
f.headers['User-Agent'] = config['User-Agent']
|
29
28
|
f.ssl['ca_file'] = config['cacert']
|
30
29
|
f.ssl['version'] = :TLSv1_2
|
31
|
-
|
32
|
-
|
30
|
+
# Do not use net-http-persistent on windows
|
31
|
+
if !!File::ALT_SEPARATOR
|
32
|
+
f.adapter :net_http
|
33
|
+
else
|
34
|
+
f.adapter :net_http_persistent, pool_size: 5 do |http|
|
35
|
+
http.idle_timeout = 30
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -63,6 +63,15 @@ class OrchestratorClient::Config
|
|
63
63
|
raise OrchestratorClient::ConfigError.new("'service-url' is required in config")
|
64
64
|
end
|
65
65
|
|
66
|
+
begin
|
67
|
+
service_url = URI.parse(config['service-url'])
|
68
|
+
unless service_url.kind_of?(URI::HTTP) || service_url.kind_of?(URI::HTTPS)
|
69
|
+
raise OrchestratorClient::ConfigError.new("'#{config['service-url']}' is an invalid service-url")
|
70
|
+
end
|
71
|
+
rescue URI::InvalidURIError
|
72
|
+
raise OrchestratorClient::ConfigError.new("'#{config['service-url']}' is an invalid service-url")
|
73
|
+
end
|
74
|
+
|
66
75
|
if config['cacert'].nil?
|
67
76
|
raise OrchestratorClient::ConfigError.new("'cacert' is required in config")
|
68
77
|
end
|
@@ -80,12 +89,16 @@ class OrchestratorClient::Config
|
|
80
89
|
if @config['token']
|
81
90
|
@config['token']
|
82
91
|
else
|
83
|
-
|
84
|
-
|
85
|
-
|
92
|
+
begin
|
93
|
+
token = File.open(config['token-file']) { |f| f.read.strip }
|
94
|
+
if token != URI.escape(token)
|
95
|
+
raise OrchestratorClient::ConfigError.new("token-file '#{config['token-file']}' contains illegal characters")
|
96
|
+
end
|
97
|
+
@config['token'] = token
|
98
|
+
@config['token']
|
99
|
+
rescue Errno::ENOENT
|
100
|
+
raise OrchestratorClient::ConfigError.new("token-file '#{config['token-file']}' is unreadable")
|
86
101
|
end
|
87
|
-
@config['token'] = token
|
88
|
-
@config['token']
|
89
102
|
end
|
90
103
|
end
|
91
104
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestrator_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|