Fn::GetAtt fails validation when used as a property

Bug #1192142 reported by Zane Bitter
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve Baker
Grizzly
Fix Released
High
Steven Hardy

Bug Description

Since https://github.com/openstack/heat/commit/c19a3deb649b6e4c5ea933e7c0ad157f4049d185 the function Fn::GetAtt always returns None during validation (when no resources have yet been created). This causes validation to fail whenever Fn::GetAtt is used inside a resource Property that is type-checked. The test below illustrates the problem:

    def test_verify_property_getatt(self):
        # patch in a dummy property schema for GenericResource
        dummy_schema = {'Foo': {'Type': 'String'}}
        generic_rsrc.GenericResource.properties_schema = dummy_schema

        template = {
            'Resources': {'R1': {'Type': 'GenericResourceType'},
                          'R2': {'Type': 'GenericResourceType',
                                 'Properties': {'Foo': {'Fn::GetAtt': ['R1',
                                                                       'a']}}}}
        }
        ctx = context.get_admin_context()
        stack = parser.Stack(ctx, 'test_stack', parser.Template(template))
        stack.validate()

The same is true for returning None from Ref, so we will need a better fix for bug #1191931 than the current one (https://github.com/openstack/heat/commit/40c4b44d02717b2aa8f420ca516ce662d2a1b978)

Zane Bitter (zaneb)
description: updated
Steven Hardy (shardy)
Changed in heat:
status: New → Triaged
Changed in heat:
status: Triaged → In Progress
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/35552

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

Reviewed: https://review.openstack.org/35552
Committed: http://github.com/openstack/heat/commit/15bdfe029eb9274fd37ad2d6e8ec3001ec6eaf8e
Submitter: Jenkins
Branch: master

commit 15bdfe029eb9274fd37ad2d6e8ec3001ec6eaf8e
Author: Steve Baker <email address hidden>
Date: Wed Jul 3 15:21:23 2013 +1200

    Define behaviour for properties with None values.

    Now that Ref and Fn::GetAtt might return None values, behaviour for
    properties with None values needs definition.

    This change will treat a None value in the following way:
    - if there is a default in the schema, that value will be used
    - otherwise a default is used depending on the type ('', False, 0, [] {})

    Fixes bug: #1192142

    Change-Id: I59ae32c1c32b1bfede7d775aa845cd14246040e1

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Steven Hardy (shardy)
tags: added: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/38467

Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (stable/grizzly)

Reviewed: https://review.openstack.org/38467
Committed: http://github.com/openstack/heat/commit/f9711657326c70afc97f7b0272e760fe25e13a3d
Submitter: Jenkins
Branch: stable/grizzly

commit f9711657326c70afc97f7b0272e760fe25e13a3d
Author: Steve Baker <email address hidden>
Date: Wed Jul 3 15:21:23 2013 +1200

    Define behaviour for properties with None values.

    Now that Ref and Fn::GetAtt might return None values, behaviour for
    properties with None values needs definition.

    This change will treat a None value in the following way:
    - if there is a default in the schema, that value will be used
    - otherwise a default is used depending on the type ('', False, 0, [] {})

    Fixes bug: #1192142

    Change-Id: I59ae32c1c32b1bfede7d775aa845cd14246040e1
    (cherry picked from commit 15bdfe029eb9274fd37ad2d6e8ec3001ec6eaf8e)

Thierry Carrez (ttx)
Changed in heat:
milestone: havana-2 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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