Update-only SoftwareDeployment fails on update

Bug #1629397 reported by Drago
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Drago
Newton
Fix Committed
High
Zane Bitter
Ocata
Fix Released
High
Drago

Bug Description

Steps to reproduce:

heat_template_version: 2014-10-16

parameters:
  cluster_restart_param:
    default: ''
    type: string

resources:
  restart_cluster:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config: ""

  restart_cluster_deployment:
    type: OS::Heat::SoftwareDeployment
    properties:
      config: {get_resource: restart_cluster}
      server: {get_resource: kube_master}
      actions: ['UPDATE']
      input_values:
        cluster_restart_param: {get_param: cluster_restart_param}

  kube_master:
    type: OS::Nova::Server
    properties:
      image: cirros-0.3.4-x86_64-uec
      flavor: m1.small
      user_data_format: SOFTWARE_CONFIG
      networks:
        - network: public

---

Run:

heat stack-create -f update_sd.template stack1
heat stack-update -x stack1 -P "cluster_restart_param=foo"

Stack will go into UPDATE_FAILED.

Heat engine output:

2016-09-30 17:21:14.575 INFO heat.engine.resource [req-153a6b1e-df4d-456d-89e2-ec37f026f9e0 None admin] UPDATE: SoftwareDeployment "restart_cluster_deployment" Stack "stack1" [f224530d-11be-4d72-969a-6f5684a877fa]
2016-09-30 17:21:14.575 TRACE heat.engine.resource Traceback (most recent call last):
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 753, in _action_recorder
2016-09-30 17:21:14.575 TRACE heat.engine.resource yield
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 1338, in update
2016-09-30 17:21:14.575 TRACE heat.engine.resource prop_diff])
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/scheduler.py", line 335, in wrapper
2016-09-30 17:21:14.575 TRACE heat.engine.resource step = next(subtask)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 800, in action_handler_task
2016-09-30 17:21:14.575 TRACE heat.engine.resource handler_data = handler(*args)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resources/openstack/heat/software_deployment.py", line 438, in handle_update
2016-09-30 17:21:14.575 TRACE heat.engine.resource prev_derived_config = self._get_derived_config_id()
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resources/openstack/heat/software_deployment.py", line 228, in _get_derived_config_id
2016-09-30 17:21:14.575 TRACE heat.engine.resource self.resource_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/rpc/client.py", line 749, in show_software_deployment
2016-09-30 17:21:14.575 TRACE heat.engine.resource return self.call(cnxt, self.make_msg('show_software_deployment',
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/rpc/client.py", line 84, in call
2016-09-30 17:21:14.575 TRACE heat.engine.resource return client.call(ctxt, method, **kwargs)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/client.py", line 428, in call
2016-09-30 17:21:14.575 TRACE heat.engine.resource return self.prepare().call(ctxt, method, **kwargs)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/client.py", line 169, in call
2016-09-30 17:21:14.575 TRACE heat.engine.resource retry=self.retry)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/transport.py", line 97, in _send
2016-09-30 17:21:14.575 TRACE heat.engine.resource timeout=timeout, retry=retry)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 464, in send
2016-09-30 17:21:14.575 TRACE heat.engine.resource retry=retry)
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/_drivers/amqpdriver.py", line 455, in _send
2016-09-30 17:21:14.575 TRACE heat.engine.resource raise result
2016-09-30 17:21:14.575 TRACE heat.engine.resource TypeError: object of type 'NoneType' has no len()
2016-09-30 17:21:14.575 TRACE heat.engine.resource Traceback (most recent call last):
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
2016-09-30 17:21:14.575 TRACE heat.engine.resource res = self.dispatcher.dispatch(message)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
2016-09-30 17:21:14.575 TRACE heat.engine.resource return self._do_dispatch(endpoint, method, ctxt, args)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
2016-09-30 17:21:14.575 TRACE heat.engine.resource result = func(ctxt, **new_args)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
2016-09-30 17:21:14.575 TRACE heat.engine.resource return f(*args, **kwargs)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/common/context.py", line 424, in wrapped
2016-09-30 17:21:14.575 TRACE heat.engine.resource return func(self, ctx, *args, **kwargs)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/service.py", line 2215, in show_software_deployment
2016-09-30 17:21:14.575 TRACE heat.engine.resource cnxt, deployment_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/service_software_config.py", line 239, in show_software_deployment
2016-09-30 17:21:14.575 TRACE heat.engine.resource sd = self._show_software_deployment(cnxt, deployment_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/service_software_config.py", line 224, in _show_software_deployment
2016-09-30 17:21:14.575 TRACE heat.engine.resource cnxt, deployment_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/objects/software_deployment.py", line 72, in get_by_id
2016-09-30 17:21:14.575 TRACE heat.engine.resource db_api.software_deployment_get(context, deployment_id))
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/db/api.py", line 369, in software_deployment_get
2016-09-30 17:21:14.575 TRACE heat.engine.resource return IMPL.software_deployment_get(context, deployment_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/opt/stack/heat/heat/db/sqlalchemy/api.py", line 1040, in software_deployment_get
2016-09-30 17:21:14.575 TRACE heat.engine.resource models.SoftwareDeployment).get(deployment_id)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 831, in get
2016-09-30 17:21:14.575 TRACE heat.engine.resource return self._get_impl(ident, loading.load_on_ident)
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 842, in _get_impl
2016-09-30 17:21:14.575 TRACE heat.engine.resource if len(ident) != len(mapper.primary_key):
2016-09-30 17:21:14.575 TRACE heat.engine.resource
2016-09-30 17:21:14.575 TRACE heat.engine.resource TypeError: object of type 'NoneType' has no len()

This happens because the resource has no ID when handle_update in software_deployment.py is called, which calls self._get_derived_config_id(), which calls sd = self.rpc_client().show_software_deployment(self.context, self.resource_id).

Zane Bitter (zaneb)
Changed in heat:
milestone: none → ocata-1
status: New → Triaged
importance: Undecided → High
assignee: nobody → Drago (dragorosson)
tags: added: newton-rc-potential
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/380479

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 5fc3e013b5df382c2fa6fbfb08c65b4d1c46cd9c
Author: Drago Rosson <email address hidden>
Date: Fri Sep 30 18:14:03 2016 +0000

    Don't get derived config if resource ID unset

    SoftwareDeployments that do not have CREATE as one of their actions will
    not have a resource ID when they are updated. In this case,
    handle_update should not attempt to retrieve the SoftwareDeployment's
    derived config because it will fail.

    Closes-Bug: #1629397
    Change-Id: Ia49a549e11e2e6a1e9399a1370f990780c17bf0d

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/381103

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

Reviewed: https://review.openstack.org/381103
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=ea0ba0ae45cbbc243161797efc6bfde0fb707682
Submitter: Jenkins
Branch: stable/newton

commit ea0ba0ae45cbbc243161797efc6bfde0fb707682
Author: Drago Rosson <email address hidden>
Date: Fri Sep 30 18:14:03 2016 +0000

    Don't get derived config if resource ID unset

    SoftwareDeployments that do not have CREATE as one of their actions will
    not have a resource ID when they are updated. In this case,
    handle_update should not attempt to retrieve the SoftwareDeployment's
    derived config because it will fail.

    Closes-Bug: #1629397
    Change-Id: Ia49a549e11e2e6a1e9399a1370f990780c17bf0d
    (cherry picked from commit 5fc3e013b5df382c2fa6fbfb08c65b4d1c46cd9c)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 8.0.0.0b1

This issue was fixed in the openstack/heat 8.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 7.0.1

This issue was fixed in the openstack/heat 7.0.1 release.

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.