Property errors in implicit dependencies cause unhelpful error messages

Bug #1708209 reported by Zane Bitter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Zane Bitter

Bug Description

Normally if there's an error in the property values supplied to a resource, then we'll get that error reported when we validate the resource - along with the proper context to tell us where exactly the error occurred. However, if we access the properties of a resource *before* it is validated, we won't get any of this context when an error occurs. We sometimes do this when calculating implicit dependencies. Here's an example (in Newton):

Unexpected error occurred serving API: Property network not
 assigned
Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
    res = self.dispatcher.dispatch(message)

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
    return self._do_dispatch(endpoint, method, ctxt, args)

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
    result = func(ctxt, **new_args)

  File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 154, in wrapper [231/1987]
    return f(*args, **kwargs)

  File "/usr/lib/python2.7/site-packages/heat/common/context.py", line 424, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 802, in create_stack
    template_id)

  File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 701, in _parse_template_and_validate_stack
    stack.validate()

  File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 154, in wrapper
    return f(*args, **kwargs)

  File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 817, in validate
    iter_rsc = self.dependencies

  File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 399, in dependencies
    ignore_errors=self.id is not None)

  File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 477, in _get_dependencies
    res.add_dependencies(deps)

  File "/usr/lib/python2.7/site-packages/heat/engine/resources/openstack/nova/server.py", line 1088, in add_dependencies
    subnet_net = res.properties.get(subnet.Subnet.NETWORK)

  File "/usr/lib64/python2.7/_abcoll.py", line 363, in get
    return self[key]

  File "/usr/lib/python2.7/site-packages/heat/engine/properties.py", line 471, in __getitem__
    return self._get_property_value(key)

  File "/usr/lib/python2.7/site-packages/heat/engine/properties.py", line 468, in _get_property_value
    raise ValueError(_('Property %s not assigned') % key)

ValueError: Property network not assigned

The problem was an OS::Neutron::Subnet resource that didn't have a 'network' property, but you'd never have known that from the error message, which just said "ERROR: Property network not assigned"

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/490149

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

Related fix proposed to branch: master
Review: https://review.openstack.org/490150

Rabi Mishra (rabi)
Changed in heat:
milestone: pike-rc1 → pike-rc2
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-rc2 → queens-1
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-1 → queens-2
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-2 → queens-3
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-3 → queens-rc1
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-rc1 → rocky-1
Rico Lin (rico-lin)
Changed in heat:
milestone: rocky-1 → rocky-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/490149
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=b50df6b1fc460c7427dacb13ee9e6e41ec63eb22
Submitter: Zuul
Branch: master

commit b50df6b1fc460c7427dacb13ee9e6e41ec63eb22
Author: Zane Bitter <email address hidden>
Date: Wed Aug 2 14:12:12 2017 -0400

    Ignore property errors in implicit dependencies

    Implicit dependencies are calculated before resources are validated.
    Therefore, any error getting a property that occurs during processing on
    implicit dependencies will be raised without any of the context of which
    resource is in error. By ignoring such property errors in implicit
    dependency calculations, we can defer the error handling until the
    actual resource validation and thus give the user an error message they
    can actually use.

    Change-Id: If7e0e8fd46b1b06a29cdd89743635ed32a9392e7
    Closes-Bug: #1708209

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

Reviewed: https://review.openstack.org/490150
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=4979b06bb4ce60620fba37003c287b6ab2e2eb02
Submitter: Zuul
Branch: master

commit 4979b06bb4ce60620fba37003c287b6ab2e2eb02
Author: Zane Bitter <email address hidden>
Date: Wed Aug 2 14:49:22 2017 -0400

    Add catch-all for property errors in implicit dependencies

    The previous patch ensures that we ignore errors getting properties in
    all extant add_dependencies() methods for calculating implicit
    dependencies. To guard against similar errors in future, also ignore and
    log any uncaught ValueError or TypeError exceptions encountered during
    implicit dependency calculation.

    Change-Id: I2cac0add975e36a9c52b9cbb50f0660882322754
    Related-Bug: #1708209

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

This issue was fixed in the openstack/heat 11.0.0.0b2 development milestone.

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.