Skip to content

Commit

Permalink
respond to review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
danawillow committed Jul 5, 2017
1 parent f139af8 commit b95e120
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
11 changes: 11 additions & 0 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,14 @@ func linkDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
}
return false
}

func convertStringArr(ifaceArr []interface{}) []string {
var arr []string
for _, v := range ifaceArr {
if v == nil {
continue
}
arr = append(arr, v.(string))
}
return arr
}
11 changes: 0 additions & 11 deletions google/resource_compute_target_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,6 @@ func resourceComputeTargetPool() *schema.Resource {
}
}

func convertStringArr(ifaceArr []interface{}) []string {
var arr []string
for _, v := range ifaceArr {
if v == nil {
continue
}
arr = append(arr, v.(string))
}
return arr
}

// Healthchecks need to exist before being referred to from the target pool.
func convertHealthChecks(config *Config, project string, names []string) ([]string, error) {
urls := make([]string, len(names))
Expand Down
6 changes: 5 additions & 1 deletion google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,11 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
}

if d.HasChange("additional_zones") {
azs := convertStringArr(d.Get("additional_zones").(*schema.Set).List())
azSet := d.Get("additional_zones").(*schema.Set)
if azSet.Contains(zoneName) {
return fmt.Errorf("additional_zones should not contain the original 'zone'.")
}
azs := convertStringArr(azSet.List())
locations := append(azs, zoneName)
req := &container.UpdateClusterRequest{
Update: &container.ClusterUpdate{
Expand Down
6 changes: 1 addition & 5 deletions google/resource_container_cluster_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ func resourceContainerClusterMigrateState(
switch v {
case 0:
log.Println("[INFO] Found Container Cluster State v0; migrating to v1")
is, err := migrateClusterStateV0toV1(is)
if err != nil {
return is, err
}
return is, nil
return migrateClusterStateV0toV1(is)
default:
return is, fmt.Errorf("Unexpected schema version: %d", v)
}
Expand Down
4 changes: 2 additions & 2 deletions google/resource_container_cluster_migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ func TestContainerClusterMigrateState(t *testing.T) {
"change additional_zones from list to set": {
StateVersion: 0,
Attributes: map[string]string{
"additional_zones.#": "1",
"additional_zones.#": "2",
"additional_zones.0": "us-central1-c",
"additional_zones.1": "us-central1-b",
},
Expected: map[string]string{
"additional_zones.#": "1",
"additional_zones.#": "2",
"additional_zones.90274510": "us-central1-c",
"additional_zones.1919306328": "us-central1-b",
},
Expand Down

0 comments on commit b95e120

Please sign in to comment.