[openstack-dev] [heat] Issue with validation and preview due to get_attr==None

Jay Dobies jason.dobies at redhat.com
Wed Mar 23 18:37:31 UTC 2016


This is the same issue I ran into a few months ago regarding the nested 
parameter validation. Since it resolves to None at that time, there's no 
hook in our current nested parameters implementation to show that it 
will have a value passed in from the parent template.

Unfortunately, I don't have much to offer in terms of a solution, but 
I'm very interested in where this conversation goes :)

On 3/23/16 1:14 PM, Steven Hardy wrote:
> Hi all,
>
> I'm looking for some help and additional input on this bug:
>
> https://bugs.launchpad.net/heat/+bug/1559807
>
> Basically, we have multiple issues due to the fact that we consider
> get_attr to resolve to None at any point before a resource is actually
> instantiated.
>
> It's due to this:
>
> https://github.com/openstack/heat/blob/master/heat/engine/hot/functions.py#L163
>
> This then causes problems during validation of several intrinsic functions,
> because if they reference get_attr, they have to contain hacks and
> special-cases to work around the validate-time None value (or, as reported
> in the bug, fail to validate when all would be fine at runtime).
>
> https://github.com/openstack/heat/blob/master/heat/engine/resource.py#L1333
>
> I started digging into fixes, and there are probably a few possible
> approaches, e.g setting stack.Stack.strict_validate always to False, or
> reworking the intrinsic function validation to always work with the
> temporary None value.
>
> However, it's a more widespread issue than just validation - this affects
> any action which happens before the actual stack gets created, so things
> like preview updates are also broken, e.g consider this:
>
> resources:
>    random:
>      type: OS::Heat::RandomString
>
>    config:
>      type: OS::Heat::StructuredConfig
>      properties:
>        group: script
>        config:
>          foo: {get_attr: [random, value]}
>
>    deployment:
>      type: OS::Heat::StructuredDeployment
>      properties:
>        config:
>          get_resource: config
>        server: "dummy"
>
> On update, nothing is replaced, but if you do e.g:
>
>    heat stack-update -x --dry-run
>
> You see this:
>
> | replaced  | config        | OS::Heat::StructuredConfig     |
>
> Which occurs due to the false comparison between the current value of
> "random" and the None value we get from get_attr in the temporary stack
> used for preview comparison:
>
> https://github.com/openstack/heat/blob/master/heat/engine/resource.py#L528
>
> after_props.get(key) returns None, which makes us falsely declare the
> "config" resource gets replaced :(
>
> I'm looking for ideas on how we solve this - it's clearly a major issue
> which completely invalidates the results of validate and preview operations
> in many cases.
>
> Steve
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



More information about the OpenStack-dev mailing list