-
Notifications
You must be signed in to change notification settings - Fork 5
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
write: update config file section with same name if no cred process flag #453
write: update config file section with same name if no cred process flag #453
Conversation
src/D2L.Bmx/WriteHandler.cs
Outdated
@@ -85,6 +85,27 @@ bool useCredentialProcess | |||
+ $" --role {awsCredsInfo.Role}" | |||
+ $" --duration {awsCredsInfo.Duration}"; | |||
} else { | |||
if( File.Exists( SharedCredentialsFile.DefaultConfigFilePath ) ) { | |||
string profileName = $"profile {profile}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it's really the section name rather than profile name
string profileName = $"profile {profile}"; | |
string sectionName = $"profile {profile}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like there's an opportunity to refactor and dedupe some logic and declarations in this whole "write" area. It's getting a bit messy now. But we can do it another time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically the section removing part or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything about handling AWS creds and config files
Co-authored-by: Chenfeng Bao <[email protected]>
follow up to this comment: #453 (comment)
Why
Default credentials file takes priority over the default config which is where we store profiles using
credential_process
. If someone had an existing profile in config file and then runsbmx write
, creds will be stored into the default credentials file making the existing one useless. We should remove the existing key in the config file so there is no confusion.credential_process
is the better way for majority of people but there are some scenarios where it's not supported. So we are leaving some information to the user that it is no longer being used. Just in case they unintentionally ran write without the flag. Not going with a prompt to confirm because that could break existing scriptsTicket
VUL-385