builtin/providers/aws: vet fix
Fixes the following vet reports: builtin/providers/aws/resource_aws_network_acl.go:191: wrong number of args for format in Errorf call: 2 needed but 3 args builtin/providers/aws/resource_aws_network_acl.go:264: wrong number of args for format in Errorf call: 1 needed but 2 args builtin/providers/aws/resource_aws_network_acl.go:268: wrong number of args for format in Errorf call: 1 needed but 2 args builtin/providers/aws/resource_aws_network_acl.go:286: arg m[to_port].(int) for printf verb %s of wrong type: int builtin/providers/aws/resource_aws_network_acl_test.go:277: arg r.NetworkAcls for printf verb %s of wrong type: []github.com/mitchellh/goamz/ec2.NetworkAcl builtin/providers/aws/resource_aws_subnet_test.go:21: arg v.MapPublicIpOnLaunch for printf verb %s of wrong type: bool
This commit is contained in:
parent
95fa353ee9
commit
4f3f85b165
|
@ -188,7 +188,7 @@ func resourceAwsNetworkAclUpdate(d *schema.ResourceData, meta interface{}) error
|
||||||
newSubnet := n.(string)
|
newSubnet := n.(string)
|
||||||
association, err := findNetworkAclAssociation(newSubnet, ec2conn)
|
association, err := findNetworkAclAssociation(newSubnet, ec2conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to update acl %s with subnet %s: ", d.Id(), newSubnet, err)
|
return fmt.Errorf("Failed to update acl %s with subnet %s: %s", d.Id(), newSubnet, err)
|
||||||
}
|
}
|
||||||
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, d.Id())
|
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, d.Id())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -219,9 +219,9 @@ func updateNetworkAclEntries(d *schema.ResourceData, entryType string, ec2conn *
|
||||||
|
|
||||||
os := o.(*schema.Set)
|
os := o.(*schema.Set)
|
||||||
ns := n.(*schema.Set)
|
ns := n.(*schema.Set)
|
||||||
|
|
||||||
toBeDeleted, err := expandNetworkAclEntries(os.Difference(ns).List(), entryType)
|
toBeDeleted, err := expandNetworkAclEntries(os.Difference(ns).List(), entryType)
|
||||||
if(err != nil){
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, remove := range toBeDeleted {
|
for _, remove := range toBeDeleted {
|
||||||
|
@ -233,7 +233,7 @@ func updateNetworkAclEntries(d *schema.ResourceData, entryType string, ec2conn *
|
||||||
}
|
}
|
||||||
|
|
||||||
toBeCreated, err := expandNetworkAclEntries(ns.Difference(os).List(), entryType)
|
toBeCreated, err := expandNetworkAclEntries(ns.Difference(os).List(), entryType)
|
||||||
if(err != nil){
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, add := range toBeCreated {
|
for _, add := range toBeCreated {
|
||||||
|
@ -261,11 +261,11 @@ func resourceAwsNetworkAclDelete(d *schema.ResourceData, meta interface{}) error
|
||||||
// This means the subnet is attached to default acl of vpc.
|
// This means the subnet is attached to default acl of vpc.
|
||||||
association, err := findNetworkAclAssociation(d.Get("subnet_id").(string), ec2conn)
|
association, err := findNetworkAclAssociation(d.Get("subnet_id").(string), ec2conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Depedency voilation: Can not delete acl: %s", d.Id(), err)
|
return fmt.Errorf("Dependency violation: Cannot delete acl %s: %s", d.Id(), err)
|
||||||
}
|
}
|
||||||
defaultAcl, err := getDefaultNetworkAcl(d.Get("vpc_id").(string), ec2conn)
|
defaultAcl, err := getDefaultNetworkAcl(d.Get("vpc_id").(string), ec2conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Depedency voilation: Can not delete acl %s", d.Id(), err)
|
return fmt.Errorf("Dependency violation: Cannot delete acl %s: %s", d.Id(), err)
|
||||||
}
|
}
|
||||||
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, defaultAcl.NetworkAclId)
|
_, err = ec2conn.ReplaceNetworkAclAssociation(association.NetworkAclAssociationId, defaultAcl.NetworkAclId)
|
||||||
return resource.RetryError{err}
|
return resource.RetryError{err}
|
||||||
|
@ -283,7 +283,7 @@ func resourceAwsNetworkAclEntryHash(v interface{}) int {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
m := v.(map[string]interface{})
|
m := v.(map[string]interface{})
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["from_port"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["from_port"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%s-", m["to_port"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["to_port"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["rule_no"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["rule_no"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%s-", m["action"].(string)))
|
buf.WriteString(fmt.Sprintf("%s-", m["action"].(string)))
|
||||||
buf.WriteString(fmt.Sprintf("%s-", m["protocol"].(string)))
|
buf.WriteString(fmt.Sprintf("%s-", m["protocol"].(string)))
|
||||||
|
|
|
@ -274,7 +274,7 @@ func testAccCheckSubnetIsAssociatedWithAcl(acl string, sub string) resource.Test
|
||||||
}
|
}
|
||||||
|
|
||||||
r, _ := conn.NetworkAcls([]string{}, ec2.NewFilter())
|
r, _ := conn.NetworkAcls([]string{}, ec2.NewFilter())
|
||||||
fmt.Printf("\n\nall acls\n %s\n\n", r.NetworkAcls)
|
fmt.Printf("\n\nall acls\n %#v\n\n", r.NetworkAcls)
|
||||||
conn.NetworkAcls([]string{}, filter)
|
conn.NetworkAcls([]string{}, filter)
|
||||||
|
|
||||||
return fmt.Errorf("Network Acl %s is not associated with subnet %s", acl, sub)
|
return fmt.Errorf("Network Acl %s is not associated with subnet %s", acl, sub)
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestAccAWSSubnet(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.MapPublicIpOnLaunch != true {
|
if v.MapPublicIpOnLaunch != true {
|
||||||
return fmt.Errorf("bad MapPublicIpOnLaunch: %s", v.MapPublicIpOnLaunch)
|
return fmt.Errorf("bad MapPublicIpOnLaunch: %t", v.MapPublicIpOnLaunch)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue