File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 21
21
$certdata = run_task(' peadm::cert_data' , $target ).first.value
22
22
$certname = $certdata [' certname' ]
23
23
24
-
25
-
26
24
$target_is_primary = ($certname == $primary_certname )
27
25
28
26
# These vars represent what the extensions currently are, vs. what they should be
68
66
# fail the plan unless it's a known circumstance in which it's okay to proceed.
69
67
# Scenario 1: the primary's cert can't be cleaned because it's already revoked.
70
68
# Scenario 2: the primary's cert can't be cleaned because it's been deleted.
71
- # Scenario 3: a component's cert can't be cleaned because it was previously by some other function .
69
+ # Scenario 3: any component's cert can't be cleaned because it's been deleted .
72
70
unless ($target_is_primary and
73
71
($ca_clean_result [merged_output] =~ /certificate revoked/ or
74
- $ca_clean_result [merged_output] =~ /Could not find ' hostcert' / or
75
- $ca_clean_result [merged_output] =~ /Could not find files to clean/) )
72
+ $ca_clean_result [merged_output] =~ /Could not find ' hostcert' /)) or
73
+ ( $ca_clean_result [merged_output] =~ /Could not find files to clean/)
76
74
{
77
- fail_plan($ca_clean_result )
75
+ fail_plan($ca_clean_result [merged_output] )
78
76
}
79
77
}
80
78
Original file line number Diff line number Diff line change 40
40
$certstatus = run_task(' peadm::cert_valid_status' , $primary_target ,
41
41
certname => $agent_target .peadm::certname()).first.value
42
42
43
+ # Obtain data about certificate from agent
44
+ $certdata = run_task(' peadm::cert_data' , $agent_target ).first.value
45
+
43
46
if ($certstatus [' certificate-status' ] == ' invalid' ) {
44
47
$force_regenerate = true
45
48
$skip_csr = true
46
49
} else {
50
+ if $certdata [' certificate-exists' ] and $certstatus [' reason' ] =~ /The private key is missing from/ {
51
+ out::message("Agent: ${agent_target.peadm::certname()} has a local cert but Primary: ${primary_target.peadm::certname()} does not, force agent clean" )
52
+ run_task('peadm::ssl_clean', $agent_target , certname => $agent_target .peadm::certname())
53
+ }
47
54
$force_regenerate = false
48
55
$skip_csr = false
49
-
50
56
}
51
57
52
58
# Ensures scenarios where agent was pre-installed but never on-boarding and
You can’t perform that action at this time.
0 commit comments