Empty .taskcat_overrides.yml file causes ValidationError
tlindsay42 opened this issue · 1 comments
Describe the bug
A clear and concise description of what the bug is.
Attempt to create a stack with an empty ./.taskcat_overrides.yml
file or with comments only and the following arcane error is produced:
$ taskcat -d test run --no-delete --keep-failed --lint-disable --regions us-west-2 --test-names amznlinux2hvm
_ _ _
| |_ __ _ ___| | _____ __ _| |_
| __/ _` / __| |/ / __/ _` | __|
| || (_| \__ \ < (_| (_| | |_
\__\__,_|___/_|\_\___\__,_|\__|
version 0.9.36
[ERROR ] : ValidationError None is not of type 'object'
Failed validating 'type' in schema['properties']['project']['properties']['parameters']:
{'additionalProperties': {'anyOf': [{'items': {'anyOf': [{'type': 'integer'},
{'type': 'string'}]},
'type': 'array'},
{'type': 'boolean'},
{'type': 'integer'},
{'type': 'string'}]},
'description': 'Parameter key-values to pass to CloudFormation, '
'parameters provided in global config take precedence',
'type': 'object'}
On instance['project']['parameters']:
None
Traceback (most recent call last):
File "~/.local/lib/python3.7/site-packages/dataclasses_jsonschema/__init__.py", line 517, in _validate
validate_func(data, cls.json_schema(schema_type=schema_type, validate_enums=validate_enums))
File "~/.local/lib/python3.7/site-packages/jsonschema/validators.py", line 934, in validate
raise error
jsonschema.exceptions.ValidationError: None is not of type 'object'
Failed validating 'type' in schema['properties']['project']['properties']['parameters']:
{'additionalProperties': {'anyOf': [{'items': {'anyOf': [{'type': 'integer'},
{'type': 'string'}]},
'type': 'array'},
{'type': 'boolean'},
{'type': 'integer'},
{'type': 'string'}]},
'description': 'Parameter key-values to pass to CloudFormation, '
'parameters provided in global config take precedence',
'type': 'object'}
On instance['project']['parameters']:
None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "~/.local/lib/python3.7/site-packages/taskcat/_cli.py", line 46, in main
cli.run()
File "~/.local/lib/python3.7/site-packages/taskcat/_cli_core.py", line 316, in run
return getattr(command(), subcommand)(**args)
File "~/.local/lib/python3.7/site-packages/taskcat/_cli_modules/test.py", line 148, in run
enable_sig_v2=enable_sig_v2,
File "~/.local/lib/python3.7/site-packages/taskcat/testing/base_test.py", line 92, in from_file
args=args
File "~/.local/lib/python3.7/site-packages/taskcat/_config.py", line 124, in create
return cls(sources=sources, uid=uid, project_root=project_root)
File "~/.local/lib/python3.7/site-packages/taskcat/_config.py", line 54, in __init__
source_config = BaseConfig.from_dict(config_dict)
File "~/.local/lib/python3.7/site-packages/dataclasses_jsonschema/__init__.py", line 545, in from_dict
cls._validate(data, validate_enums, schema_type)
File "~/.local/lib/python3.7/site-packages/dataclasses_jsonschema/__init__.py", line 519, in _validate
raise ValidationError(str(e)) from e
dataclasses_jsonschema.ValidationError: None is not of type 'object'
Failed validating 'type' in schema['properties']['project']['properties']['parameters']:
{'additionalProperties': {'anyOf': [{'items': {'anyOf': [{'type': 'integer'},
{'type': 'string'}]},
'type': 'array'},
{'type': 'boolean'},
{'type': 'integer'},
{'type': 'string'}]},
'description': 'Parameter key-values to pass to CloudFormation, '
'parameters provided in global config take precedence',
'type': 'object'}
On instance['project']['parameters']:
None
To Reproduce
Steps to reproduce the behavior:
- Are you testing a QuickStart or Custom template? QuickStart
- Attach or link a copy of the template if possible (remove any sensitive info) https://github.com/aws-quickstart/quickstart-linux-bastion/
- Provide the parameters that you passed. (remove any sensitive info) None- using defaults test with overrides commented out
- How did you install taskcat? (docker or pip3) pip3
- Are you using a profile, an instance role or access keys to run taskcat? profile
- Is your AWS environment configured via
aws configure
? yes
Expected behavior
A clear and concise description of what you expected to happen.
Test should run without issue
Screenshots
If applicable, add screenshots to help explain your problem.
**Version (Please make sure you are running the latest version of taskcat)
- Taskcat Version (ex: [2018.817.210357]) 0.9.36
Note: Python Version (python3 required) Python 3.7.16
To find versions:
Via taskcat: taskcat -V
Via pip3: pip3 show taskcat
Note: both version should match
To update taskcat run:
for docker : docker pull taskcat/taskcat
for pip3: pip3 install --upgrade taskcat
Additional context
Add any other context about the problem here.
tlindsay42 , looks like the override params are None
if I have an empty .taskcat_overrides.yml
file and it fails to load it , can set it to an empty dict or try to catch the error and let the test continue. Please let me know if you think its a good approach, can send a PR on this. Thanks
https://github.com/aws-ia/taskcat/blob/main/taskcat/_config.py#L110