Compare commits

...

1 Commits

Author SHA1 Message Date
Minghe
779679a809 Remove 'fx call' and 'fx doctor' 2020-03-19 16:54:45 +08:00
4 changed files with 2 additions and 68 deletions

View File

@@ -78,15 +78,13 @@ USAGE:
fx [global options] command [command options] [arguments...]
VERSION:
0.9.32
0.9.33
COMMANDS:
up deploy a function
down destroy a service
list, ls list deployed services
call run a function instantly
image manage image of service
doctor health check for fx
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:

29
fx.go
View File

@@ -19,7 +19,7 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)
const version = "0.9.32"
const version = "0.9.33"
func init() {
go checkForUpdate()
@@ -212,28 +212,6 @@ func main() {
handlers.List,
),
},
{
Name: "call",
Usage: "run a function instantly",
Flags: []cli.Flag{
cli.StringFlag{
Name: "ssh_port, P",
Usage: "SSH port for target host",
Value: "22",
},
cli.StringFlag{
Name: "ssh_key, K",
Usage: "SSH key file for login target host",
Value: defaultSSHKeyFile,
},
cli.StringFlag{
Name: "host, H",
Usage: "fx server host, default is localhost",
Value: defaultHost,
},
},
Action: handle(handlers.Call),
},
{
Name: "image",
Usage: "manage image of service",
@@ -281,11 +259,6 @@ func main() {
},
},
},
{
Name: "doctor",
Usage: "health check for fx",
Action: handle(handlers.Doctor),
},
}
if err := app.Run(os.Args); err != nil {

View File

@@ -1,11 +0,0 @@
package handlers
import (
"github.com/metrue/fx/context"
)
// Call command handle
func Call(ctx context.Contexter) error {
// TODO not supported
return nil
}

View File

@@ -1,26 +0,0 @@
package handlers
import (
"os"
"github.com/apex/log"
"github.com/metrue/fx/constants"
"github.com/metrue/fx/context"
"github.com/metrue/fx/doctor"
)
// Doctor command handle
func Doctor(ctx context.Contexter) error {
host := os.Getenv("DOCKER_REMOTE_HOST_ADDR")
user := os.Getenv("DOCKER_REMOTE_HOST_USER")
password := os.Getenv("DOCKER_REMOTE_HOST_PASSWORD")
if host == "" {
host = "localhost"
}
if err := doctor.New(host, user, password).Start(); err != nil {
log.Warnf("machine %s is in dirty state: %v", host, err)
} else {
log.Infof("machine %s is in healthy state: %s", host, constants.CheckedSymbol)
}
return nil
}