orchestrator_client 0.4.1 → 0.4.2

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
  SHA1:
3
- metadata.gz: edb40acfb0113456ba1b3999c6f9e093d0999501
4
- data.tar.gz: 39980ed67308f0dd7c3ae9daf7f9636e78c4d22b
3
+ metadata.gz: 1655b1aa31a89732df80a7f25e81539f1573e19f
4
+ data.tar.gz: e543181e950953e5c4a23b1b41ff7ff0086c4c82
5
5
  SHA512:
6
- metadata.gz: 63087f62bdcfedbb2e49d3e6579d5f047fff242fbd1d8291b84e6efcfe398b3f7e82b72ccd05bac3f423c832dce0b99cbf040954b82b9f97d2d6d65665c1d95c
7
- data.tar.gz: 784cf2dd3a28b00cd09b790e0b7a0ee9c70a433c98fc213c4647a706ccba09295b83ba767b4f74dac676cabefb2b6cb51081377987acfe0572547ea726722e87
6
+ metadata.gz: d0bf2e0130058d42004f2da6ec971f1cb19882d08a7e519d21862b35234ed8ed6118c5c29d04b42c891f445b96c9d324a1242b8702cfff794260c4fdd3f3f1c5
7
+ data.tar.gz: 717521ef116e26505e8e5aef2410ae7de8474e7290f87f482782a572a143a5bdbfe26396d5930b6b354bc17d6c9bdece5a5d31c0cd1e12c0420592e13491c3ff
@@ -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
- f.adapter :net_http_persistent, pool_size: 5 do |http|
32
- http.idle_timeout = 30
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
- token = File.open(config['token-file']) { |f| f.read.strip }
84
- if token != URI.escape(token)
85
- raise OrchestratorClient::ConfigError.new("'#{config['token-file']}' contains illegal characters")
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
 
@@ -1,3 +1,3 @@
1
1
  class OrchestratorClient
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
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.1
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-06 00:00:00.000000000 Z
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday