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

Fix: credential_process to merge .aws/config instead of .aws/credentials into generated output #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/credential_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ func writeConfigFile(roles []creds.ConsolemeRolesResponse, destination string) e
ini.PrettyFormat = false
ini.PrettyEqual = true

if util.FileExists(destination) {
if util.FileExists(destinationConfig) {
// There's an existing config file, so we'll load it in and update the existing contents
configINI, err = ini.Load(destination)
configINI, err = ini.Load(destinationConfig)
if err != nil {
return err
}
} else {
// Config file doesn't exist yet. Create it with the same perms as awscli
err = util.CreateFile(destination, 0700, 0600)
err = util.CreateFile(destinationConfig, 0700, 0600)
if err != nil {
return err
}
Expand Down Expand Up @@ -97,7 +97,7 @@ func writeConfigFile(roles []creds.ConsolemeRolesResponse, destination string) e
}

func generateCredentialProcessConfig(destination string) error {
if destination == "" {
if destinationConfig == "" {
return fmt.Errorf("no destination provided")
}
client, err := creds.GetClient()
Expand All @@ -108,7 +108,7 @@ func generateCredentialProcessConfig(destination string) error {
if err != nil {
return err
}
err = writeConfigFile(roles, destination)
err = writeConfigFile(roles, destinationConfig)
if err != nil {
return err
}
Expand All @@ -118,7 +118,7 @@ func generateCredentialProcessConfig(destination string) error {
func runCredentialProcess(cmd *cobra.Command, args []string) error {
if generate {
logging.Log.Infoln("Generate credential_process")
err := generateCredentialProcessConfig(destination)
err := generateCredentialProcessConfig(destinationConfig)
if err != nil {
logging.LogError(err, "Error generating credential_process")
return err
Expand Down