Cannot pass attribute of resource into the OS::Nova::Server image

Bug #1591098 reported by Erik Schilling
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Oleksii Chuprykov

Bug Description

Doing something like:

  my_instance:
    type: OS::Nova::Server
    depends_on: generated_image
    properties:
      image: { get_attr: [generated_image, value] }
      flavor: m1.small

Does not work since the get_attr is not resolved to the real value in the validation step. This means that the validator of OS::Nova::Server will complain about a missing bootable medium.

zaneb confirmed this behaviour on #heat IRC (logs: http://eavesdrop.openstack.org/irclogs/%23heat/%23heat.2016-06-08.log.html#t2016-06-08T20:16:28)

Changed in heat:
assignee: nobody → Oleksii Chuprykov (ochuprykov)
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/338198

Changed in heat:
status: New → In Progress
Changed in heat:
importance: Undecided → Medium
Revision history for this message
Oleksii Chuprykov (ochuprykov) wrote :

I think we can fix this particular situation. In the validation, that precedes to creation of the stack, get_attr resolves to None, and get_resource resolves to None for some resources (e.g. neutron). But further, while accessing the property, we convert None to default value, if it is set in schema, or to "default default", that is '' for strings. We can rely on that '' is correct value, because otherwise it won't pass property validation, that is called before resource plugin validation.

Changed in heat:
milestone: none → newton-2
Revision history for this message
Erik Schilling (ablu-erikschilling-q) wrote :

cool. I will create a new devstack VM and test my plugin there and see wether it works with your change.

Thomas Herve (therve)
Changed in heat:
milestone: newton-2 → newton-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/338198
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=d995aebb498ecf0c9faa9c9640b225db1bda0e75
Submitter: Jenkins
Branch: master

commit d995aebb498ecf0c9faa9c9640b225db1bda0e75
Author: Oleksii Chuprykov <email address hidden>
Date: Wed Jul 6 13:38:58 2016 +0300

    Fix empty values validation in nova server

    In some places in validation code we assume '' value as
    undefined. Howewer, '' means that property is assigned, but
    not yet resolved, i.e. get_attr or get_resource function is
    used and resolved to None and next in the code, when we get the value
    of specific property, we convert None to default value. In this case
    to empty string.

    Closes-Bug: #1591098

    Change-Id: I03a609ce87944c8efc9ec76a7a314d2de27d16d7

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 7.0.0.0b3

This issue was fixed in the openstack/heat 7.0.0.0b3 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.