Installer: Handle VM uninstall before it has had a time to boot
Change-Id: I615bc949b5054b301899b1e0b7eae94a98126e61
diff --git a/core/installer/vpn.go b/core/installer/vpn.go
index beeb8e4..0176383 100644
--- a/core/installer/vpn.go
+++ b/core/installer/vpn.go
@@ -65,10 +65,11 @@
if err != nil {
return err
}
- if resp.StatusCode != http.StatusOK {
- var buf bytes.Buffer
- io.Copy(&buf, resp.Body)
- return errors.New(buf.String())
+ if resp.StatusCode == http.StatusOK {
+ return nil
+ }
+ if resp.StatusCode == http.StatusNotFound {
+ return ErrorNotFound
}
return nil
}
@@ -82,10 +83,11 @@
if err != nil {
return err
}
- if resp.StatusCode != http.StatusOK {
- var buf bytes.Buffer
- io.Copy(&buf, resp.Body)
- return errors.New(buf.String())
+ if resp.StatusCode == http.StatusOK {
+ return nil
+ }
+ if resp.StatusCode == http.StatusNotFound {
+ return ErrorNotFound
}
return nil
}
@@ -103,10 +105,11 @@
if err != nil {
return err
}
- if resp.StatusCode != http.StatusOK {
- var buf bytes.Buffer
- io.Copy(&buf, resp.Body)
- return errors.New(buf.String())
+ if resp.StatusCode == http.StatusOK {
+ return nil
+ }
+ if resp.StatusCode == http.StatusNotFound {
+ return ErrorNotFound
}
return nil
}