orchestrator_client 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODEOWNERS +2 -0
- data/lib/orchestrator_client/config.rb +25 -10
- data/lib/orchestrator_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d179d85c7b1f2e913b992219e730f1fbe8af33c0
|
4
|
+
data.tar.gz: ca300a02de26f8669081e5a182e87177334498d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fe35d43fac64ba909f69b253ec7cf446d63442e2857c203c5a7235fd4c53b5f15bba11f9096e9dfa7b2243cab833ba3886c1a574da10acdb21474f963e9d24
|
7
|
+
data.tar.gz: 05f262caf8791aab7b4883180a54bcec71c2b8bd799778e57a9262ff61115de9d6145e2c2b19e30db323880f094fa16ec614c0e668871f9098c199ade6d4b261
|
data/CODEOWNERS
ADDED
@@ -55,7 +55,12 @@ class OrchestratorClient::Config
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
config.merge(@overrides)
|
58
|
+
config.merge!(@overrides)
|
59
|
+
|
60
|
+
%w[token-file cacert].each do |f|
|
61
|
+
config[f] = File.expand_path(config[f]) if config[f]
|
62
|
+
end
|
63
|
+
config
|
59
64
|
end
|
60
65
|
|
61
66
|
def validate
|
@@ -75,6 +80,8 @@ class OrchestratorClient::Config
|
|
75
80
|
if config['cacert'].nil?
|
76
81
|
raise OrchestratorClient::ConfigError.new("'cacert' is required in config")
|
77
82
|
end
|
83
|
+
|
84
|
+
validate_file('cacert', config['cacert'])
|
78
85
|
end
|
79
86
|
|
80
87
|
def config
|
@@ -89,16 +96,13 @@ class OrchestratorClient::Config
|
|
89
96
|
if @config['token']
|
90
97
|
@config['token']
|
91
98
|
else
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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")
|
99
|
+
validate_file('token-file', config['token-file'])
|
100
|
+
token = File.open(config['token-file']) { |f| f.read.strip }
|
101
|
+
if token != URI.escape(token)
|
102
|
+
raise OrchestratorClient::ConfigError.new("token-file '#{config['token-file']}' contains illegal characters")
|
101
103
|
end
|
104
|
+
@config['token'] = token
|
105
|
+
@config['token']
|
102
106
|
end
|
103
107
|
end
|
104
108
|
|
@@ -119,4 +123,15 @@ class OrchestratorClient::Config
|
|
119
123
|
def [](key)
|
120
124
|
@config[key]
|
121
125
|
end
|
126
|
+
|
127
|
+
def validate_file(type, path)
|
128
|
+
stat = File.stat(path)
|
129
|
+
if !stat.readable?
|
130
|
+
OrchestratorClient::ConfigError.new("#{type} '#{path}' is unreadable")
|
131
|
+
elsif !stat.file?
|
132
|
+
OrchestratorClient::ConfigError.new("#{type} '#{path}' is not a file")
|
133
|
+
end
|
134
|
+
rescue Errno::ENOENT
|
135
|
+
raise OrchestratorClient::ConfigError.new("#{type} '#{path}' does not exist")
|
136
|
+
end
|
122
137
|
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.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -45,6 +45,7 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- ".gitignore"
|
48
|
+
- CODEOWNERS
|
48
49
|
- CONTRIBUTING.md
|
49
50
|
- Gemfile
|
50
51
|
- LICENSE
|