aboutsummaryrefslogtreecommitdiff
path: root/provider.go
diff options
context:
space:
mode:
Diffstat (limited to 'provider.go')
-rw-r--r--provider.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/provider.go b/provider.go
index 5b7a66a..6174440 100644
--- a/provider.go
+++ b/provider.go
@@ -45,11 +45,7 @@ func NewProvider(directory string) (*Provider, error) {
Timeout: time.Duration(5 * time.Second),
},
}
- err := p.getJson(directory, &p.Directory)
- if err != nil {
- return nil, err
- }
- return p, nil
+ return p, p.getJson(directory, &p.Directory)
}
func (p *Provider) post(uri string, s Signer, v interface{}) (*http.Response, error) {
@@ -246,14 +242,10 @@ func (p *Provider) queryStatus(url string) (bool, error) {
return false, err
}
log.Println("status", r.Status)
- switch r.Status {
- case StatusValid:
- return true, nil
- case StatusPending:
- return false, nil
- default:
+ if r.Error != nil {
return false, r.Error
}
+ return r.Status == StatusValid, nil
}
func (p *Provider) newCert(uri string, s Signer, d *Desire) (*x509.Certificate, nextStep, error) {