Эх сурвалжийг харах

HUE-2062 [pig] Editor fails with non ASCII characters

fix the problem, was related to webhdfs call.
tested other non ascii fields
not easy to test
fixed oozie too
Romain Rigaux 11 жил өмнө
parent
commit
8e79c58

+ 1 - 1
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -41,7 +41,7 @@ ${ layout.menubar(section='workflows') }
       <ul class="nav nav-list">
         <li class="nav-header">${ _('Editor') }</li>
         <li><a href="#editWorkflow"><i class="fa fa-code-fork"></i> ${ _('Workflow') }</a></li>
-        <li><a href="#properties"><i class="fa fa-reorder"></i> ${ _('Properties') }</a></li>
+        <li><a href="#properties"><i class="fa fa-cog"></i> ${ _('Properties') }</a></li>
         % if user_can_edit_job:
           <li>
             <a data-bind="attr: {href: '/filebrowser/view' + deployment_dir() }" target="_blank" title="${ _('Go upload additional files and libraries to the deployment directory on HDFS') }" rel="tooltip" data-placement="right"><i class="fa fa-folder-open"></i> ${ _('Workspace') }</a>

+ 2 - 1
apps/pig/src/pig/api.py

@@ -24,6 +24,7 @@ from django.core.urlresolvers import reverse
 from django.utils.html import escape
 from django.utils.translation import ugettext as _
 
+from desktop.lib.i18n import smart_str
 from desktop.lib.view_util import format_duration_in_millis
 from filebrowser.views import location_to_url
 from jobbrowser.views import job_single_logs
@@ -77,7 +78,7 @@ class OozieApi:
 
     script_path = workflow.deployment_dir + '/script.pig'
     if self.fs: # For testing, difficult to mock
-      self.fs.do_as_user(self.user.username, self.fs.create, script_path, data=pig_script.dict['script'])
+      self.fs.do_as_user(self.user.username, self.fs.create, script_path, data=smart_str(pig_script.dict['script']))
 
     files = []
     archives = []

+ 4 - 3
desktop/libs/liboozie/src/liboozie/submittion.py

@@ -23,6 +23,7 @@ import time
 from django.utils.translation import ugettext as _
 
 from desktop.lib.exceptions_renderable import PopupException
+from desktop.lib.i18n import smart_str
 from hadoop import cluster
 from hadoop.fs.hadoopfs import Hdfs
 
@@ -242,9 +243,9 @@ class Submission(object):
         raise IOError(ex.errno, msg)
 
     if not self.fs.exists(path):
-      self._do_as(self.user.username , self.fs.mkdir, path, perms)
+      self._do_as(self.user.username, self.fs.mkdir, path, perms)
 
-    self._do_as(self.user.username , self.fs.chmod, path, perms)
+    self._do_as(self.user.username, self.fs.chmod, path, perms)
 
     return path
 
@@ -254,7 +255,7 @@ class Submission(object):
     This should run as the workflow user.
     """
     xml_path = self.fs.join(deployment_dir, self.job.get_application_filename())
-    self.fs.create(xml_path, overwrite=True, permission=0644, data=oozie_xml)
+    self.fs.create(xml_path, overwrite=True, permission=0644, data=smart_str(oozie_xml))
     LOG.debug("Created %s" % (xml_path,))
 
     # List jar files