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

[oozie] Fix submitting oozie workflow from HDFS

- Fix application_path to not add extra slash e.g //user
- Convert byte objects to str at different places
Harshg999 3 жил өмнө
parent
commit
654c048117

+ 3 - 1
apps/oozie/src/oozie/views/dashboard.py

@@ -975,7 +975,7 @@ def submit_external_job(request, application_path):
     application_path = application_path.replace("abfs:/", "abfs://")
   elif application_path.startswith('s3a:/') and not application_path.startswith('s3a://'):
     application_path = application_path.replace('s3a:/', 's3a://')
-  else:
+  elif not application_path.startswith('/'):
     application_path = "/" + application_path
 
   if application_path.startswith("abfs://"):
@@ -1022,6 +1022,8 @@ def submit_external_job(request, application_path):
                    'show_dryrun': os.path.basename(application_path) != 'bundle.xml',
                    'return_json': request.GET.get('format') == 'json'
                  }, force_template=True).content
+
+  popup = popup.decode('utf-8') if hasattr(popup, 'decode') else popup
   return JsonResponse(popup, safe=False)
 
 

+ 2 - 0
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -408,10 +408,12 @@ STORED AS TEXTFILE %s""" % (self.properties.get('send_result_path'),
     """From XML and job.properties HDFS files"""
     deployment_dir = os.path.dirname(application_path)
     xml = self.fs.do_as_user(self.user, self.fs.read, application_path, 0, 1 * 1024 ** 2)
+    xml = xml.decode('utf-8') if hasattr(xml, 'decode') else xml
 
     properties_file = deployment_dir + '/job.properties'
     if self.fs.do_as_user(self.user, self.fs.exists, properties_file):
       properties = self.fs.do_as_user(self.user, self.fs.read, properties_file, 0, 1 * 1024 ** 2)
+      properties = properties.decode('utf-8') if hasattr(properties, 'decode') else properties
     else:
       properties = None