diff --git a/fix/fixer_amazon_private_ip.go b/fix/fixer_amazon_private_ip.go index 7b0189ca5..5fd11d60a 100644 --- a/fix/fixer_amazon_private_ip.go +++ b/fix/fixer_amazon_private_ip.go @@ -1,7 +1,7 @@ package fix import ( - "log" + "fmt" "strconv" "strings" @@ -53,8 +53,7 @@ func (FixerAmazonPrivateIP) Fix(input map[string]interface{}) (map[string]interf var err error privateIP, err = strconv.ParseBool(privateIPi.(string)) if err != nil { - log.Fatalf("Wrong type for ssh_private_ip") - continue + return nil, fmt.Errorf("ssh_private_ip is not a boolean, %s", err) } } diff --git a/fix/fixer_amazon_private_ip_test.go b/fix/fixer_amazon_private_ip_test.go index 71961f2f8..55b2104a6 100644 --- a/fix/fixer_amazon_private_ip_test.go +++ b/fix/fixer_amazon_private_ip_test.go @@ -75,3 +75,19 @@ func TestFixerAmazonPrivateIP(t *testing.T) { } } } + +func TestFixerAmazonPrivateIPNonBoolean(t *testing.T) { + var f FixerAmazonPrivateIP + + input := map[string]interface{}{ + "builders": []map[string]interface{}{{ + "type": "amazon-ebs", + "ssh_private_ip": "not-a-boolean-value", + }}, + } + + _, err := f.Fix(input) + if err == nil { + t.Fatal("should have errored") + } +}