Merge pull request #7336 from dkuntz2/make-private-ip-fixer-error-more-clearly
Make the amazon-private-ip fixer errors more visible
This commit is contained in:
commit
b32449cdcc
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue