Skip to content

Commit b03e95b

Browse files
committed
feat(mongodbflex): address review comments
relates to STACKITCLI-441
1 parent dcbe4c5 commit b03e95b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎internal/cmd/mongodbflex/instance/create/create.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func getFlavorId(ctx context.Context, model *inputModel, apiClient mongodbflex.D
269269
}
270270

271271
for _, flavor := range flavors.Flavors {
272-
if *flavor.Cpu == *model.CPU && *flavor.Memory == *model.RAM {
272+
if flavor.Cpu != nil && flavor.Memory != nil && *flavor.Cpu == *model.CPU && *flavor.Memory == *model.RAM {
273273
return flavor.Id, nil
274274
}
275275
}

‎internal/cmd/mongodbflex/instance/update/update.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient mongodbflex.
213213
if err != nil {
214214
return req, fmt.Errorf("get MongoDB Flex instance: %w", err)
215215
}
216-
217216
flavors, err := apiClient.ListFlavors(ctx, model.ProjectId, model.Region).Execute()
218217
if err != nil {
219218
return req, fmt.Errorf("get MongoDB Flex flavors: %w", err)
@@ -227,8 +226,9 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient mongodbflex.
227226
// if only one of the cpu/ram flags is set
228227
if model.RAM == nil || model.CPU == nil {
229228
var currentFlavor *mongodbflex.InstanceFlavor
229+
230230
for _, f := range flavors.Flavors {
231-
if *f.Id == *currentInstance.Item.Flavor.Id {
231+
if f.Id != nil && currentInstance.Item.Flavor.Id != nil && *f.Id == *currentInstance.Item.Flavor.Id {
232232
currentFlavor = &f
233233
}
234234
}

0 commit comments

Comments
 (0)