diff --git a/commands/init.go b/commands/init.go index 9b61a6f5..492c94de 100644 --- a/commands/init.go +++ b/commands/init.go @@ -208,7 +208,7 @@ func (a *initFnCmd) init(c *cli.Context) error { a.triggerType = strings.ToLower(a.triggerType) ok := validateTriggerType(a.triggerType) if !ok { - return fmt.Errorf("Init does not support the trigger type '%s'.\n", a.triggerType, " Permitted values are 'http'.") + return fmt.Errorf("Init does not support the trigger type '%s'.\n Permitted values are 'http'.", a.triggerType) } trig := make([]common.Trigger, 1) @@ -246,6 +246,10 @@ func (a *initFnCmd) init(c *cli.Context) error { a.ff.Schema_version = common.LatestYamlVersion if initImage != "" { + err = common.ValidateFullImageName(initImage) + if err != nil { + return err + } err = runInitImage(initImage, a) if err != nil { diff --git a/common/common.go b/common/common.go index a766e722..fc7af9e1 100644 --- a/common/common.go +++ b/common/common.go @@ -503,7 +503,6 @@ func DockerPushV20180708(ff *FuncFileV20180708) error { // remember that private registries must be supported here func ValidateFullImageName(n string) error { parts := strings.Split(n, "/") - fmt.Println("Parts: ", parts) if len(parts) < 2 { return errors.New("image name must have a dockerhub owner or private registry. Be sure to set FN_REGISTRY env var, pass in --registry or configure your context file") diff --git a/test/cli_init_test.go b/test/cli_init_test.go index c09a3b90..5c5b3d03 100644 --- a/test/cli_init_test.go +++ b/test/cli_init_test.go @@ -69,8 +69,9 @@ func TestInitImage(t *testing.T) { // Lets use it h.Cd("") newFuncName := h.NewFuncName(appName) + newInitImageName := "tester/" + origFuncName + "-init:0.0.1" - h.Fn("init", "--init-image", origFuncName+"-init", newFuncName) + h.Fn("init", "--init-image", newInitImageName, newFuncName) h.Cd(newFuncName) h.Fn("run").AssertSuccess()