Skip to content

Commit

Permalink
Vaidate full image name passed in for '--init-image'
Browse files Browse the repository at this point in the history
  • Loading branch information
JadeRedworth committed Sep 25, 2018
1 parent 396c29f commit 6b035dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 6b035dc

Please sign in to comment.