Skip to content

Commit

Permalink
Fixup bad rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
wchrisjohnson committed May 25, 2017
1 parent 7d111d6 commit 7072478
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func Provider() terraform.ResourceProvider {
ResourcesMap: map[string]*schema.Resource{
"librato_space": resourceLibratoSpace(),
"librato_space_chart": resourceLibratoSpaceChart(),
"librato_metric": resourceLibratoMetric(),
"librato_alert": resourceLibratoAlert(),
"librato_service": resourceLibratoService(),
},
Expand Down
12 changes: 10 additions & 2 deletions resource_librato_metric.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package librato

import (
"encoding/json"
"fmt"
"log"
"reflect"
Expand Down Expand Up @@ -166,6 +167,7 @@ func resourceLibratoMetricCreate(d *schema.ResourceData, meta interface{}) error

_, err := client.Metrics.Edit(metric)
if err != nil {
log.Printf("[INFO] ERROR creating Metric: %s", err)
return fmt.Errorf("Error creating Librato service: %s", err)
}

Expand Down Expand Up @@ -259,7 +261,8 @@ func resourceLibratoMetricRead(d *schema.ResourceData, meta interface{}) error {
}
return fmt.Errorf("Error reading Librato Metric %s: %s", id, err)
}
log.Printf("[INFO] Received Librato Metric: %+v", *metric)

log.Printf("[INFO] Read Librato Metric: %s", structToString(metric))

return resourceLibratoMetricReadResult(d, metric)
}
Expand Down Expand Up @@ -400,7 +403,7 @@ func resourceLibratoMetricDelete(d *schema.ResourceData, meta interface{}) error
if errResp, ok := err.(*librato.ErrorResponse); ok && errResp.Response.StatusCode == 404 {
return nil
}
log.Printf("[DEBUG] unknown error attempting to Get metric: %s", err)
log.Printf("[INFO] non-retryable error attempting to Get metric: %s", err)
return resource.NonRetryableError(err)
}
return resource.RetryableError(fmt.Errorf("metric still exists"))
Expand All @@ -409,3 +412,8 @@ func resourceLibratoMetricDelete(d *schema.ResourceData, meta interface{}) error
d.SetId("")
return nil
}

func structToString(i interface{}) string {
s, _ := json.Marshal(i)
return string(s)
}

0 comments on commit 7072478

Please sign in to comment.