-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show container status instead of service status in enclave inspe…
…ct (#1560) ## Description: If a service eventually dies we would still show `RUNNING` while in reality it would be stopped 1. Create an enclave 2. Stop a service 3. Use inspect -> this prints service status Running (Kurtosis was told to keep it running) Post this PR 3. This would print container status -> Stopped - actually reflecting reality ## Is this change user facing? YES ## References (if applicable): Closes #1351
- Loading branch information
Showing
2 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
cli/cli/helpers/container_status_stringifier/container_status_stringifier.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package container_status_stringifier | ||
|
||
import ( | ||
"github.com/fatih/color" | ||
"github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" | ||
) | ||
|
||
var ( | ||
colorizeRunning = color.New(color.FgGreen).SprintFunc() | ||
colorizeStopped = color.New(color.FgYellow).SprintFunc() | ||
) | ||
|
||
func ContainerStatusStringifier(containerStatus kurtosis_core_rpc_api_bindings.Container_Status) string { | ||
containerStatusStr := kurtosis_core_rpc_api_bindings.Container_Status_name[int32(containerStatus)] | ||
switch containerStatus { | ||
case kurtosis_core_rpc_api_bindings.Container_STOPPED: | ||
return colorizeStopped(containerStatusStr) | ||
case kurtosis_core_rpc_api_bindings.Container_RUNNING: | ||
return colorizeRunning(containerStatusStr) | ||
default: | ||
return containerStatusStr | ||
} | ||
} |