AUTH-2890: adds error handler to cli actions

This commit is contained in:
Michael Borkenstein 2020-07-14 13:21:44 -05:00
parent 3d782f7162
commit 7afde79600
3 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
"github.com/cloudflare/cloudflared/cmd/cloudflared/config" "github.com/cloudflare/cloudflared/cmd/cloudflared/config"
"github.com/cloudflare/cloudflared/logger" "github.com/cloudflare/cloudflared/logger"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -21,12 +22,12 @@ func runApp(app *cli.App, shutdownC, graceShutdownC chan struct{}) {
&cli.Command{ &cli.Command{
Name: "install", Name: "install",
Usage: "Install Argo Tunnel as a system service", Usage: "Install Argo Tunnel as a system service",
Action: installLinuxService, Action: cliutil.ErrorHandler(installLinuxService),
}, },
&cli.Command{ &cli.Command{
Name: "uninstall", Name: "uninstall",
Usage: "Uninstall the Argo Tunnel service", Usage: "Uninstall the Argo Tunnel service",
Action: uninstallLinuxService, Action: cliutil.ErrorHandler(uninstallLinuxService),
}, },
}, },
}) })

View File

@ -8,6 +8,7 @@ import (
"gopkg.in/urfave/cli.v2" "gopkg.in/urfave/cli.v2"
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
"github.com/cloudflare/cloudflared/logger" "github.com/cloudflare/cloudflared/logger"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -24,12 +25,12 @@ func runApp(app *cli.App, shutdownC, graceShutdownC chan struct{}) {
{ {
Name: "install", Name: "install",
Usage: "Install Argo Tunnel as an user launch agent", Usage: "Install Argo Tunnel as an user launch agent",
Action: installLaunchd, Action: cliutil.ErrorHandler(installLaunchd),
}, },
{ {
Name: "uninstall", Name: "uninstall",
Usage: "Uninstall the Argo Tunnel launch agent", Usage: "Uninstall the Argo Tunnel launch agent",
Action: uninstallLaunchd, Action: cliutil.ErrorHandler(uninstallLaunchd),
}, },
}, },
}) })

View File

@ -88,7 +88,7 @@ func commands(version func(c *cli.Context)) []*cli.Command {
cmds := []*cli.Command{ cmds := []*cli.Command{
{ {
Name: "update", Name: "update",
Action: updater.Update, Action: cliutil.ErrorHandler(updater.Update),
Usage: "Update the agent if a new version exists", Usage: "Update the agent if a new version exists",
ArgsUsage: " ", ArgsUsage: " ",
Description: `Looks for a new version on the official download server. Description: `Looks for a new version on the official download server.