diff options
-rw-r--r-- | provider.go | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/provider.go b/provider.go index f09ffdf..9c7e6f1 100644 --- a/provider.go +++ b/provider.go @@ -226,34 +226,25 @@ func (p *Provider) pollStatus(uri string) error { t := time.NewTicker(p.poll) defer t.Stop() for range t.C { - done, err := p.queryStatus(uri) + resp, err := p.Get(uri) if err != nil { return err } - if done { + r := new(Challenge) + err = parseJson(resp, r) + if err != nil { + return err + } + if r.Err != nil { + return r.Err + } + if r.Status == StatusValid { return nil } } return nil } -func (p *Provider) queryStatus(uri string) (bool, error) { - resp, err := p.Get(uri) - if err != nil { - return false, err - } - r := new(Challenge) - err = parseJson(resp, r) - if err != nil { - return false, err - } - log.Println("status", r.Status) - if r.Err != nil { - return false, r.Err - } - return r.Status == StatusValid, nil -} - func (p *Provider) Bundle(s Signer, d *Desire) error { // first step: post csr csr, err := d.CSR() |