🐛 Fix a bug.
This commit is contained in:
parent
01053b2df5
commit
14250ad7ae
12
main.go
12
main.go
@ -27,6 +27,11 @@ func main() {
|
||||
case "restart":
|
||||
action = restart
|
||||
case "update":
|
||||
// 如果image和tag有空值,报错
|
||||
if os.Getenv("PLUGIN_IMAGE") == "" || os.Getenv("PLUGIN_TAG") == "" {
|
||||
panic("Configuration item image or tag must not be empty")
|
||||
return
|
||||
}
|
||||
action = update
|
||||
}
|
||||
}
|
||||
@ -43,21 +48,25 @@ func main() {
|
||||
Action: action,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "cluster",
|
||||
Usage: "cluster name",
|
||||
EnvVars: []string{"PLUGIN_CLUSTER"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "kind",
|
||||
Usage: "workload type",
|
||||
EnvVars: []string{"PLUGIN_KIND"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "name",
|
||||
Usage: "workload name",
|
||||
EnvVars: []string{"PLUGIN_NAME"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "namespace",
|
||||
Usage: "workload namespace",
|
||||
EnvVars: []string{"PLUGIN_NAMESPACE"},
|
||||
@ -73,16 +82,19 @@ func main() {
|
||||
EnvVars: []string{"PLUGIN_TAG"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "kuboard_uri",
|
||||
Usage: "kuboard uri",
|
||||
EnvVars: []string{"PLUGIN_KUBOARD_URI"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "kuboard_username",
|
||||
Usage: "kuboard username",
|
||||
EnvVars: []string{"PLUGIN_KUBOARD_USERNAME"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Required: true,
|
||||
Name: "kuboard_key",
|
||||
Usage: "kuboard access key",
|
||||
EnvVars: []string{"PLUGIN_KUBOARD_KEY"},
|
||||
|
Loading…
Reference in New Issue
Block a user