aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-01-12 22:50:21 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-01-12 22:50:21 +0100
commit9244202a525b9d9a562c26f99545f2b86ede434e (patch)
tree38b1e31f473960897c5624045ca49b1f367c2f78
parent239b5b21faf3002d435222a8bf56880fd09d6e31 (diff)
Simplify
-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) {