Fix schema loading when no default profile#2441
Merged
moelasmar merged 6 commits intoaws:developfrom Mar 27, 2021
Merged
Conversation
moelasmar
requested changes
Dec 31, 2020
Contributor
moelasmar
left a comment
There was a problem hiding this comment.
Can you add unit/integration test cases that cover this change
e72f5f0 to
5d09f6c
Compare
The region_name value when a profile does not specify a region or when there is not a 'default' profile resulted in a crash since _get_aws_region_choice attempted to perform concatenation using the `+` operator (which is undefined for str + NoneType). Using an actual string formatting method fixes that issue. Additionally, it is useless to prompt the user whether not to use the 'default' profile since doing so is impossible. They need to be prompted. Additionally, it is slightly more 'intelligent' to create a new session after the user has chosen a new profile so that a better default region can be chosen.
5d09f6c to
3e9ebe9
Compare
Contributor
Author
|
@moelasmar: Unit test coverage for the new code path(s) has been added |
CoshUS
approved these changes
Mar 16, 2021
moelasmar
approved these changes
Mar 25, 2021
moelasmar
added a commit
to moelasmar/aws-sam-cli
that referenced
this pull request
Jul 1, 2021
The region_name value when a profile does not specify a region or when there is not a 'default' profile resulted in a crash since _get_aws_region_choice attempted to perform concatenation using the `+` operator (which is undefined for str + NoneType). Using an actual string formatting method fixes that issue. Additionally, it is useless to prompt the user whether not to use the 'default' profile since doing so is impossible. They need to be prompted. Additionally, it is slightly more 'intelligent' to create a new session after the user has chosen a new profile so that a better default region can be chosen. Co-authored-by: _sam <3804518+aahung@users.noreply.github.com> Co-authored-by: Mohamed Elasmar <71043312+moelasmar@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The region_name value when a profile does not specify a region or when
there is not a 'default' profile resulted in a crash since
_get_aws_region_choice attempted to perform concatenation using the
+operator (which is undefined for str + NoneType). Using an actual string
formatting method fixes that issue.
Additionally, it is useless to prompt the user whether not to use the
'default' profile since doing so is impossible. They need to be
prompted. Additionally, it is slightly more 'intelligent' to create a
new session after the user has chosen a new profile so that a better
default region can be chosen.
Which issue(s) does this change fix?
No issue was opened.
Why is this change necessary?
The
sam initcrashes if a user needs to pick a schema and they do not have adefaultprofile or theirdefaultprofile does not specify aregion. (TypeErrorin_get_aws_region_choice)How does it address the issue?
Avoids performing a
+operation to perform string concatenation.What side effects does this change have?
Does not prompt the user to accept the defaults if doing so results in
regionbeing None. Just moves on to asking the user.Checklist
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.