orchestrator_client 0.4.2 → 0.4.3

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: 1655b1aa31a89732df80a7f25e81539f1573e19f
4
- data.tar.gz: e543181e950953e5c4a23b1b41ff7ff0086c4c82
3
+ metadata.gz: d179d85c7b1f2e913b992219e730f1fbe8af33c0
4
+ data.tar.gz: ca300a02de26f8669081e5a182e87177334498d7
5
5
  SHA512:
6
- metadata.gz: d0bf2e0130058d42004f2da6ec971f1cb19882d08a7e519d21862b35234ed8ed6118c5c29d04b42c891f445b96c9d324a1242b8702cfff794260c4fdd3f3f1c5
7
- data.tar.gz: 717521ef116e26505e8e5aef2410ae7de8474e7290f87f482782a572a143a5bdbfe26396d5930b6b354bc17d6c9bdece5a5d31c0cd1e12c0420592e13491c3ff
6
+ metadata.gz: 59fe35d43fac64ba909f69b253ec7cf446d63442e2857c203c5a7235fd4c53b5f15bba11f9096e9dfa7b2243cab833ba3886c1a574da10acdb21474f963e9d24
7
+ data.tar.gz: 05f262caf8791aab7b4883180a54bcec71c2b8bd799778e57a9262ff61115de9d6145e2c2b19e30db323880f094fa16ec614c0e668871f9098c199ade6d4b261
@@ -0,0 +1,2 @@
1
+ # Default to Bolt team
2
+ * @puppetlabs/bolt
@@ -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
- 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")
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
@@ -1,3 +1,3 @@
1
1
  class OrchestratorClient
2
- VERSION = '0.4.2'.freeze
2
+ VERSION = '0.4.3'.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.2
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-03-12 00:00:00.000000000 Z
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