Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 2 additions & 1 deletion test/cli_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down