heat/heat/engine
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
..
cfn Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
clients Merge "Allow floating_ip_pool on Nova-net in Sahara" 2015-01-29 13:16:30 +00:00
hot Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
notification Use oslo.config generator 2015-01-02 13:14:20 +01:00
resources Use "if stack is not None" and not "if stack" 2015-02-02 20:10:20 +10:00
__init__.py Do not initialize anything during import phase 2013-04-24 10:03:06 -07:00
api.py Use "if stack is not None" and not "if stack" 2015-02-02 20:10:20 +10:00
attributes.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
constraints.py Don't validate custom constraints on default values 2015-01-12 13:28:12 +00:00
dependencies.py Convert unicode to six in heat/engine 2015-01-22 12:16:54 +03:00
environment.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
event.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
function.py Using six.string_types for python3 compatible 2014-11-03 15:03:56 +08:00
lifecycle_plugin.py Fix file mode, remove executable bit. 2014-09-10 17:17:44 +08:00
parameter_groups.py Enable E265 style check 2015-01-05 11:58:27 +02:00
parameters.py Merge "Don't validate custom constraints on default values" 2015-01-27 03:12:21 +00:00
parser.py Move the Stack class into stack.py 2014-07-24 15:58:25 +10:00
plugin_manager.py Using six.string_types for python3 compatible 2014-11-03 15:03:56 +08:00
properties.py Remove warnings when generating docs 2014-12-19 19:16:54 +00:00
resource.py Convert unicode to six in heat/engine 2015-01-22 12:16:54 +03:00
rsrc_defn.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
scheduler.py Convert unicode to six in heat/engine 2015-01-22 12:16:54 +03:00
service_stack_watch.py Separate StackWatch out into it's own module 2014-12-19 14:11:15 +10:00
service.py Merge "Don't do snapshot when other action in progress" 2015-01-30 17:07:00 +00:00
signal_responder.py Log translation hint for Heat.engine (part3) 2014-10-14 09:42:48 +08:00
stack_lock.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
stack_resource.py Merge "Avoid unnecessary passing of child_params in asg" 2015-01-29 07:01:31 +00:00
stack_user.py Authenticate the domain user with id instead of username 2014-12-23 18:40:13 -08:00
stack.py Merge "Enhanced error handling in outputs block" 2015-02-01 22:17:21 +00:00
support.py Remove deprecated function i18n.install('heat') 2014-10-13 10:31:28 +08:00
template.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
timestamp.py Make the first line of every file consistent. 2014-03-04 09:03:04 -06:00
update.py Don't stop update immediately on error 2014-10-20 10:55:20 +08:00
volume_tasks.py Reorganize volume code 2015-01-08 03:24:49 +00:00
watchrule.py Log translation hint for Heat.engine (part3) 2014-10-14 09:42:48 +08:00