forked from toolshed/abra
@ -66,13 +66,10 @@ var appBackupCommand = &cli.Command{
|
||||
|
||||
sourceAndExec := fmt.Sprintf("%s; %s", sourceCmd, execCmd)
|
||||
cmd := exec.Command("bash", "-c", sourceAndExec)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
if err := internal.RunCmd(cmd); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Print(string(output))
|
||||
|
||||
return nil
|
||||
},
|
||||
BashComplete: func(c *cli.Context) {
|
||||
|
@ -45,7 +45,7 @@ var appCheckCommand = &cli.Command{
|
||||
logrus.Fatalf("%s is missing %s", app.Path, missingEnvVars)
|
||||
}
|
||||
|
||||
logrus.Info("All necessary environment variables defined")
|
||||
logrus.Infof("all necessary environment variables defined for '%s'", app.Name)
|
||||
|
||||
return nil
|
||||
},
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/cli/formatter"
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
@ -55,11 +56,13 @@ var appCpCommand = &cli.Command{
|
||||
service = parsedSrc[0]
|
||||
srcPath = parsedSrc[1]
|
||||
dstPath = dst
|
||||
logrus.Debugf("assuming transfer is coming FROM the container")
|
||||
} else if len(parsedDst) == 2 {
|
||||
service = parsedDst[0]
|
||||
dstPath = parsedDst[1]
|
||||
srcPath = src
|
||||
isToContainer = true // <src> <container:dst>
|
||||
logrus.Debugf("assuming transfer is going TO the container")
|
||||
}
|
||||
|
||||
appFiles, err := config.LoadAppFiles("")
|
||||
@ -90,6 +93,8 @@ var appCpCommand = &cli.Command{
|
||||
}
|
||||
container := containers[0]
|
||||
|
||||
logrus.Debugf("retrieved '%s' as target container on '%s'", formatter.ShortenID(container.ID), app.Server)
|
||||
|
||||
if isToContainer {
|
||||
if _, err := os.Stat(srcPath); err != nil {
|
||||
logrus.Fatalf("'%s' does not exist?", srcPath)
|
||||
|
@ -73,8 +73,10 @@ var appLogsCommand = &cli.Command{
|
||||
|
||||
serviceName := c.Args().Get(1)
|
||||
if serviceName == "" {
|
||||
logrus.Debug("tailing logs for all app services")
|
||||
stackLogs(app.StackName(), cl)
|
||||
}
|
||||
logrus.Debugf("tailing logs for '%s'", serviceName)
|
||||
|
||||
service := fmt.Sprintf("%s_%s", app.StackName(), serviceName)
|
||||
filters := filters.NewArgs()
|
||||
|
@ -197,6 +197,7 @@ func action(c *cli.Context) error {
|
||||
if len(sanitisedAppName) > 45 {
|
||||
logrus.Fatalf("'%s' cannot be longer than 45 characters", sanitisedAppName)
|
||||
}
|
||||
logrus.Debugf("'%s' sanitised as '%s' for new app", newAppName, sanitisedAppName)
|
||||
|
||||
if err := config.CopyAppEnvSample(recipe.Name, newAppName, newAppServer); err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
@ -37,7 +37,7 @@ var appPsCommand = &cli.Command{
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
tableCol := []string{"ID", "Image", "Command", "Created", "Status", "Ports", "Names"}
|
||||
tableCol := []string{"id", "image", "command", "created", "status", "ports", "names"}
|
||||
table := abraFormatter.CreateTable(tableCol)
|
||||
|
||||
for _, container := range containers {
|
||||
@ -48,7 +48,7 @@ var appPsCommand = &cli.Command{
|
||||
abraFormatter.HumanDuration(container.Created),
|
||||
container.Status,
|
||||
formatter.DisplayablePorts(container.Ports),
|
||||
strings.Join(container.Names, ","),
|
||||
strings.Join(container.Names, ", "),
|
||||
}
|
||||
table.Append(tableRow)
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ var appRemoveCommand = &cli.Command{
|
||||
if !internal.Force {
|
||||
response := false
|
||||
prompt := &survey.Confirm{
|
||||
Message: fmt.Sprintf("About to delete %s, are you sure", app.Name),
|
||||
Message: fmt.Sprintf("about to delete %s, are you sure?", app.Name),
|
||||
}
|
||||
if err := survey.AskOne(prompt, &response); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
if !response {
|
||||
logrus.Fatal("User aborted app removal")
|
||||
logrus.Fatal("user aborted app removal")
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ var appRemoveCommand = &cli.Command{
|
||||
var secretNamesToRemove []string
|
||||
if !internal.Force {
|
||||
secretsPrompt := &survey.MultiSelect{
|
||||
Message: "Which secrets do you want to remove?",
|
||||
Message: "which secrets do you want to remove?",
|
||||
Options: secretNames,
|
||||
Default: secretNames,
|
||||
}
|
||||
@ -103,10 +103,10 @@ var appRemoveCommand = &cli.Command{
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Info(fmt.Sprintf("Secret: %s removed", name))
|
||||
logrus.Info(fmt.Sprintf("secret: %s removed", name))
|
||||
}
|
||||
} else {
|
||||
logrus.Info("No secrets to remove")
|
||||
logrus.Info("no secrets to remove")
|
||||
}
|
||||
|
||||
volumeListOKBody, err := cl.VolumeList(ctx, fs)
|
||||
@ -125,7 +125,7 @@ var appRemoveCommand = &cli.Command{
|
||||
var removeVols []string
|
||||
if !internal.Force {
|
||||
volumesPrompt := &survey.MultiSelect{
|
||||
Message: "Which volumes do you want to remove?",
|
||||
Message: "which volumes do you want to remove?",
|
||||
Options: vols,
|
||||
Default: vols,
|
||||
}
|
||||
@ -138,20 +138,20 @@ var appRemoveCommand = &cli.Command{
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Info(fmt.Sprintf("Volume %s removed", vol))
|
||||
logrus.Info(fmt.Sprintf("volume %s removed", vol))
|
||||
}
|
||||
} else {
|
||||
logrus.Info("No volumes were removed")
|
||||
logrus.Info("no volumes were removed")
|
||||
}
|
||||
} else {
|
||||
logrus.Info("No volumes to remove")
|
||||
logrus.Info("no volumes to remove")
|
||||
}
|
||||
|
||||
err = os.Remove(app.Path)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Info(fmt.Sprintf("File: %s removed", app.Path))
|
||||
logrus.Info(fmt.Sprintf("file: %s removed", app.Path))
|
||||
|
||||
return nil
|
||||
},
|
||||
|
@ -70,13 +70,10 @@ var appRestoreCommand = &cli.Command{
|
||||
|
||||
sourceAndExec := fmt.Sprintf("%s; %s", sourceCmd, execCmd)
|
||||
cmd := exec.Command("bash", "-c", sourceAndExec)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
if err := internal.RunCmd(cmd); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Print(string(output))
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ var appRollbackCommand = &cli.Command{
|
||||
// display table of existing state and expected state and prompt
|
||||
// run the deployment with this target version!
|
||||
|
||||
logrus.Fatal("command not implemented yet, coming soon TM")
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@ -83,13 +83,13 @@ var appSecretGenerateCommand = &cli.Command{
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
tableCol := []string{"Name", "Value"}
|
||||
tableCol := []string{"name", "value"}
|
||||
table := abraFormatter.CreateTable(tableCol)
|
||||
for name, val := range secretVals {
|
||||
table.Append([]string{name, val})
|
||||
}
|
||||
table.Render()
|
||||
logrus.Warn("these secrets are not shown again, please take note of them *now*")
|
||||
logrus.Warn("generated secrets are not shown again, please take note of them *now*")
|
||||
|
||||
return nil
|
||||
},
|
||||
|
@ -25,6 +25,7 @@ func getImagePath(image string) (string, error) {
|
||||
if strings.Contains(path, "library") {
|
||||
path = strings.Split(path, "/")[1]
|
||||
}
|
||||
logrus.Debugf("parsed '%s' from '%s'", path, image)
|
||||
return path, nil
|
||||
}
|
||||
|
||||
@ -53,7 +54,7 @@ var appVersionCommand = &cli.Command{
|
||||
}(app.Server, label)
|
||||
}
|
||||
|
||||
tableCol := []string{"Name", "Image", "Version", "Digest"}
|
||||
tableCol := []string{"name", "image", "version", "digest"}
|
||||
table := abraFormatter.CreateTable(tableCol)
|
||||
|
||||
statuses := make(map[string]stack.StackStatus)
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
var appVolumeListCommand = &cli.Command{
|
||||
Name: "list",
|
||||
Usage: "list volumes associated with an app",
|
||||
Usage: "List volumes associated with an app",
|
||||
Aliases: []string{"ls"},
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
@ -26,7 +26,7 @@ var appVolumeListCommand = &cli.Command{
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
table := abraFormatter.CreateTable([]string{"DRIVER", "VOLUME NAME"})
|
||||
table := abraFormatter.CreateTable([]string{"driver", "volume name"})
|
||||
var volTable [][]string
|
||||
for _, volume := range volumeList {
|
||||
volRow := []string{
|
||||
@ -45,7 +45,7 @@ var appVolumeListCommand = &cli.Command{
|
||||
|
||||
var appVolumeRemoveCommand = &cli.Command{
|
||||
Name: "remove",
|
||||
Usage: "remove volume(s) associated with an app",
|
||||
Usage: "Remove volume(s) associated with an app",
|
||||
Aliases: []string{"rm"},
|
||||
Flags: []cli.Flag{
|
||||
internal.ForceFlag,
|
||||
@ -63,7 +63,7 @@ var appVolumeRemoveCommand = &cli.Command{
|
||||
var volumesToRemove []string
|
||||
if !internal.Force {
|
||||
volumesPrompt := &survey.MultiSelect{
|
||||
Message: "Which volumes do you want to remove?",
|
||||
Message: "which volumes do you want to remove?",
|
||||
Options: volumeNames,
|
||||
Default: volumeNames,
|
||||
}
|
||||
@ -79,7 +79,7 @@ var appVolumeRemoveCommand = &cli.Command{
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
logrus.Info("Volumes removed successfully.")
|
||||
logrus.Info("volumes removed successfully")
|
||||
|
||||
return nil
|
||||
},
|
||||
|
Reference in New Issue
Block a user