Skip to content

Commit 3463a31

Browse files
authored
Added a check to verify subnets data type (#21)
Signed-off-by: Mahendra Korepu <mkorepu@cloudera.com>
1 parent 1dba94c commit 3463a31

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

cdpctl/validation/infra/validate_aws_subnets.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ def aws_public_subnets_validation(
7171
key_missing_message="No public subnets defined for config option: {0}",
7272
data_expected_error_message="No public subnets were provided for config option: {0}", # noqa: E501
7373
)
74+
75+
if not isinstance(public_subnets, List):
76+
pytest.fail(
77+
"""Invalid syntax, config data expected in following format
78+
public_subnet_ids:
79+
- subnetId-1
80+
- subnetId-2
81+
- subnetId-3""",
82+
False,
83+
)
7484
if not len(public_subnets) > 2:
7585
pytest.fail("Not enough subnets provided, at least 3 subnets required.", False)
7686

@@ -275,6 +285,15 @@ def aws_private_subnets_validation(
275285
data_expected_error_message="No private subnets were provided for config "
276286
"option: {0}",
277287
)
288+
if not isinstance(private_subnets, List):
289+
pytest.fail(
290+
"""Invalid syntax, config data expected in following format
291+
private_subnet_ids:
292+
- subnetId-1
293+
- subnetId-2
294+
- subnetId-3""",
295+
False,
296+
)
278297
if not len(private_subnets) > 2:
279298
pytest.fail("Not enough subnets provided, at least 3 subnets required.", False)
280299

0 commit comments

Comments
 (0)