UpdateIfNeeded performs a refresh only if PKI is in need of a refresh (expired, new CA, etc)
()
| 217 | |
| 218 | // UpdateIfNeeded performs a refresh only if PKI is in need of a refresh (expired, new CA, etc) |
| 219 | func (spec *Spec) UpdateIfNeeded() error { |
| 220 | ca, err := spec.getCurrentCA() |
| 221 | if err != nil { |
| 222 | return err |
| 223 | } |
| 224 | err = spec.validateStoredPKI(ca) |
| 225 | if err == nil { |
| 226 | log.Debugf("spec %s is still valid", spec) |
| 227 | return nil |
| 228 | } |
| 229 | log.Infof("spec %s is needs refresh: %s", spec, err) |
| 230 | return spec.doRefresh(ca) |
| 231 | } |
| 232 | |
| 233 | // ForceUpdate forces a refresh of the PKI content |
| 234 | func (spec *Spec) ForceUpdate() error { |
no test coverage detected