aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Setting/getting "expiration" with aws configure does not work consistently

Open kenkku opened this issue 1 year ago • 2 comments

Describe the bug

Setting the expiration configuration item with aws configure set writes the value to config, but aws configure get only reads it correctly from the shared credentials file. I think the get side might also work incorrectly with expiration, as it exits successfully and prints None instead of exiting with 1, like with other configuration values that are missing.

Expected Behavior

After setting expiration with aws configure set expiration some-value --profile some-profile, reading the value with aws configure get expiration --profile some-profile returns the same value.

Current Behavior

The value returned by configure get is None, instead of the set value. The value is written in the config file, but it is only read from the credentials file.

Reproduction Steps

aws configure set expiration "some-value" --profile "some-existing-profile"
aws configure get expiration --profile "some-existing-profile"

Possible Solution

The configure set command writes aws_access_key_id, aws_secret_access_key and aws_session_token to the credentials file (here). Expiration should probably be included in the list? This would not fix what I assume is incorrect output and exit code of configure get expiration when it doesn't exist, though.

Additional Information/Context

No response

CLI version used

aws-cli/2.15.3 Python/3.11.6 Darwin/21.6.0 source/arm64 prompt/off

Environment details (OS name and version, etc.)

macOS 12

kenkku avatar Dec 22 '23 13:12 kenkku

It seems that at least the configure get part worked correctly previously in version aws-cli/2.4.17 Python/3.8.8 Darwin/23.2.0 exe/x86_64 prompt/off. In that version, aws configure get expiration --profile "profile-name" exits with non-zero instead of printing "None" and exiting successfully.

kenkku avatar Dec 29 '23 12:12 kenkku

Thanks for reporting this issue and for your patience here.

I attempted to reproduce this on AWS CLI version 2.15.47, running the following:

aws configure set expiration "test" --profile "default" 

Which updated my config file to add:

[default]
expiration = test

And then running:

aws configure get expiration --profile "default"  

Does successfully return test.

So I'm not sure why this did not work on your end. Do you have any updates as far as what you tried, or other details that can help to reproduce this? If you could share your debug logs (with sensitive info redacted) by adding --debug to your commands then that might give us more insight.

tim-finnigan avatar May 10 '24 21:05 tim-finnigan

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar May 20 '24 22:05 github-actions[bot]