stack update failed due to AttributeError: 'NoneType' object has no attribute 'properties'

Bug #1375777 reported by XiaoLiang Hu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Low
Angus Salkeld

Bug Description

I try same stack update cases on different resource type , it is failed for below cases:

Note:
1. all the cases base on YAML format heat template
2. all the case pass the stack create , but failed on stack update.
3. all the exception trace back log in engine.log file show same reason for the failed cases.

case1 :
1) create a stack named "stack_test" with only one resource type "OS::Heat::InstanceGroup" named "xx" in template >> success
2) update this template, add a new resource type "OS::Heat::InstanceGroup" named "yy" in template
3) run "stack-update -f template_file stack_test" >>>> failed

I think the expected result should be an new resource "yy" create success and the nova instances which belong to this resource create success as well.

case2 :
1) create a stack named "stack_test" with only one resource type "OS::Heat::InstanceGroup" named "xx" in template >> success
2) update this template, change the value of "Size", such as 1 --- > 2
3) run "stack-update -f template_file stack_test" >>>> failed

I think the expected result should be one nova instance which belong to this resource create success.

case3:
1) create a stack named "stack_test" with resource type "AWS::AutoScaling::AutoScalingGroup" named "my_asg" in template as below >> success

[root@xhu01 heat_action_test]# more autoscalinggroup_aws.yaml
heat_template_version: 2013-05-23

resources:

  my_config:
    type: AWS::AutoScaling::LaunchConfiguration
    properties:
      ImageId: xx
      InstanceType: xhu.test

  my_asg:
    type: AWS::AutoScaling::AutoScalingGroup
    properties:
      AvailabilityZones: [nova]
      MinSize: 1
      MaxSize: 3
      DesiredCapacity: 1
      LaunchConfigurationName: my_config
[root@xhu01 heat_action_test]

2) update this template, add new resource "OS::Heat::InstanceGroup" named "your_asg" in template

[root@xhu01 heat_action_test]# more autoscalinggroup_aws.yaml
heat_template_version: 2013-05-23

resources:

  my_config:
    type: AWS::AutoScaling::LaunchConfiguration
    properties:
      ImageId: xx
      InstanceType: xhu.test

  my_asg:
    type: AWS::AutoScaling::AutoScalingGroup
    properties:
      AvailabilityZones: [nova]
      MinSize: 2
      MaxSize: 3
      DesiredCapacity: 3
      LaunchConfigurationName: my_config

  your_config:
    type: AWS::AutoScaling::LaunchConfiguration
    properties:
      ImageId: xx
      InstanceType: xhu.test

  your_asg:
    type: AWS::AutoScaling::AutoScalingGroup
    properties:
      AvailabilityZones: [nova]
      MinSize: 2
      MaxSize: 3
      DesiredCapacity: 3
      LaunchConfigurationName: your_config

3) run "stack-update -f template_file stack_test" >>>> failed

I think the expected result should be new resource "your_asg" create success, and 3 nova instances which belong to this resource create success.

case4:
1) base on case 3 step 1)
2) update this template, change the value of "DesiredCapacity", such as 1 --- > 2
3) run "stack-update -f template_file stack_test" >>>> failed

I think the expected result should be one nova instances which belong to "my_asg" create success.

the engine.log :

2014-09-30 18:08:29.029 21787 INFO heat.engine.resource [-] updating AutoScalingGroup "my_asg" [666353e9-537d-4ee1-8345-1e445f1c1120] Stack "xx" [98397eba-6c7f-4997-a9c3-cc5953378da7]
2014-09-30 18:08:29.055 21787 INFO heat.engine.environment [-] Registering OS::Heat::ScaledResource -> AWS::EC2::Instance
2014-09-30 18:08:29.100 21787 INFO heat.engine.resource [-] UPDATE: AutoScalingGroup "my_asg" [666353e9-537d-4ee1-8345-1e445f1c1120] Stack "xx" [98397eba-6c7f-4997-a9c3-cc5953378da7]
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource Traceback (most recent call last):
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resource.py", line 435, in _action_recorder
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource yield
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resource.py", line 690, in update
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource args=[after, tmpl_diff, prop_diff])
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/scheduler.py", line 286, in wrapper
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource step = next(subtask)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resource.py", line 476, in action_handler_task
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource handler_data = handler(*args)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 605, in handle_update
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource adjustment_type=EXACT_CAPACITY)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 654, in adjust
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource LOG.exception(_('Failed sending error notification'))
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/openstack/common/excutils.py", line 82, in __exit__
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource six.reraise(self.type_, self.value, self.tb)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 645, in adjust
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource self.resize(new_capacity)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 378, in resize
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource new_template = self._create_template(new_capacity)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 305, in _create_template
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource instance_definition = self._get_instance_definition()
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource File "/usr/lib/python2.6/site-packages/heat/engine/resources/autoscaling.py", line 281, in _get_instance_definition
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource props = function.resolve(conf.properties.data)
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource AttributeError: 'NoneType' object has no attribute 'properties'
2014-09-30 18:08:29.100 21787 TRACE heat.engine.resource

I don't see the my test way/step has issue, basically, I refer to http://docs.openstack.org/developer/heat/template_guide/ as the a guide to generate my test case. I think this is the heat bug, heat engine should show the reason for why update failed in log file so that the end user can take follow up action, thanks.

Angus Salkeld (asalkeld)
Changed in heat:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Angus Salkeld (asalkeld) wrote :

I have reproduced this and can add:

heat event-list st
+---------------+--------------------------------------+-----------------------------------------------------------------+--------------------+----------------------+
| resource_name | id | resource_status_reason | resource_status | event_time |
+---------------+--------------------------------------+-----------------------------------------------------------------+--------------------+----------------------+
| your_asg | 3420cf21-5145-4d93-950e-bbf521231b6e | AttributeError: 'NoneType' object has no attribute 'properties' | CREATE_FAILED | 2014-10-01T00:46:13Z |
| your_asg | 36a43554-93cd-40da-83d9-a3debd9ccfbf | state changed | CREATE_IN_PROGRESS | 2014-10-01T00:46:13Z |
| my_asg | d492c470-4e65-4e86-8465-64dcb5e28e38 | state changed | CREATE_COMPLETE | 2014-10-01T00:44:12Z |
| my_config | 0f3c76b9-a9bb-4da1-b467-a7e83d401600 | state changed | CREATE_COMPLETE | 2014-10-01T00:44:11Z |
| my_config | 873a6220-dd86-43fb-841e-716f23f220e5 | state changed | CREATE_IN_PROGRESS | 2014-10-01T00:44:11Z |
| my_asg | fd11f4de-6fc2-490b-9c3b-39cbbde5a5b3 | state changed | CREATE_IN_PROGRESS | 2014-10-01T00:44:11Z |
+---------------+--------------------------------------+-----------------------------------------------------------------+--------------------+----------------------+

I added the your_asg and your_conf in the update.
Notice that your_conf has not been created, so it looks like the update dependencies are not working correctly.

Revision history for this message
Angus Salkeld (asalkeld) wrote :

silly me, the template is wrong.

Please change the following:
LaunchConfigurationName: my_config
to
LaunchConfigurationName: {Ref: my_config}

This is why you are not getting a dependency between the auto-scaling group and the launchconfig.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html

Changed in heat:
status: Confirmed → New
importance: High → Undecided
Revision history for this message
Angus Salkeld (asalkeld) wrote :

This is a common error, I could add a validation check for this.

Angus Salkeld (asalkeld)
Changed in heat:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Angus Salkeld (asalkeld)
milestone: none → next
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/125251

Changed in heat:
status: Triaged → In Progress
Revision history for this message
Mike Spreitzer (mike-spreitzer) wrote :

Let's also update the documentation of the ASG resource type to be clear on this point, since the name is misleading.

Revision history for this message
XiaoLiang Hu (xlhuxa) wrote :

Hi, all:
Thanks for your timely reply, I change my template according to your suggestion, all the case1- case 4 work well now.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/125251
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=bbe47783b587c6da2ba1a86e332fbd37096005c4
Submitter: Jenkins
Branch: master

commit bbe47783b587c6da2ba1a86e332fbd37096005c4
Author: Angus Salkeld <email address hidden>
Date: Tue Oct 21 10:48:28 2014 +1000

    Make sure that AutoScalingGroup depends on the launch config

    It seems to be common error to do the following:
      LaunchConfigurationName: my_config
    and not include a depends_on.

    Largely because of the unfortunate property name.
    So this patch tries to make sure the user has the
    correct dependency in place.

    Change-Id: I4f7d282d0af8681dc2c8cd265e16a27fe23a3bdb
    Closes-bug: #1375777

Changed in heat:
status: In Progress → Fix Committed
Changed in heat:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.