Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added checks to verify subnets data type #21

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cdpctl/validation/infra/validate_aws_subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ def aws_public_subnets_validation(
key_missing_message="No public subnets defined for config option: {0}",
data_expected_error_message="No public subnets were provided for config option: {0}", # noqa: E501
)

if not isinstance(public_subnets, List):
pytest.fail(
"""Invalid syntax, config data expected in following format
public_subnet_ids:
- subnetId-1
- subnetId-2
- subnetId-3""",
False,
)
if not len(public_subnets) > 2:
pytest.fail("Not enough subnets provided, at least 3 subnets required.", False)

Expand Down Expand Up @@ -275,6 +285,15 @@ def aws_private_subnets_validation(
data_expected_error_message="No private subnets were provided for config "
"option: {0}",
)
if not isinstance(private_subnets, List):
pytest.fail(
"""Invalid syntax, config data expected in following format
private_subnet_ids:
- subnetId-1
- subnetId-2
- subnetId-3""",
False,
)
if not len(private_subnets) > 2:
pytest.fail("Not enough subnets provided, at least 3 subnets required.", False)

Expand Down