forked from toolshed/abra
@ -128,24 +128,35 @@ func showPSOutput(app appPkg.App, cl *dockerClient.Client, deployedVersion, chao
|
||||
|
||||
allContainerStats[containerStats["service"]] = containerStats
|
||||
|
||||
// NOTE(d1): don't clobber these variables for --machine output
|
||||
dVersion := deployedVersion
|
||||
cVersion := chaosVersion
|
||||
|
||||
if containerStats["service"] != "app" {
|
||||
// NOTE(d1): don't repeat info which only relevant for the "app" service
|
||||
dVersion = ""
|
||||
cVersion = ""
|
||||
}
|
||||
|
||||
row := []string{
|
||||
containerStats["service"],
|
||||
containerStats["image"],
|
||||
containerStats["created"],
|
||||
dVersion,
|
||||
cVersion,
|
||||
containerStats["status"],
|
||||
containerStats["state"],
|
||||
containerStats["ports"],
|
||||
}
|
||||
|
||||
rows = append(rows, row)
|
||||
}
|
||||
|
||||
if internal.MachineReadable {
|
||||
jsonstring, err := json.Marshal(allContainerStats)
|
||||
rendered, err := json.Marshal(allContainerStats)
|
||||
if err != nil {
|
||||
log.Fatal("unable to convert to JSON: %s", err)
|
||||
}
|
||||
fmt.Println(string(jsonstring))
|
||||
|
||||
fmt.Println(string(rendered))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -157,19 +168,18 @@ func showPSOutput(app appPkg.App, cl *dockerClient.Client, deployedVersion, chao
|
||||
headers := []string{
|
||||
"SERVICE",
|
||||
"IMAGE",
|
||||
"CREATED",
|
||||
"VERSION",
|
||||
"CHAOS",
|
||||
"STATUS",
|
||||
"STATE",
|
||||
"PORTS",
|
||||
}
|
||||
|
||||
table.
|
||||
Headers(headers...).
|
||||
Rows(rows...)
|
||||
|
||||
fmt.Println(table)
|
||||
|
||||
log.Infof("VERSION: %s CHAOS: %s", deployedVersion, chaosVersion)
|
||||
if err := formatter.PrintTable(table); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Reference in New Issue
Block a user