puppetserver-ca 1.2.0 → 1.2.1

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: 738624da584684a68fc407803548fb3d4b6855aa
4
- data.tar.gz: cb3ff01a01b44468687668a39ca957d7496038a4
3
+ metadata.gz: 68f6a3c820f9dd32b2df38855a1e03249cb89ba0
4
+ data.tar.gz: b885a1ad3e176010f2e36a63f6940b0bab7501ad
5
5
  SHA512:
6
- metadata.gz: 8ba3e5d5f070022ed1c2d88cc388b18de694782846a836490c3309cd7fe1fa85cfe60943ead8f422911920638ae84099d471b734bf39191e1ea8901d605aaa0d
7
- data.tar.gz: e0ec48b8a594b342e47962addc05c0b08976aa06bc335a63c181dc1fd2dbab60cca1a5cd38ebd7b911c8713c2675ac6029fbd6fa9b9e2007939a42dc1841902a
6
+ metadata.gz: 809c1ce65101f0c3f9aa908540070c59114aae9551170875177c87518e4e43111ebcaa3f8f29b0e400a2dd8e0d5ce996fbf01e35766b395d2c6443086a36ffdd
7
+ data.tar.gz: f2975078313f77c519c45eb03ccc70272efdad3f859863c97e07a3a800e37ae2fd2e086ad534367eb86b3b86f39272d1428754457150fdf8b8174dd8cb1a5025
@@ -75,8 +75,8 @@ BANNER
75
75
  parsed['subject-alt-names'] = sans
76
76
  end
77
77
  opts.on('--ca-client',
78
- 'Whether this cert will be used to request CA actions.\
79
- Causes the cert to be generated offline.') do |ca_client|
78
+ 'Whether this cert will be used to request CA actions.',
79
+ 'Causes the cert to be generated offline.') do |ca_client|
80
80
  parsed['ca-client'] = true
81
81
  end
82
82
  end
@@ -168,9 +168,12 @@ BANNER
168
168
  end
169
169
  end
170
170
  true
171
- rescue Errno::ECONNREFUSED => e
172
- # Couldn't make a connection
173
- false
171
+ rescue Puppetserver::Ca::ConnectionFailed => e
172
+ if e.wrapped.is_a? Errno::ECONNREFUSED
173
+ return false
174
+ else
175
+ raise e
176
+ end
174
177
  end
175
178
  end
176
179
 
@@ -1,6 +1,20 @@
1
1
  module Puppetserver
2
2
  module Ca
3
- class Error < StandardError; end
3
+ class Error < StandardError
4
+ def self.create(ex, msg)
5
+ created = new(msg)
6
+ created.wrap(ex)
7
+
8
+ created
9
+ end
10
+
11
+ attr_reader :wrapped
12
+
13
+ def wrap(ex)
14
+ @wrapped = ex
15
+ end
16
+ end
17
+
4
18
  class FileNotFound < Error; end
5
19
  class InvalidX509Object < Error; end
6
20
  class ConnectionFailed < Error; end
@@ -58,9 +58,9 @@ module Puppetserver
58
58
  cert: @cert, key: @key,
59
59
  &request)
60
60
  rescue StandardError => e
61
- raise ConnectionFailed.new(
62
- "Failed connecting to #{url.full_url}\n" +
63
- " Root cause: #{e.message}")
61
+ raise ConnectionFailed.create(e,
62
+ "Failed connecting to #{url.full_url}\n" +
63
+ " Root cause: #{e.message}")
64
64
  end
65
65
  end
66
66
 
@@ -70,12 +70,14 @@ module Puppetserver
70
70
  begin
71
71
  content = File.read(path)
72
72
  block.call(content)
73
- rescue Errno::ENOENT
74
- raise FileNotFound.new("Could not find '#{setting}' at '#{path}'")
73
+ rescue Errno::ENOENT => e
74
+ raise FileNotFound.create(e,
75
+ "Could not find '#{setting}' at '#{path}'")
76
+
75
77
  rescue OpenSSL::OpenSSLError => e
76
- raise InvalidX509Object.new(
77
- "Could not parse '#{setting}' at '#{path}'.\n" +
78
- " OpenSSL returned: #{e.message}")
78
+ raise InvalidX509Object.create(e,
79
+ "Could not parse '#{setting}' at '#{path}'.\n" +
80
+ " OpenSSL returned: #{e.message}")
79
81
  end
80
82
  end
81
83
 
@@ -1,5 +1,5 @@
1
1
  module Puppetserver
2
2
  module Ca
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetserver-ca
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2018-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter