@@ -59,9 +59,6 @@ def next_state
5959 now = Time . now
6060 last_update = @cert_provider . ca_last_update
6161 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-
6562 # If we refresh the CA, then we need to force the CRL to be refreshed too,
6663 # since if there is a new CA in the chain, then we need its CRL to check
6764 # the full chain for revocation status.
@@ -114,7 +111,12 @@ def refresh_ca(ssl_ctx, last_update)
114111 Puppet . info ( _ ( "Refreshing CA certificate" ) )
115112
116113 # 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
118120 rescue Puppet ::HTTP ::ResponseError => e
119121 if e . response . code == 304
120122 Puppet . info ( _ ( "CA certificate is unmodified, using existing CA certificate" ) )
@@ -171,8 +173,6 @@ def next_state
171173 now = Time . now
172174 last_update = @cert_provider . crl_last_update
173175 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
176176 next_ctx = refresh_crl ( next_ctx , last_update )
177177 end
178178 else
@@ -209,7 +209,12 @@ def refresh_crl(ssl_ctx, last_update)
209209 Puppet . info ( _ ( "Refreshing CRL" ) )
210210
211211 # 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
213218 rescue Puppet ::HTTP ::ResponseError => e
214219 if e . response . code == 304
215220 Puppet . info ( _ ( "CRL is unmodified, using existing CRL" ) )
0 commit comments