Skip to content

Commit 80a3555

Browse files
committed
1 parent 0b184a6 commit 80a3555

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

cli/src/pcluster/config/cluster_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ def _register_validators(self, context: ValidatorContext = None): # noqa: D102
406406
EfsAccessPointOptionsValidator,
407407
access_point_id=self.access_point_id,
408408
file_system_id=self.file_system_id,
409+
encryption_in_transit=self.encryption_in_transit
409410
)
410411

411412
class BaseSharedFsx(Resource):

cli/src/pcluster/validators/efs_validators.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ class EfsAccessPointOptionsValidator(Validator):
3333
IAM Authorization requires Encryption in Transit.
3434
"""
3535

36-
def _validate(self, access_point_id: str, file_system_id: str):
36+
def _validate(self, access_point_id: str, file_system_id: str, encryption_in_transit: bool):
3737

3838
if access_point_id and not file_system_id:
3939
self._add_failure(
4040
"An access point can only be specified when using an existing EFS file system. "
4141
f"Please either remove the access point id {access_point_id} or provide the file system id for the access point",
4242
FailureLevel.ERROR,
4343
)
44+
45+
if access_point_id and not encryption_in_transit:
46+
self._add_failure(
47+
"An access point can only be specified when encryption in transit is enabled. "
48+
f"Please either remove the access point id {access_point_id} or enable encryption in transit.",
49+
FailureLevel.ERROR,
50+
)

cli/tests/pcluster/validators/test_efs_validators.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,35 @@ def test_efs_mount_options_validator(
7979
],
8080
)
8181
def test_efs_access_point_with_filesystem_validator(access_point_id, file_system_id, expected_message):
82-
actual_failures = EfsAccessPointOptionsValidator().execute(access_point_id, file_system_id)
82+
actual_failures = EfsAccessPointOptionsValidator().execute(access_point_id, file_system_id, True)
8383
assert_failure_messages(actual_failures, expected_message)
8484

85-
85+
@pytest.mark.parametrize(
86+
"access_point_id, encryption_in_transit, expected_message",
87+
[
88+
(
89+
None,
90+
False,
91+
None,
92+
),
93+
(
94+
"<access_point_id>",
95+
False,
96+
"An access point can only be specified when encryption in transit is enabled. "
97+
"Please either remove the access point id <access_point_id> or enable encryption in transit.",
98+
),
99+
(
100+
"<access_point_id>",
101+
True,
102+
None,
103+
),
104+
(
105+
None,
106+
True,
107+
None,
108+
),
109+
],
110+
)
111+
def test_efs_access_point_with_filesystem_validator(access_point_id, encryption_in_transit, expected_message):
112+
actual_failures = EfsAccessPointOptionsValidator().execute(access_point_id, "<file-system-id>", encryption_in_transit)
113+
assert_failure_messages(actual_failures, expected_message)

0 commit comments

Comments
 (0)