@@ -59,9 +59,6 @@ def next_state
59
59
now = Time . now
60
60
last_update = @cert_provider . ca_last_update
61
61
if needs_refresh? ( now , last_update )
62
- # set last updated time first, then make a best effort to refresh
63
- @cert_provider . ca_last_update = now
64
-
65
62
# If we refresh the CA, then we need to force the CRL to be refreshed too,
66
63
# since if there is a new CA in the chain, then we need its CRL to check
67
64
# the full chain for revocation status.
@@ -114,7 +111,12 @@ def refresh_ca(ssl_ctx, last_update)
114
111
Puppet . info ( _ ( "Refreshing CA certificate" ) )
115
112
116
113
# return the next_ctx containing the updated ca
117
- [ download_ca ( ssl_ctx , last_update ) , true ]
114
+ next_ctx = [ download_ca ( ssl_ctx , last_update ) , true ]
115
+
116
+ # After a successful refresh, update ca_last_update
117
+ @cert_provider . ca_last_update = Time . now
118
+
119
+ next_ctx
118
120
rescue Puppet ::HTTP ::ResponseError => e
119
121
if e . response . code == 304
120
122
Puppet . info ( _ ( "CA certificate is unmodified, using existing CA certificate" ) )
@@ -171,8 +173,6 @@ def next_state
171
173
now = Time . now
172
174
last_update = @cert_provider . crl_last_update
173
175
if needs_refresh? ( now , last_update )
174
- # set last updated time first, then make a best effort to refresh
175
- @cert_provider . crl_last_update = now
176
176
next_ctx = refresh_crl ( next_ctx , last_update )
177
177
end
178
178
else
@@ -209,7 +209,12 @@ def refresh_crl(ssl_ctx, last_update)
209
209
Puppet . info ( _ ( "Refreshing CRL" ) )
210
210
211
211
# return the next_ctx containing the updated crl
212
- download_crl ( ssl_ctx , last_update )
212
+ next_ctx = download_crl ( ssl_ctx , last_update )
213
+
214
+ # After a successful refresh, update crl_last_update
215
+ @cert_provider . crl_last_update = Time . now
216
+
217
+ next_ctx
213
218
rescue Puppet ::HTTP ::ResponseError => e
214
219
if e . response . code == 304
215
220
Puppet . info ( _ ( "CRL is unmodified, using existing CRL" ) )
0 commit comments