heat/heat/engine/resources
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
..
aws Merge "Implement 'InstanceId' for autoscaling group" 2015-01-31 15:39:47 +00:00
ceilometer Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
neutron Merge "Add 'shared' property for OS::Neutron::MeteringLabel" 2015-01-30 23:18:14 +00:00
openstack Merge "Remove TaskRunner from WaitCondition" 2015-01-26 04:32:42 +00:00
software_config Merge "Fix sw component creation parameter error" 2015-02-02 08:30:31 +00:00
__init__.py Use oslo.config generator 2015-01-02 13:14:20 +01:00
cloud_watch.py Add 'required' attribute to OS::Heat::CWLiteAlarm properties 2014-12-24 15:05:27 +00:00
eip.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
glance_image.py Provide support status info for OS::Glance::Image 2014-10-03 06:43:22 +02:00
instance.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
instance_group.py Merge "Avoid unnecessary passing of child_params in asg" 2015-01-29 07:01:31 +00:00
internet_gateway.py Enable F402 and F812 style checks 2015-01-05 11:58:27 +02:00
iso_8601.py Support loading constraints as stevedore extensions 2014-06-30 21:50:11 -10:00
loadbalancer.py Merge "Enable H904 style checking rule" 2015-01-26 04:31:38 +00:00
network_interface.py Remove deprecated function i18n.install('heat') 2014-10-13 10:31:28 +08:00
nova_floatingip.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
nova_keypair.py Change hardcoded attr names in _resolve_attribute 2014-12-17 19:32:32 +03:00
nova_servergroup.py Adding missed whitespace between the words 2014-10-28 04:32:29 -04:00
nova_utils.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
os_database.py Switch to oslo.utils.uuidutils 2014-12-26 11:54:56 +01:00
random_string.py Enable F402 and F812 style checks 2015-01-05 11:58:27 +02:00
remote_stack.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
resource_group.py Enable H904 style checking rule 2015-01-20 11:14:06 +02:00
route_table.py Enable E265 style check 2015-01-05 11:58:27 +02:00
s3.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
sahara_cluster.py Renaming image property to default_image_id 2015-01-23 20:33:11 -05:00
sahara_templates.py Allow floating_ip_pool on Nova-net in Sahara 2015-01-27 13:49:51 +02:00
security_group.py Implement update of AWS::EC2::SecurityGroup rules 2014-11-03 14:22:36 +02:00
server.py Merge "Improve address description by example" 2015-01-26 17:41:30 +00:00
stack.py Remove deprecated function i18n.install('heat') 2014-10-13 10:31:28 +08:00
subnet.py Fix [H302] errors in heat/engine 2014-11-26 16:43:55 +03:00
swift.py Enable H305 and H307 style checks 2015-01-20 09:47:25 +02:00
swiftsignal.py Remove TaskRunner from SwiftSignal 2015-01-21 09:55:15 +02:00
template_resource.py Use "if stack is not None" and not "if stack" 2015-02-02 20:10:20 +10:00
user.py Enable F402 and F812 style checks 2015-01-05 11:58:27 +02:00
vpc.py Remove deprecated function i18n.install('heat') 2014-10-13 10:31:28 +08:00
wait_condition.py Split wait condition handle into separate files 2015-01-13 03:11:33 +00:00