only show container that should be deployed
This commit is contained in:
parent
183ad8f576
commit
459abecfa5
@ -11,7 +11,6 @@ import (
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
abraService "coopcloud.tech/abra/pkg/service"
|
||||
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
||||
"github.com/buger/goterm"
|
||||
@ -70,7 +69,19 @@ var appPsCommand = cli.Command{
|
||||
|
||||
// showPSOutput renders ps output.
|
||||
func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
||||
recipe, err := recipe.Get(app.Recipe, internal.Offline)
|
||||
composeFiles, err := config.GetComposeFiles(app.Recipe, app.Env)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
return
|
||||
}
|
||||
|
||||
deployOpts := stack.Deploy{
|
||||
Composefiles: composeFiles,
|
||||
Namespace: app.StackName(),
|
||||
Prune: false,
|
||||
ResolveImage: stack.ResolveImageAlways,
|
||||
}
|
||||
compose, err := config.GetAppComposeConfig(app.Name, deployOpts, app.Env)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
return
|
||||
@ -78,7 +89,7 @@ func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
||||
|
||||
var tablerows [][]string
|
||||
allContainerStats := make(map[string]map[string]string)
|
||||
for _, service := range recipe.Config.Services {
|
||||
for _, service := range compose.Services {
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), service.Name))
|
||||
|
||||
@ -112,10 +123,7 @@ func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
||||
}
|
||||
allContainerStats[containerStats["service name"]] = containerStats
|
||||
|
||||
var tablerow []string
|
||||
for _, column := range containerStats {
|
||||
tablerow = append(tablerow, column)
|
||||
}
|
||||
var tablerow []string = []string{containerStats["service name"], containerStats["image"], containerStats["created"], containerStats["status"], containerStats["state"], containerStats["ports"]}
|
||||
tablerows = append(tablerows, tablerow)
|
||||
}
|
||||
if internal.MachineReadable {
|
||||
|
Loading…
Reference in New Issue
Block a user