File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
internal/cli/atlas/deployments Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ package deployments
1717import (
1818 "context"
1919 "errors"
20+ "fmt"
2021
2122 "github.com/mongodb/mongodb-atlas-cli/internal/cli"
2223 "github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/deployments/options"
@@ -47,6 +48,7 @@ const listTemplate = `NAME TYPE MDB VER STATE
4748{{end}}`
4849
4950const MaxItemsPerPage = 500
51+ const errAtlas = "failed to retrieve Atlas deployments with: %s"
5052
5153func (opts * ListOpts ) initStore (ctx context.Context ) func () error {
5254 return func () error {
@@ -102,21 +104,22 @@ func (opts *ListOpts) getAtlasDeployments() ([]options.Deployment, error) {
102104}
103105
104106func (opts * ListOpts ) Run (ctx context.Context ) error {
105- atlasClusters , err := opts .getAtlasDeployments ()
106- if err != nil {
107- return err
108- }
109-
110107 mdbContainers , err := opts .GetLocalDeployments (ctx )
111108 if err != nil && ! errors .Is (err , podman .ErrPodmanNotFound ) {
112109 return err
113110 }
114111
112+ atlasClusters , atlasErr := opts .getAtlasDeployments ()
113+
115114 err = opts .Print (append (atlasClusters , mdbContainers ... ))
116115 if err != nil {
117116 return err
118117 }
119118
119+ if atlasErr != nil {
120+ return fmt .Errorf (errAtlas , atlasErr .Error ())
121+ }
122+
120123 return nil
121124}
122125
You can’t perform that action at this time.
0 commit comments