Provider resource Integer/Number type mismatch

Bug #1317129 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Steve Baker

Bug Description

If you try to override a resource plugin which has an Integer property in it's schema with a provider resource written in HOT, it won't work because of a type mismatch:

heat --debug stack-create r2 -f random_string.yaml -e random_string_env_param.yaml
...
2014-05-07 15:44:07.245 ERROR heat.engine.parser [req-f1d1250e-3b4d-46b0-a22c-07307b8976de admin admin] Property length type mismatch between facade OS::Heat::RandomString (Integer) and provider (Number)
2014-05-07 15:44:07.245 TRACE heat.engine.parser Traceback (most recent call last):
2014-05-07 15:44:07.245 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/parser.py", line 353, in validate
2014-05-07 15:44:07.245 TRACE heat.engine.parser result = res.validate()
2014-05-07 15:44:07.245 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/resources/template_resource.py", line 231, in validate
2014-05-07 15:44:07.245 TRACE heat.engine.parser self._validate_against_facade(facade_cls)
2014-05-07 15:44:07.245 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/resources/template_resource.py", line 196, in _validate_against_facade
2014-05-07 15:44:07.245 TRACE heat.engine.parser raise exception.StackValidationFailed(message=msg)
2014-05-07 15:44:07.245 TRACE heat.engine.parser StackValidationFailed: Property length type mismatch between facade OS::Heat::RandomString (Integer) and provider (Number)

$ cat random_string.yaml && echo "---" && cat random_string_env_param.yaml
heat_template_version: 2013-05-23

parameters:
  random_length:
    type: number
    default: 10

resources:
  random:
    type: OS::Heat::RandomString
    properties:
        length: {get_param: random_length}

outputs:
  random_length:
    value: {get_param: random_length}
  random_value:
    value: {get_attr: [random, value]}
---
resource_registry:
  OS::Heat::RandomString: random_string_provider.yaml

$ cat random_string_provider.yaml
heat_template_version: 2013-05-23

parameters:
  length:
    type: number
    default: 10

resources:
  random:
    type: OS::Heat::RandomString
    properties:
        length: {get_param: length}

outputs:
  value:
    value: {get_attr: [random, value]}

Changed in heat:
assignee: nobody → Yaoguo Jiang (jiangyaoguo)
Changed in heat:
status: New → Confirmed
Changed in heat:
status: Confirmed → 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/97020

Revision history for this message
Yaoguo Jiang (jiangyaoguo) wrote :

Facade resource property type is fixed in resource class code. Its value is in Integer/number/string/boolean/map/list. Template resource property type comes from parameter type, so its value is in number/string/map/list. For template resource, in fact the nested resource passes its parameters as parameters of template resource, so the type validate between facade resource and nested resource can't be exact. Integer property of facade resource is supplied by Number parameter of nested resource.

Changed in heat:
status: In Progress → Fix Committed
Changed in heat:
milestone: none → juno-2
status: Fix Committed → Fix Released
Revision history for this message
Divakar Padiyar Nandavar (divakar-padiyar-nandavar) wrote :

This bug has been marked as "Fix Released", however the patch https://review.openstack.org/97020 is still in review.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

I'm going to assume that Yaoguo Jiang marked this as Fix Committed in error. Fix Committed should only happen when a change gets into git master.

Changed in heat:
status: Fix Released → Triaged
importance: Undecided → Medium
milestone: juno-2 → none
Revision history for this message
Yaoguo Jiang (jiangyaoguo) wrote :

Sorry for my mark error. I was a little confused about bug status. Thanks for Baker's help.

Changed in heat:
assignee: Yaoguo Jiang (jiangyaoguo) → Steve Baker (steve-stevebaker)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit e29fa7c10f5ef00ddee44bba13eee6fee2e4e8b1
Author: Yaoguo Jiang <email address hidden>
Date: Sat May 31 08:23:42 2014 +0000

    Change type validate method of template resource

    The type of template Resource property schema converted from parameter
    is the same as input parameter type, including Number/String/Map/List.
    Resource property schema type includes
    Integer/String/Number/Boolean/Map/List. The Integer type is converted
    from Number type, while Boolean type from String type.

    Change-Id: Ic8ba281b5fb6e17a25fb8b5ba6a1102c827e42b9
    Closes-Bug:#1317129

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