Skip to content

Commit 7123b54

Browse files
committed
[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]>
1 parent e1b1a4e commit 7123b54

File tree

2 files changed

+37
-1
lines changed
  • cookbooks/aws-parallelcluster-environment

2 files changed

+37
-1
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
def aws_domain_for_fsx(region)
22
# DNS names have the default AWS domain (amazonaws.com) also in China and GovCloud.
3-
region.start_with?("us-iso") ? aws_domain : CLASSIC_AWS_DOMAIN
3+
if region.start_with?("us-iso-")
4+
US_ISO_AWS_DOMAIN
5+
elsif region.start_with?("us-isob-")
6+
US_ISOB_AWS_DOMAIN
7+
else
8+
CLASSIC_AWS_DOMAIN
9+
end
410
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe 'aws-parallelcluster-environment:libraries:aws_domain_for_fsx' do
4+
shared_examples 'a valid aws_domain_for_fsx function' do |region, expected_aws_domain|
5+
it 'returns the correct AWS domain' do
6+
result = aws_domain_for_fsx(region)
7+
expect(result).to eq(expected_aws_domain)
8+
end
9+
end
10+
11+
context 'when in US-ISO region' do
12+
include_examples 'a valid aws_domain_for_fsx function', 'us-iso-WHATEVER', 'c2s.ic.gov'
13+
end
14+
15+
context 'when in US-ISOB region' do
16+
include_examples 'a valid aws_domain_for_fsx function', 'us-isob-', 'sc2s.sgov.gov'
17+
end
18+
19+
context 'when in CN region' do
20+
include_examples 'a valid aws_domain_for_fsx function', 'cn-WHATEVER', 'amazonaws.com'
21+
end
22+
23+
context 'when in GovCloud region' do
24+
include_examples 'a valid aws_domain_for_fsx function', 'us-gov-WHATEVER', 'amazonaws.com'
25+
end
26+
27+
context 'when in whatever else region' do
28+
include_examples 'a valid aws_domain_for_fsx function', 'WHATEVER-ELSE', 'amazonaws.com'
29+
end
30+
end

0 commit comments

Comments
 (0)