Refactor environment CLI command (#1265)

This commit is contained in:
Ta-Ching Chen
2019-08-27 15:43:59 +08:00
committed by GitHub
parent 560aa34ce2
commit c49377569e
37 changed files with 1976 additions and 1599 deletions
+5 -4
View File
@@ -29,6 +29,7 @@ import (
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/fission-cli/cmd/spec"
"github.com/fission/fission/pkg/fission-cli/log"
"github.com/fission/fission/pkg/fission-cli/util"
)
@@ -106,7 +107,7 @@ func htCreate(c *cli.Context) error {
triggerName := c.String("name")
fnNamespace := c.String("fnNamespace")
spec := c.Bool("spec")
toSpec := c.Bool("spec")
m := &metav1.ObjectMeta{
Name: triggerName,
@@ -135,7 +136,7 @@ func htCreate(c *cli.Context) error {
}
// For Specs, the spec validate checks for function reference
if !spec {
if !toSpec {
err = util.CheckFunctionExistence(client, functionList, fnNamespace)
if err != nil {
log.Warn(err.Error())
@@ -169,9 +170,9 @@ func htCreate(c *cli.Context) error {
}
// if we're writing a spec, don't call the API
if spec {
if toSpec {
specFile := fmt.Sprintf("route-%v.yaml", triggerName)
err := specSave(*ht, specFile)
err := spec.SpecSave(*ht, specFile)
util.CheckErr(err, "create HTTP trigger spec")
return nil
}