summaryrefslogtreecommitdiff
path: root/heatclient/common/template_utils.py
diff options
context:
space:
mode:
authorTetiana Lashchova <tlashchova@mirantis.com>2014-12-01 17:54:08 +0200
committerTetiana Lashchova <tlashchova@mirantis.com>2014-12-10 12:25:06 +0200
commit6ff27ccabf0580d57f48e607b21535f5475ff3fe (patch)
tree032bf46d2426b7e134da7745c7d27a566b5b787f /heatclient/common/template_utils.py
parent4916c64f7fc126cbcce05055569d4ff7efb37e3a (diff)
downloadpython-heatclient-6ff27ccabf0580d57f48e607b21535f5475ff3fe.tar.gz
Add transtlation markers for error messages
Change-Id: Ic44073880b7e65b6530a7314a5a2d65eb4aadb09 Partial-Bug: #1269930
Diffstat (limited to 'heatclient/common/template_utils.py')
-rw-r--r--heatclient/common/template_utils.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py
index bf55c91..29dd3fc 100644
--- a/heatclient/common/template_utils.py
+++ b/heatclient/common/template_utils.py
@@ -26,6 +26,7 @@ from oslo.serialization import jsonutils
from heatclient.common import environment_format
from heatclient.common import template_format
from heatclient import exc
+from heatclient.openstack.common._i18n import _
def get_template_contents(template_file=None, template_url=None,
@@ -44,12 +45,16 @@ def get_template_contents(template_file=None, template_url=None,
tpl = object_request and object_request('GET',
template_object)
else:
- raise exc.CommandError('Need to specify exactly one of '
- '--template-file, --template-url '
- 'or --template-object')
+ raise exc.CommandError(_('Need to specify exactly one of '
+ '%(arg1)s, %(arg2)s or %(arg3)s') %
+ {
+ 'arg1': '--template-file',
+ 'arg2': '--template-url',
+ 'arg3': '--template-object'
+ })
if not tpl:
- raise exc.CommandError('Could not fetch template from %s'
+ raise exc.CommandError(_('Could not fetch template from %s')
% template_url)
try:
@@ -57,8 +62,8 @@ def get_template_contents(template_file=None, template_url=None,
tpl = tpl.decode('utf-8')
template = template_format.parse(tpl)
except ValueError as e:
- raise exc.CommandError(
- 'Error parsing template %s %s' % (template_url, e))
+ raise exc.CommandError(_('Error parsing template %(url)s %(error)s') %
+ {'url': template_url, 'error': e})
tmpl_base_url = base_url_for_url(template_url)
if files is None:
@@ -138,8 +143,8 @@ def read_url_content(url):
try:
content = request.urlopen(url).read()
except error.URLError:
- raise exc.CommandError('Could not fetch contents for %s'
- % url)
+ raise exc.CommandError(_('Could not fetch contents for %s') % url)
+
if content:
try:
content.decode('utf-8')