forked from toolshed/abra
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/client"
|
||||||
"coopcloud.tech/abra/pkg/config"
|
"coopcloud.tech/abra/pkg/config"
|
||||||
"coopcloud.tech/abra/pkg/formatter"
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
abraService "coopcloud.tech/abra/pkg/service"
|
abraService "coopcloud.tech/abra/pkg/service"
|
||||||
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
||||||
"github.com/buger/goterm"
|
"github.com/buger/goterm"
|
||||||
@ -70,7 +69,19 @@ var appPsCommand = cli.Command{
|
|||||||
|
|
||||||
// showPSOutput renders ps output.
|
// showPSOutput renders ps output.
|
||||||
func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
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 {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
return
|
return
|
||||||
@ -78,7 +89,7 @@ func showPSOutput(c *cli.Context, app config.App, cl *dockerClient.Client) {
|
|||||||
|
|
||||||
var tablerows [][]string
|
var tablerows [][]string
|
||||||
allContainerStats := make(map[string]map[string]string)
|
allContainerStats := make(map[string]map[string]string)
|
||||||
for _, service := range recipe.Config.Services {
|
for _, service := range compose.Services {
|
||||||
filters := filters.NewArgs()
|
filters := filters.NewArgs()
|
||||||
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), service.Name))
|
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
|
allContainerStats[containerStats["service name"]] = containerStats
|
||||||
|
|
||||||
var tablerow []string
|
var tablerow []string = []string{containerStats["service name"], containerStats["image"], containerStats["created"], containerStats["status"], containerStats["state"], containerStats["ports"]}
|
||||||
for _, column := range containerStats {
|
|
||||||
tablerow = append(tablerow, column)
|
|
||||||
}
|
|
||||||
tablerows = append(tablerows, tablerow)
|
tablerows = append(tablerows, tablerow)
|
||||||
}
|
}
|
||||||
if internal.MachineReadable {
|
if internal.MachineReadable {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user