Ignore template res types during guideline checks

Global environment during registering resources also load resources from
/etc/environment.d . As result it loads two resources mapped on
templates:
- 'AWS::CloudWatch::Alarm'
- 'AWS::RDS::DBInstance'

However execute guideline checks for these resources is not possible due
to these resources use template_resource object and can not be processed
as usual *.py file.

This patch add ignoring for these two resource types.
Note: this error is not displayed on pep8 gate job due to we don't
install devstack during execution this job, but this error affects all
environments with installed devstack.

Closes-Bug: #1552194

Change-Id: I29abdfa1a4f4a17dfbcdaaf6f0c6665359bab17a
This commit is contained in:
Sergey Kraynev 2016-03-02 06:37:19 -05:00
parent 1211d6340e
commit af0903a916

View File

@ -33,6 +33,9 @@ class HeatCustomGuidelines(object):
global_env = resources.global_env()
for resource_type in global_env.get_types():
cls = global_env.get_class(resource_type)
# Skip resources, which defined as template resource in environment
if cls.__module__ == 'heat.engine.resources.template_resource':
continue
if (lambda module: True
if [path for path in exclude if path in module]
else False)(cls.__module__.replace('.', '/')):