File tree 2 files changed +17
-13
lines changed
2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,21 @@ def allow_standard_non_returning_calls
11
11
12
12
describe 'basic functionality' do
13
13
let ( :params ) { { 'primary_host' => 'primary' , 'replica_host' => 'replica' } }
14
- let ( :certdata ) { {
15
- 'certificate-exists' => true ,
16
- 'certname' => 'primary' ,
17
- 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } ,
18
- 'dns-alt-names' => [ ]
19
- } }
20
- let ( :certstatus ) { {
21
- 'certificate-status' => 'valid' ,
22
- 'reason' => 'Expires - 2099-01-01 00:00:00 UTC'
23
- } }
24
14
let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
15
+ let ( :certdata ) do
16
+ {
17
+ 'certificate-exists' => true ,
18
+ 'certname' => 'primary' ,
19
+ 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } ,
20
+ 'dns-alt-names' => [ ]
21
+ }
22
+ end
23
+ let ( :certstatus ) do
24
+ {
25
+ 'certificate-status' => 'valid' ,
26
+ 'reason' => 'Expires - 2099-01-01 00:00:00 UTC'
27
+ }
28
+ end
25
29
26
30
it 'runs successfully when the primary does not have alt-names' do
27
31
allow_standard_non_returning_calls
Original file line number Diff line number Diff line change 4
4
require 'puppet'
5
5
require 'json'
6
6
7
- $ params = JSON . parse ( STDIN . read )
7
+ params = JSON . parse ( STDIN . read )
8
8
9
9
Puppet . initialize_settings
10
10
14
14
cert_provider = Puppet ::X509 ::CertProvider . new
15
15
ssl_provider = Puppet ::SSL ::SSLProvider . new
16
16
password = cert_provider . load_private_key_password
17
- ssl_context = ssl_provider . load_context ( certname : $ params[ 'certname' ] , password : password )
17
+ ssl_context = ssl_provider . load_context ( certname : params [ 'certname' ] , password : password )
18
18
rescue Puppet ::SSL ::CertVerifyError => e
19
19
status = { 'certificate-status' => 'invalid' , 'reason' => e . message }
20
20
rescue Puppet ::Error => e
27
27
result = status
28
28
29
29
# Put the result to stdout
30
- puts result . to_json
30
+ puts result . to_json
You can’t perform that action at this time.
0 commit comments