Skip to content

Commit 3f16010

Browse files
CLOUDP-201520: fix deployments start/pause commands (#2310)
1 parent 93579e0 commit 3f16010

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

internal/cli/atlas/deployments/list.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,16 @@ func (opts *ListOpts) getAtlasDeployments() ([]options.Deployment, error) {
8585

8686
deployments := make([]options.Deployment, len(atlasClusters.Results))
8787
for i, c := range atlasClusters.Results {
88+
stateName := *c.StateName
89+
if *c.Paused {
90+
// for paused clusters, Atlas returns stateName IDLE and Paused=true
91+
stateName = options.PausedState
92+
}
8893
deployments[i] = options.Deployment{
8994
Type: "ATLAS",
9095
Name: *c.Name,
9196
MongoDBVersion: *c.MongoDBVersion,
92-
StateName: *c.StateName,
97+
StateName: stateName,
9398
}
9499
}
95100

internal/cli/atlas/deployments/list_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ func TestList_Run(t *testing.T) {
5050
Id: pointer.Get("123"),
5151
MongoDBVersion: pointer.Get("7.0.0"),
5252
StateName: pointer.Get("IDLE"),
53+
Paused: pointer.Get(false),
5354
},
5455
{
5556
Name: pointer.Get("atlasCluster1"),
5657
Id: pointer.Get("123"),
5758
MongoDBVersion: pointer.Get("7.0.0"),
5859
StateName: pointer.Get("IDLE"),
60+
Paused: pointer.Get(false),
5961
},
6062
},
6163
}

internal/cli/atlas/deployments/options/deployment_opts.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ var (
6565
var localStateMap = map[string]string{
6666
"running": IdleState,
6767
"removing": DeletingState,
68-
// a "created" container is ready to be started but is currently stopped,
69-
// which for a local deployment is equivalent to being paused.
70-
"created": PausedState,
68+
// a "created" container is ready to be started but is currently stopped
69+
"created": StoppedState,
7170
"paused": PausedState,
7271
"restarting": RestartingState,
7372
"exited": StoppedState,

0 commit comments

Comments
 (0)