-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 source_profile handling #2519
base: master
Are you sure you want to change the base?
Conversation
ping @stobrien89 (follow up on #2516) |
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.
Hi @tchernomax,
Thanks for the follow-up. Good catch- this change makes sense to me. We'd be glad to accept this, but will need the failing test to be adjusted to account for the new (correct) behavior. You're welcome to do this. Otherwise, we should be able to carve out some time to address this next week. Thanks!
1d6f998
to
11497f2
Compare
In fact I realize the same code handle the I changed my commit adding check to see if the file is I think the tests should be ok now (I didn't run them locally), can you relaunch the CI ? Thanks |
# prefix with 'profile ' | ||
if ($filename == (self::getHomeDir() . '/.aws/config') && | ||
$sourceProfileName != 'default') { | ||
$sourceProfileName = 'profile ' . $sourceProfileName; |
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.
Would you please be able to add a check here for whether profile
has been already appended to the profile. By doing this we keep backward compatibility for customers that are already adding the profile
to profile names.
@@ -705,6 +705,12 @@ private static function loadRoleProfile( | |||
$sourceProfileName = ""; | |||
if (!empty($roleProfile['source_profile'])) { | |||
$sourceProfileName = $roleProfile['source_profile']; | |||
# in ~/.aws/config all the named profile (except 'default') are | |||
# prefix with 'profile ' | |||
if ($filename == (self::getHomeDir() . '/.aws/config') && |
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.
Can you please remove the condition $filename == (self::getHomeDir() . '/.aws/config')
since I do no think is needed. You can leave the other condition $sourceProfileName != 'default'
.
"$profiles" keys are prefix with "profile ", but source_profile attribute isn't so the SDK never found the source_profile.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
how to reproduce
~/.aws/config
test.php
result: fail
expected result: ok
But if you use this ~/.aws/config (which is ill formatted according to the doc), it works:
note
follow #2516 , which is already closed