Fixed the spec validation UX issue (#898)

Improved some of warnings/messages shown to the user when using `fission spec` command. The `spec validate` command now shows appropriate warnings instead
This commit is contained in:
Vishal
2018-09-21 14:52:49 +05:30
committed by GitHub
parent 6b49c194ca
commit 188138ccd8
5 changed files with 37 additions and 14 deletions
+7 -2
View File
@@ -80,6 +80,7 @@ func htCreate(c *cli.Context) error {
log.Fatal("Need a function name to create a trigger, use --function")
}
fnNamespace := c.String("fnNamespace")
spec := c.Bool("spec")
triggerUrl := c.String("url")
if len(triggerUrl) == 0 {
@@ -94,7 +95,11 @@ func htCreate(c *cli.Context) error {
method = "GET"
}
checkFunctionExistence(client, fnName, fnNamespace)
// For Specs, the spec validate checks for function reference
if !spec {
checkFunctionExistence(client, fnName, fnNamespace)
}
createIngress := false
if c.IsSet("createingress") {
createIngress = c.Bool("createingress")
@@ -123,7 +128,7 @@ func htCreate(c *cli.Context) error {
}
// if we're writing a spec, don't call the API
if c.Bool("spec") {
if spec {
specFile := fmt.Sprintf("route-%v.yaml", triggerName)
err := specSave(*ht, specFile)
util.CheckErr(err, "create HTTP trigger spec")