Cannot import name 'AVAILABILITY_ZONES'
See original GitHub issuecfn-lint version: (cfn-lint --version
)
0.48.0 (though happens with any prior versions I’ve tried back to 0.3x)
Description of issue.
cfn-lint produces the following error on any yaml file I provide (and regardless of any reference to AZs);
2021-04-05 11:02:19,630 - cfnlint - ERROR - Tried to append rules but got an error: cannot import name 'AVAILABILITY_ZONES'
I’m running within Windows WSL 2 Ubuntu 18.04, pip3 installed cfn-init, on python 3.6.9.
Here’s an example full debug output;
cfn-lint -D vpc.yml
2021-04-05 11:11:02,895 - cfnlint - DEBUG - Looking for CFLINTRC before attempting to load
2021-04-05 11:11:02,896 - cfnlint - DEBUG - Validating User CFNLINTRC
2021-04-05 11:11:02,896 - cfnlint - DEBUG - Validating CFNLINTRC config with given JSONSchema
2021-04-05 11:11:02,896 - cfnlint - DEBUG - Schema used: {'$id': 'https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/data/CfnLintCli/config/schema.json', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'CFNLINTRC configuration schema', 'properties': {'append_rules': {'description': 'Location of directories to append rules from', 'items': {'type': 'string'}, 'type': 'array'}, 'configure_rules': {'additionalProperties': False, 'description': 'Configure rules', 'patternProperties': {'^.*$': {'patternProperties': {'^.*$': {'anyOf': [{'type': 'string'}, {'type': 'integer'}, {'type': 'boolean'}]}}, 'type': 'object'}}, 'type': 'object'}, 'ignore_checks': {'description': 'List of checks to ignore', 'items': {'type': 'string'}, 'type': 'array'}, 'ignore_templates': {'description': 'Templates to ignore', 'items': {'type': 'string'}, 'type': 'array'}, 'include_checks': {'description': 'List of checks to include', 'items': {'type': 'string'}, 'type': 'array'}, 'mandatory_checks': {'description': 'List of mandatory checks to enforce', 'items': {'type': 'string'}, 'type': 'array'}, 'merge_configs': {'description': 'Merges lists between configuration layers', 'type': 'boolean'}, 'custom_rules': {'description': 'custom rule file to use', 'items': {'type': 'string'}, 'type': 'array'}, 'output_file': {'description': 'Path to the file to write the main output to', 'type': 'string'}, 'override_spec': {'description': 'Path to spec file to override with', 'type': 'string'}, 'regions': {'description': 'Regions to test against', 'items': {'type': 'string'}, 'type': 'array'}, 'registry_schemas': {'description': 'One or more directories of CloudFormation Registry Resource Schemas', 'items': {'type': 'string'}, 'type': 'array'}, 'templates': {'description': 'Templates to lint', 'items': {'type': 'string'}, 'type': 'array'}}, 'title': 'CFNLINTRC JSON Schema', 'type': 'object'}
2021-04-05 11:11:02,896 - cfnlint - DEBUG - Config used: {}
2021-04-05 11:11:02,899 - cfnlint - DEBUG - CFNLINTRC looks valid!
2021-04-05 11:11:02,899 - cfnlint - DEBUG - Validating Project CFNLINTRC
2021-04-05 11:11:02,899 - cfnlint - DEBUG - Validating CFNLINTRC config with given JSONSchema
2021-04-05 11:11:02,900 - cfnlint - DEBUG - Schema used: {'$id': 'https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/data/CfnLintCli/config/schema.json', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'description': 'CFNLINTRC configuration schema', 'properties': {'append_rules': {'description': 'Location of directories to append rules from', 'items': {'type': 'string'}, 'type': 'array'}, 'configure_rules': {'additionalProperties': False, 'description': 'Configure rules', 'patternProperties': {'^.*$': {'patternProperties': {'^.*$': {'anyOf': [{'type': 'string'}, {'type': 'integer'}, {'type': 'boolean'}]}}, 'type': 'object'}}, 'type': 'object'}, 'ignore_checks': {'description': 'List of checks to ignore', 'items': {'type': 'string'}, 'type': 'array'}, 'ignore_templates': {'description': 'Templates to ignore', 'items': {'type': 'string'}, 'type': 'array'}, 'include_checks': {'description': 'List of checks to include', 'items': {'type': 'string'}, 'type': 'array'}, 'mandatory_checks': {'description': 'List of mandatory checks to enforce', 'items': {'type': 'string'}, 'type': 'array'}, 'merge_configs': {'description': 'Merges lists between configuration layers', 'type': 'boolean'}, 'custom_rules': {'description': 'custom rule file to use', 'items': {'type': 'string'}, 'type': 'array'}, 'output_file': {'description': 'Path to the file to write the main output to', 'type': 'string'}, 'override_spec': {'description': 'Path to spec file to override with', 'type': 'string'}, 'regions': {'description': 'Regions to test against', 'items': {'type': 'string'}, 'type': 'array'}, 'registry_schemas': {'description': 'One or more directories of CloudFormation Registry Resource Schemas', 'items': {'type': 'string'}, 'type': 'array'}, 'templates': {'description': 'Templates to lint', 'items': {'type': 'string'}, 'type': 'array'}}, 'title': 'CFNLINTRC JSON Schema', 'type': 'object'}
2021-04-05 11:11:02,900 - cfnlint - DEBUG - Config used: {}
2021-04-05 11:11:02,902 - cfnlint - DEBUG - CFNLINTRC looks valid!
2021-04-05 11:11:02,902 - cfnlint - DEBUG - User configuration loaded as
2021-04-05 11:11:02,902 - cfnlint - DEBUG - {}
2021-04-05 11:11:02,902 - cfnlint - DEBUG - Project configuration loaded as
2021-04-05 11:11:02,902 - cfnlint - DEBUG - {}
2021-04-05 11:11:02,903 - cfnlint - DEBUG - Merging configurations...
2021-04-05 11:11:02,903 - cfnlint - DEBUG - Begin linting of file: vpc.yml
2021-04-05 11:11:02,929 - cfnlint - ERROR - Tried to append rules but got an error: cannot import name 'AVAILABILITY_ZONES'
It doesn’t matter what yaml I provide, all the previously successfully parsed files all produce this error. Obviously unrelated to the file being parsed.
Until a few days ago there was no issue. I started seeing an odd error on a relatively new resource AWS Network Firewall
, which I attributed to an old version of cfn-init (0.34.0). However, following upgrade to the latest version, the above errors are now consistent with what ever version I use. Returning to the previous version does not help.
I’ve confirmed 0.46.0 on MacOS Big Sur is fine - installed via brew. So it appears to be a local thing, or specific to (WSL) Ubuntu, any thoughts?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Not sure if people were waiting for me to do something.
I’ve been playing a little with the related cache files as mentioned in the previous comments.
Following cfn-lint removal via pip3 the following home path python files remain.
I removed all those files, reinstalled and the error is gone. 😃
Now using cfn-lint 0.48.3.
I had this issue also. My investigation found by switching users, cfn-lint would work. Specifically, the cfn-lint, which gave me the error
Tried to append rules...
, was not installed in /usr/local/bin.I’m not sure but I suspect that it played a part in muddling up the pathing for finding important files like the cfnlintrc file. It fits closely to where the code sends the exception…