Commit 71ee5be1 authored by Arie Peterson's avatar Arie Peterson

Tweak logging cosmos errors

parent 175b77b0
......@@ -71,6 +71,7 @@ func (p *GreenhostProvisioner) Provision(options controller.VolumeOptions) (*v1.
ProjectID: p.projectID,
}
// The Cosmos API returns a description of the created disk image.
glog.Infof("Creating new disk image with specs %v", specs)
diskImage, err := p.cosmosClient.CreateDiskImage(&specs)
if err != nil {
glog.Warningf("Error in creating new disk image %v", err)
......
......@@ -101,8 +101,7 @@ func (cc *CosmosClient) DeleteDiskImage(id string) bool {
glog.Warningf("Error reading Cosmos2 response: %v", err)
return false
}
glog.Warningf("Cosmos2 failed to delete disk: %d %s", resp.StatusCode, responseData)
glog.Warningf("Error when deleting disk: %d", resp.StatusCode)
glog.Warningf("Cosmos2 failed to delete disk with ID %s returning: %d %s", id, resp.StatusCode, responseData)
return false
}
}
......@@ -123,21 +122,21 @@ type Droplet struct {
func (cc *CosmosClient) GetInstanceData() (*string, error) {
resp, err := cc.ApiCall("GET", "/droplets/"+cc.InstanceID, nil)
if err != nil {
glog.Fatalf("Could not get instance data: %v", err)
return nil, err
}
if resp.StatusCode >= 400 {
responseData, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
err = errors.New("Cosmos2 could not get use the instance data: " + string(responseData))
err = errors.New("Cosmos2 could not get the instance data: " + string(responseData))
return nil, err
}
var instanceResponse InstanceResponse
err = json.NewDecoder(resp.Body).Decode(&instanceResponse)
if err != nil {
glog.Fatalf("Error in JSON decoding: %v", err)
return nil, err
}
// `nil` means the `project_id` field is not present in the response json.
projectID := instanceResponse.Droplet.ProjectID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment