Show warning when user tries to create a function with a non-existent environment (#436)
Show warning when user try to create a function with non-existent environment
This commit is contained in:
committed by
Soam Vasani
parent
0a733b20c3
commit
4f7eb19b7c
@@ -106,6 +106,19 @@ func fnCreate(c *cli.Context) error {
|
|||||||
fatal("Need --env argument.")
|
fatal("Need --env argument.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// examine existence of given environment
|
||||||
|
_, err := client.EnvironmentGet(&metav1.ObjectMeta{
|
||||||
|
Namespace: metav1.NamespaceDefault,
|
||||||
|
Name: envName,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
if e, ok := err.(fission.Error); ok && e.Code == fission.ErrorNotFound {
|
||||||
|
fmt.Printf("Environment \"%v\" does not exist. Please create the environment before executing the function. \nFor example: `fission env create --name %v --image <image>`\n", envName, envName)
|
||||||
|
} else {
|
||||||
|
checkErr(err, "retrieve environment information")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
srcArchiveName := c.String("src")
|
srcArchiveName := c.String("src")
|
||||||
deployArchiveName := c.String("code")
|
deployArchiveName := c.String("code")
|
||||||
if len(deployArchiveName) == 0 {
|
if len(deployArchiveName) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user