A direct reference to a swift, s3 resource can be resolved to 'None'

Bug #1202987 reported by geoffroy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Maksym Iarmak

Bug Description

If you build a custom resource 'A' that have a list of references pointing to some 'AWS::S3::Bucket', 'OS::Swift::Container' with a classic '{Ref: "foo"}' pointer, then all the references will be resolved to 'None'.

Basically, the original code of 'resource.Resource' got a protection if the function 'fnGetRefId' is called before storing the resource:
> def FnGetRefId(self):
> if self.resource_id is not None:
> return unicode(self.resource_id)
> else:
> return unicode(self.name)

But 'resources.s3.S3Bucket' and the 'resources.swift.SwiftContainer' class override this function to just
> def FnGetRefId(self):
> return unicode(self.resource_id)

Is there is a particular reason that reference on this 2 types of resources should not be directly made ?

Steven Hardy (shardy)
Changed in heat:
milestone: none → havana-3
Maksym Iarmak (miarmak)
Changed in heat:
assignee: nobody → Maksym Iarmak (miarmak)
Maksym Iarmak (miarmak)
Changed in heat:
status: New → 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/41397

Revision history for this message
Zane Bitter (zaneb) wrote :

References only resolve to None during validation. After the resource is created, they will resolve correctly.

Arguably it's actually better to resolve to None than to the Wrong Thing during validation. Neither is a particularly good solution.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/41397
Committed: http://github.com/openstack/heat/commit/bfddf669cc70958bbe2b4d1b5495151ac116e5e9
Submitter: Jenkins
Branch: master

commit bfddf669cc70958bbe2b4d1b5495151ac116e5e9
Author: Maksym Iarmak <email address hidden>
Date: Wed Aug 14 18:20:12 2013 +0300

    Tests for s3 and swift resources were extended

    According to the description of the bug, the problem
    is in the mechanism of dependencies. That is an internal
    function Ref is not working properly. To repeat it, check
    was added to the test templates (s3_test, swift_test). Thus,
    the bug has not been reproduced.

    Also, the method FnGetRefId in s3 and swift resources,
    despite its name, returns the resource name in the format
    'stack_name-resource_name-resource_id'. This is achieved
    by the method physical_resource_name, that implemented in
    superclass resource.Resource.

    Bug 1202987

    Change-Id: I0f85c39e10e8b455f93fdd768cd5e6ee14497277

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: havana-3 → 2013.2
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.