OpenStack Orchestration (Heat)
Go to file
Angus Salkeld 734f777da4 Use "if stack is not None" and not "if stack"
Problem:
If a nested stack has no resources, then we do not get
a "nested" link in the resource information returned by
our API.

Why?
In engine/api.py we have:

if (hasattr(resource, 'nested') and callable(resource.nested) and
            resource.nested()):
         res[rpc_api.RES_NESTED_STACK_ID] = dict(resource.nested().identifier())

The problem with this is the python definition of False, from the docs:

"instances of user-defined classes, if the class defines a __nonzero__()
 or __len__() method, when that method returns the integer zero or bool
 value False. [1]"

So if you have a stack with zero resources (len() returns 0), the
stack will be False :-O

Solution:
Use "if stack is not None:" instead of "if stack".

Change-Id: Ibdd1cb5dee6ce8e58f7d8f2586a495caded79134
Closes-bug: 1416917
2015-02-02 20:10:20 +10:00
bin Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
contrib Merge "Add Mistral client plugin" 2015-02-01 13:56:47 +00:00
doc Add support status to docs for properties 2015-01-15 09:41:57 +00:00
etc/heat Remove heat.config.sample file 2014-12-03 20:35:36 +00:00
heat Use "if stack is not None" and not "if stack" 2015-02-02 20:10:20 +10:00
heat_integrationtests Merge "Test auto-scaling for neutron" 2015-02-01 22:17:11 +00:00
rally-scenarios Add config file for performance gate job 2014-08-08 02:22:59 +04:00
tools Add lists of Linux dependencies 2015-01-23 16:02:53 +00:00
.coveragerc Enabled source code coverage for contrib directory 2014-01-28 21:49:40 +08:00
.gitignore Use setuptools to install contrib plugins 2014-08-13 20:12:29 -05:00
.gitreview Update .gitreview for org move. 2012-12-02 17:46:15 +00:00
.testr.conf Restructure contrib/ directories 2014-03-03 10:49:28 -05:00
CONTRIBUTING.rst Workflow documentation is now in infra-manual 2014-12-05 03:30:36 +00:00
HACKING.rst Fixed the reference to 'Creating Unit Tests' in HACKING.rst 2014-06-22 02:00:59 -06:00
LICENSE Initial commit (basics copied from glance) 2012-03-13 21:48:07 +11:00
MANIFEST.in Update testing-overview.txt 2014-12-15 10:55:09 +02:00
README.rst Added links to missing integration information 2014-06-22 01:21:35 -06:00
babel.cfg Add setup.py and friends 2012-03-14 09:25:54 +11:00
config-generator.conf Use oslo.config generator 2015-01-02 13:14:20 +01:00
install.sh Port to oslo.messaging 2014-06-26 06:45:52 +02:00
openstack-common.conf Use oslo.config generator 2015-01-02 13:14:20 +01:00
pylintrc Directives to not use variable names that conflict with pdb 2012-03-20 07:16:16 -04:00
requirements.txt Updated from global requirements 2015-01-27 02:16:49 +00:00
setup.cfg Use oslo.config generator 2015-01-02 13:14:20 +01:00
setup.py Updated from global requirements 2014-05-09 02:42:01 +00:00
test-requirements.txt Remove lockfile from requirements 2015-01-29 17:43:34 +01:00
tox.ini Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
uninstall.sh Add uninstall script for Heat 2012-06-23 22:41:30 -04:00