-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storage] Fix method used to get the AWS domain for FSx.
In particular, now it does not need anymore to access the undefined node attribute in US ISO regions. Signed-off-by: Giacomo Marciani <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
def aws_domain_for_fsx(region) | ||
# DNS names have the default AWS domain (amazonaws.com) also in China and GovCloud. | ||
region.start_with?("us-iso") ? aws_domain : CLASSIC_AWS_DOMAIN | ||
if region.start_with?("us-iso-") | ||
US_ISO_AWS_DOMAIN | ||
elsif region.start_with?("us-isob-") | ||
US_ISOB_AWS_DOMAIN | ||
else | ||
CLASSIC_AWS_DOMAIN | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
cookbooks/aws-parallelcluster-environment/spec/unit/libraries/fsx_spec.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'spec_helper' | ||
|
||
describe 'aws-parallelcluster-environment:libraries:aws_domain_for_fsx' do | ||
shared_examples 'a valid aws_domain_for_fsx function' do |region, expected_aws_domain| | ||
it 'returns the correct AWS domain' do | ||
result = aws_domain_for_fsx(region) | ||
expect(result).to eq(expected_aws_domain) | ||
end | ||
end | ||
|
||
context 'when in US-ISO region' do | ||
include_examples 'a valid aws_domain_for_fsx function', 'us-iso-WHATEVER', 'c2s.ic.gov' | ||
end | ||
|
||
context 'when in US-ISOB region' do | ||
include_examples 'a valid aws_domain_for_fsx function', 'us-isob-', 'sc2s.sgov.gov' | ||
end | ||
|
||
context 'when in CN region' do | ||
include_examples 'a valid aws_domain_for_fsx function', 'cn-WHATEVER', 'amazonaws.com' | ||
end | ||
|
||
context 'when in GovCloud region' do | ||
include_examples 'a valid aws_domain_for_fsx function', 'us-gov-WHATEVER', 'amazonaws.com' | ||
end | ||
|
||
context 'when in whatever else region' do | ||
include_examples 'a valid aws_domain_for_fsx function', 'WHATEVER-ELSE', 'amazonaws.com' | ||
end | ||
end |