Fix typographical errors in the fixers

This commit is contained in:
Akshat Mahajan 2019-04-01 23:42:31 -07:00
parent f07e4214cc
commit 22504200cc
2 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@ func (FixerAmazonTemporarySecurityCIDRs) Fix(input map[string]interface{}) (map[
return nil, err
}
// Go through each builder and replace the temporary_security_group_cidr if we can
// Go through each builder and replace the temporary_security_group_source_cidr if we can
for _, builder := range tpl.Builders {
builderTypeRaw, ok := builder["type"]
if !ok {
@ -35,13 +35,13 @@ func (FixerAmazonTemporarySecurityCIDRs) Fix(input map[string]interface{}) (map[
continue
}
temporarySecurityGroupCIDR, ok := builder["temporary_security_group_cidr"].(string)
temporarySecurityGroupCIDR, ok := builder["temporary_security_group_source_cidr"].(string)
if !ok {
continue
}
delete(builder, "temporary_security_group_cidr")
builder["temporary_security_group_cidrs"] = []string{temporarySecurityGroupCIDR}
delete(builder, "temporary_security_group_source_cidr")
builder["temporary_security_group_source_cidrs"] = []string{temporarySecurityGroupCIDR}
}
input["builders"] = tpl.Builders
@ -49,5 +49,5 @@ func (FixerAmazonTemporarySecurityCIDRs) Fix(input map[string]interface{}) (map[
}
func (FixerAmazonTemporarySecurityCIDRs) Synopsis() string {
return `Replaces "temporary_security_group_cidr" (string) with "temporary_security_group_cidrs" (list of strings)`
return `Replaces "temporary_security_group_source_cidr" (string) with "temporary_security_group_source_cidrs" (list of strings)`
}

View File

@ -16,13 +16,13 @@ func TestFixerAmazonTemporarySecurityCIDRs(t *testing.T) {
}{
{
Input: map[string]interface{}{
"type": "amazon-ebs",
"temporary_security_group_cidr": "0.0.0.0/0",
"type": "amazon-ebs",
"temporary_security_group_source_cidr": "0.0.0.0/0",
},
Expected: map[string]interface{}{
"type": "amazon-ebs",
"temporary_security_group_cidrs": []string{"0.0.0.0/0"},
"type": "amazon-ebs",
"temporary_security_group_source_cidrs": []string{"0.0.0.0/0"},
},
},
}