From 2056fda4d3a91e670f628f554b0fcb0e3725bddd Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Wed, 10 Jun 2015 16:19:36 -0500 Subject: [PATCH] builder/amazon: Allow spaces in AMI names --- builder/amazon/common/template_funcs.go | 2 +- builder/amazon/common/template_funcs_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/amazon/common/template_funcs.go b/builder/amazon/common/template_funcs.go index 45f68af92..30d49fdb4 100644 --- a/builder/amazon/common/template_funcs.go +++ b/builder/amazon/common/template_funcs.go @@ -20,7 +20,7 @@ func isalphanumeric(b byte) bool { // Clean up AMI name by replacing invalid characters with "-" func templateCleanAMIName(s string) string { - allowed := []byte{'(', ')', ',', '/', '-', '_'} + allowed := []byte{'(', ')', ',', '/', '-', '_', ' '} b := []byte(s) newb := make([]byte, len(b)) for i, c := range b { diff --git a/builder/amazon/common/template_funcs_test.go b/builder/amazon/common/template_funcs_test.go index 0e8c568ef..e4126bf61 100644 --- a/builder/amazon/common/template_funcs_test.go +++ b/builder/amazon/common/template_funcs_test.go @@ -5,8 +5,8 @@ import ( ) func TestAMITemplatePrepare_clean(t *testing.T) { - origName := "AMZamz09(),/-_:&^$%" - expected := "AMZamz09(),/-_-----" + origName := "AMZamz09(),/-_:&^ $%" + expected := "AMZamz09(),/-_--- --" name := templateCleanAMIName(origName)