[openstack-dev] [heat] Issue with validation and preview due to	get_attr==None
    Steven Hardy 
    shardy at redhat.com
       
    Wed Mar 23 17:14:23 UTC 2016
    
    
  
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
    
    
More information about the OpenStack-dev
mailing list