Merge "handle_signal to handle translated error msgs"

This commit is contained in:
Jenkins 2014-08-28 14:03:15 +00:00 committed by Gerrit Code Review
commit 4b113dbef3
2 changed files with 20 additions and 2 deletions

View File

@ -14,6 +14,7 @@
# under the License.
import copy
import six
import uuid
from heat.common import exception
@ -459,8 +460,9 @@ class SoftwareDeployment(signal_responder.SignalResponder):
if status == self.FAILED:
# build a status reason out of all of the values of outputs
# flagged as error_output
status_reason = ', '.join([' : '.join((k, str(status_reasons[k])))
for k in status_reasons])
status_reasons = [' : '.join((k, six.text_type(status_reasons[k])))
for k in status_reasons]
status_reason = ', '.join(status_reasons)
else:
status = self.COMPLETE
status_reason = _('Outputs received')

View File

@ -22,6 +22,7 @@ from heat.engine import parser
from heat.engine.resources.software_config import software_deployment as sd
from heat.engine import rsrc_defn
from heat.engine import template
from heat.openstack.common import gettextutils
from heat.tests.common import HeatTestCase
from heat.tests import utils
@ -536,6 +537,21 @@ class SoftwareDeploymentTest(HeatTestCase):
'status_reason': 'failed : no enough memory found.'
}, args)
# Test bug 1332355, where details contains a translateable message
details = {'failed': gettextutils.Message('need more memory.')}
self.deployment.handle_signal(details)
args = sd.update.call_args[1]
self.assertEqual({
'output_values': {
'deploy_status_code': None,
'deploy_stderr': None,
'deploy_stdout': None,
'failed': 'need more memory.'
},
'status': 'FAILED',
'status_reason': 'failed : need more memory.'
}, args)
def test_handle_status_code_failed(self):
self._create_stack(self.template)
sd = mock.MagicMock()