Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-248054: Stop copying mongocli config into atlascli #2945

Merged
merged 3 commits into from May 13, 2024

Conversation

blva
Copy link
Contributor

@blva blva commented May 10, 2024

Proposed changes

CLOUDP-248054

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

@blva blva marked this pull request as ready for review May 13, 2024 08:36
@blva blva requested a review from a team as a code owner May 13, 2024 08:36
Comment on lines -109 to -115
_, err = os.Stat(atlasConfigHomePath) // check if the dir is already there
if err != nil {
defaultPermissions := 0700
if err = os.Mkdir(atlasConfigHomePath, os.FileMode(defaultPermissions)); err != nil {
return
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried the changes locally with no folder present? I'm wondering if this is still needed when installing on a clean system

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, seems fine, here are some of the commands I tried in case I missed something:

  • other commands
❯ ./bin/atlas deployments list
NAME   TYPE   MDB VER   STATE

To list both local and cloud Atlas deployments, authenticate to your Atlas account using the "atlas login" command.
❯ ./bin/atlas clusters list
Error: this action requires authentication

To log in using your Atlas username and password, run: atlas auth login
To set credentials using API keys, run: atlas config init
❯ ./bin/atlas login

To verify your account, copy your one-time verification code:
KRMH-FY38

Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after 10 minutes.

To continue, go to https://account.mongodb.com/account/connect
  • list before deleting / init then list
❯ ./bin/atlas config list
PROFILE NAME
Usage:  atlas config delete <name> [flags]
❯ ./bin/atlas config init
You are configuring a profile for atlas.

All values are optional and you can use environment variables (MONGODB_ATLAS_*) instead.

Enter [?] on any option to get help.

? Public API Key:
? Private API Key: [? for help]
? Default Project ID:
? Default Org ID:
? Default Output Format: plaintext

Your profile is now configured.
You can use [atlas config set] to change these settings at a later time.
❯ ./bin/atlas config list
PROFILE NAME
default

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do do mv ~/Library/Application\ Support/atlascli ~/Library/Application\ Support/atlasclibck before doing login? that's the part I'm curios, if the folder doesn't exists

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❯ mv ~/Library/Application\ Support/atlascli ~/Library/Application\ Support/atlasclibck
❯ ./bin/atlas login

To verify your account, copy your one-time verification code:
BVMR-QWR3

Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after 10 minutes.

To continue, go to https://account.mongodb.com/account/connect
^C%
❯ ./bin/atlas clusters list
Error: this action requires authentication

To log in using your Atlas username and password, run: atlas auth login
To set credentials using API keys, run: atlas config init
❯ git pull
❯ ./bin/atlas config list
PROFILE NAME

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To continue, go to https://account.mongodb.com/account/connect
^C%

can you continue and see if the file is created? the thing to check if we need to pre create the folder or will it be created along the file, since you are deleting the code that created the folder before trying to create the file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, worked fine!

❯ ./bin/atlas login

To verify your account, copy your one-time verification code:
Q9K3-J896

Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after 10 minutes.

To continue, go to https://account.mongodb.com/account/connect
Successfully logged in as blvaguiar@gmail.com.
Select one default organization and one default project.
? Choose a default project: 623202922f697375cac9414a

You have successfully configured your profile.
You can use [atlas config set] to change your profile settings later.
❯ ./bin/atlas config list
PROFILE NAME
default

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for checking this :shipit:

Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@blva blva merged commit 52498ac into master May 13, 2024
21 checks passed
@blva blva deleted the CLOUDP-248054-atlascli branch May 13, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants