Error occurs when Set template "Resources" Part use non-english key

Bug #1249238 reported by Chen Xiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Chen Xiao

Bug Description

Set template Part "Resources" use non-english key.
"Resources" : {
    "WikiDatabase工作": {
      "Type": "AWS::EC2::Instance",
      "Metadata" : {
        "AWS::CloudFormation::Init" : {
          "config" : {
            "packages" : {
              "yum" : {
                "mysql" : [],
                "mysql-server" : [],
                "httpd" : [],
                "wordpress" : []
              }
            },
            "services" : {
              "systemd" : {
                "mysqld" : { "enabled" : "true", "ensureRunning" : "true" },
                "httpd" : { "enabled" : "true", "ensureRunning" : "true" }
              }
            }
          }
        }
      },

then heat stack-create teststack2 -f WordPress_Single_Instance.template -P "InstanceType=m1.test;DBUsername=wp;DBPassword=verybadpassword;KeyName=heat_key;LinuxDistribution=F17"

then execute "heat -v resource-list 118106ff-f984-4ae5-8225-312ecf1a3029"

ERROR: u'\u5de5'
Traceback (most recent call last):
  File "/opt/stack/heat/heat/api/middleware/fault.py", line 127, in process_request
    return req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/heat/heat/common/wsgi.py", line 368, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 571, in __call__
    return self.app(env, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/heat/heat/common/wsgi.py", line 368, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/heat/heat/common/wsgi.py", line 687, in __call__
    raise translate_exception(err, request.best_match_language())
KeyError: u'\u5de5'

Changed in heat:
status: New → Triaged
importance: Undecided → High
milestone: none → icehouse-1
Chen Xiao (chenxiao)
Changed in heat:
assignee: nobody → Chen Xiao (chenxiao)
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/56165

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

Reviewed: https://review.openstack.org/56165
Committed: http://github.com/openstack/heat/commit/89f2a206343abff142fb10d1640ce3eac654f996
Submitter: Jenkins
Branch: master

commit 89f2a206343abff142fb10d1640ce3eac654f996
Author: chenxiao <email address hidden>
Date: Wed Nov 13 16:21:21 2013 +0800

    Fixes Error when contain Non-ascii in template

    when set template use non-english resource_name and execute
    "heat -v resource-list $stack_id". KeyError will occur because
    heat can not encode it correctly. This patch will implement
    a process to encode the resource_name.

    The patch use a new module (strutils.py) taken from
    oslo-incubator in order to use safe_encode() and
    safe_decode(), and this module is useful for future
    patchs.

    Change-Id: Idddda20d96bca32cb4df94ede31b40f7141e3afe
    Closes-Bug: #1249238

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-1 → 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.