Parameter JSONParam doesn't work

Bug #1256891 reported by Mitsuru Kanabuchi
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Mitsuru Kanabuchi

Bug Description

I tried to use JSONParam as a parameter.
But the following error occured.

I think conversion of string to map is need at properties.py:_validate_map.

Template file:

$ cat vm-json.template
{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Parameters" : {
    "prm_imageid" : {
      "Type" : "String"
    },
    "prm_metadata" : {
      "Type" : "Json"
    }
  },
  "Resources" : {
    "instance": {
      "Type": "OS::Nova::Server",
      "Properties": {
        "image" : { "Ref" : "prm_imageid" },
        "flavor" : "m1.tiny",
        "metadata": { "Ref" : "prm_metadata" }
      }
    }
  }
}

Console:

$ heat stack-create -f vm-json.template -P 'prm_imageid=993f452c-82d5-4eca-9dbb-7d20b3103c1f;prm_metadata={"aaa":"bbb","ccc":"ddd"}' test
ERROR: Property error : instance: metadata "{"aaa":"bbb","ccc":"ddd"}" is not a map

Log:

2013-12-02 20:25:09.108 ERROR heat.engine.parser [req-678c1a84-662d-4f2e-a932-0e833f09ad45 admin admin] Property error : instance: metadata "{"aaa":"bbb","ccc":"ddd"}" is not a map
2013-12-02 20:25:09.108 TRACE heat.engine.parser Traceback (most recent call last):
2013-12-02 20:25:09.108 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/parser.py", line 317, in validate
2013-12-02 20:25:09.108 TRACE heat.engine.parser result = res.validate()
2013-12-02 20:25:09.108 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/resources/server.py", line 431, in validate
2013-12-02 20:25:09.108 TRACE heat.engine.parser super(Server, self).validate()
2013-12-02 20:25:09.108 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/resource.py", line 538, in validate
2013-12-02 20:25:09.108 TRACE heat.engine.parser return self.properties.validate()
2013-12-02 20:25:09.108 TRACE heat.engine.parser File "/opt/stack/heat/heat/engine/properties.py", line 719, in validate
2013-12-02 20:25:09.108 TRACE heat.engine.parser raise exception.StackValidationFailed(message=msg)
2013-12-02 20:25:09.108 TRACE heat.engine.parser StackValidationFailed: Property error : instance: metadata "{"aaa":"bbb","ccc":"ddd"}" is not a map
2013-12-02 20:25:09.108 TRACE heat.engine.parser
2013-12-02 20:25:09.142 ERROR heat.openstack.common.rpc.amqp [req-678c1a84-662d-4f2e-a932-0e833f09ad45 admin admin] Exception during message handling
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp Traceback (most recent call last):
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/openstack/common/rpc/amqp.py", line 461, in _process_data
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp **args)
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/service.py", line 60, in wrapped
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp return func(self, ctx, *args, **kwargs)
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/service.py", line 292, in create_stack
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp stack.validate()
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp File "/opt/stack/heat/heat/engine/parser.py", line 324, in validate
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp six.text_type(ex)))
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp StackValidationFailed: Property error : instance: metadata "{"aaa":"bbb","ccc":"ddd"}" is not a map
2013-12-02 20:25:09.142 TRACE heat.openstack.common.rpc.amqp

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
milestone: none → icehouse-2
Changed in heat:
assignee: nobody → Mitsuru Kanabuchi (kanabuchi)
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/59618

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/59618
Committed: http://github.com/openstack/heat/commit/30835f56d6e51cab13399f92748062f6f383e584
Submitter: Jenkins
Branch: master

commit 30835f56d6e51cab13399f92748062f6f383e584
Author: Mitsuru Kanabuchi <email address hidden>
Date: Tue Dec 3 19:42:26 2013 +0900

    Return map parsed value at JsonParam.value

    Currently, JsonParam returns String value as JsonParam.value.
    However, SCHEMA_TYPES:MAP property doesn't support getting String value.
    JsonParam have to return map value for to work properly.

    Fixes bug #1256891

    Change-Id: I5acc1aa95c0c0e7bebc760d8bf088971630696ec

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: icehouse-2 → 2014.1
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.