Browse Source

HUE-8888 [fs] Light style refactoring and fixing non lazy translations

Romain 5 years ago
parent
commit
14fd3dda9b

+ 3 - 5
desktop/core/src/desktop/lib/conf.py

@@ -79,7 +79,7 @@ import subprocess
 import sys
 
 from django.utils.encoding import smart_str
-from django.utils.translation import ugettext as _
+from django.utils.translation import ugettext_lazy as _t
 from configobj import ConfigObj, ConfigObjError
 
 from desktop.lib.paths import get_desktop_root, get_build_dir
@@ -148,7 +148,7 @@ class BoundConfig(object):
         data = self.bind_to
     except AttributeError:
       LOG.exception("Error value of key '%s' in configuration." % self.grab_key)
-      data = _("Possible misconfiguration")
+      data = _t("Possible misconfiguration")
       present = True
 
     return data, present
@@ -191,9 +191,7 @@ class BoundConfig(object):
     self.config.print_help(*args, **kwargs)
 
   def __repr__(self):
-    return repr("%s(config=%s, bind_to=%s, grab_key=%s)" %
-                (str(self.__class__),
-                 repr(self.config), repr(self.bind_to), repr(self.grab_key)))
+    return repr("%s(config=%s, bind_to=%s, grab_key=%s)" % (str(self.__class__),  repr(self.config), repr(self.bind_to), repr(self.grab_key)))
 
 
 class Config(object):

+ 2 - 0
desktop/core/src/desktop/settings.py

@@ -610,6 +610,8 @@ if is_s3_enabled():
 
 if is_abfs_enabled():
   file_upload_handlers.insert(0, 'azure.abfs.upload.ABFSFileUploadHandler')
+
+
 FILE_UPLOAD_HANDLERS = tuple(file_upload_handlers)
 
 ############################################################

+ 83 - 38
desktop/libs/hadoop/src/hadoop/conf.py

@@ -71,31 +71,56 @@ HDFS_CLUSTERS = UnspecifiedConfigSection(
   each=ConfigSection(
     help="Information about a single HDFS cluster",
     members=dict(
-      FS_DEFAULTFS=Config("fs_defaultfs", help="The equivalent of fs.defaultFS (aka fs.default.name)",
-                          default="hdfs://localhost:8020"),
-      LOGICAL_NAME = Config("logical_name", default="",
-                            type=str, help=_t('NameNode logical name.')),
-      WEBHDFS_URL=Config("webhdfs_url",
-                         help="The URL to WebHDFS/HttpFS service. Defaults to " +
-                         "the WebHDFS URL on the NameNode.",
-                         type=str, default="http://localhost:50070/webhdfs/v1"),
-      NN_KERBEROS_PRINCIPAL=Config("nn_kerberos_principal", help="Kerberos principal for NameNode", # Unused
-                                   default="hdfs", type=str),
-      DN_KERBEROS_PRINCIPAL=Config("dn_kerberos_principal", help="Kerberos principal for DataNode", # Unused
-                                   default="hdfs", type=str),
-      SECURITY_ENABLED=Config("security_enabled", help="Is running with Kerberos authentication",
-                              default=False, type=coerce_bool),
-      SSL_CERT_CA_VERIFY=Config("ssl_cert_ca_verify",
-                  help="In secure mode (HTTPS), if SSL certificates from YARN Rest APIs have to be verified against certificate authority",
-                  dynamic_default=default_ssl_validate,
-                  type=coerce_bool),
-      TEMP_DIR=Config("temp_dir", help="HDFS directory for temporary files",
-                      default='/tmp', type=str),
+      FS_DEFAULTFS=Config(
+          "fs_defaultfs",
+          help="The equivalent of fs.defaultFS (aka fs.default.name)",
+          default="hdfs://localhost:8020"
+      ),
+      LOGICAL_NAME = Config(
+          "logical_name",
+          default="",
+          type=str,
+          help=_t('NameNode logical name.')
+      ),
+      WEBHDFS_URL=Config(
+          "webhdfs_url",
+          help="The URL to WebHDFS/HttpFS service. Defaults to the WebHDFS URL on the NameNode.",
+          type=str,
+          default="http://localhost:50070/webhdfs/v1"
+      ),
+      NN_KERBEROS_PRINCIPAL=Config(
+          "nn_kerberos_principal",
+          help="Kerberos principal for NameNode", # Unused
+          default="hdfs",
+          type=str
+      ),
+      DN_KERBEROS_PRINCIPAL=Config(
+          "dn_kerberos_principal",
+          help="Kerberos principal for DataNode", # Unused
+          default="hdfs",
+          type=str
+      ),
+      SECURITY_ENABLED=Config(
+          "security_enabled",
+          help="Is running with Kerberos authentication",
+          default=False, type=coerce_bool
+      ),
+      SSL_CERT_CA_VERIFY=Config(
+          "ssl_cert_ca_verify",
+          help="In secure mode (HTTPS), if SSL certificates from YARN Rest APIs have to be verified against certificate authority",
+          dynamic_default=default_ssl_validate,
+          type=coerce_bool
+      ),
+      TEMP_DIR=Config(
+          "temp_dir",
+          help="HDFS directory for temporary files",
+          default='/tmp',
+          type=str
+      ),
       HADOOP_CONF_DIR = Config(
         key="hadoop_conf_dir",
         dynamic_default=get_hadoop_conf_dir_default,
-        help=("Directory of the Hadoop configuration) Defaults to the environment variable " +
-              "HADOOP_CONF_DIR when set, or '/etc/hadoop/conf'.")
+        help=_t("Directory of the Hadoop configuration) Defaults to the environment variable HADOOP_CONF_DIR when set, or '/etc/hadoop/conf'.")
       )
     )
   )
@@ -109,22 +134,42 @@ MR_CLUSTERS = UnspecifiedConfigSection(
     help="Information about a single MapReduce cluster",
     members=dict(
       HOST=Config("jobtracker_host", help="Host/IP for JobTracker"),
-      PORT=Config("jobtracker_port",
-                  default=8021,
-                  help="Service port for the JobTracker",
-                  type=int),
-      LOGICAL_NAME=Config('logical_name',
-                          default="",
-                          type=str,
-                          help=_t('JobTracker logical name.')),
-      JT_THRIFT_PORT=Config("thrift_port", help="Thrift port for JobTracker", default=9290,
-                            type=int),
-      JT_KERBEROS_PRINCIPAL=Config("jt_kerberos_principal", help="Kerberos principal for JobTracker",
-                                   default="mapred", type=str),
-      SECURITY_ENABLED=Config("security_enabled", help="Is running with Kerberos authentication",
-                              default=False, type=coerce_bool),
-      SUBMIT_TO=Config('submit_to', help="Whether Hue should use this cluster to run jobs",
-                       default=True, type=coerce_bool), # True here for backward compatibility
+      PORT=Config(
+          "jobtracker_port",
+          default=8021,
+          help="Service port for the JobTracker",
+          type=int
+      ),
+      LOGICAL_NAME=Config(
+          'logical_name',
+          default="",
+          type=str,
+          help=_t('JobTracker logical name.')
+      ),
+      JT_THRIFT_PORT=Config(
+          "thrift_port",
+          help="Thrift port for JobTracker",
+          default=9290,
+          type=int
+      ),
+      JT_KERBEROS_PRINCIPAL=Config(
+          "jt_kerberos_principal",
+          help="Kerberos principal for JobTracker",
+          default="mapred",
+          type=str
+      ),
+      SECURITY_ENABLED=Config(
+          "security_enabled",
+          help="Is running with Kerberos authentication",
+          default=False,
+          type=coerce_bool
+      ),
+      SUBMIT_TO=Config(
+          'submit_to',
+          help="Whether Hue should use this cluster to run jobs",
+          default=True,
+          type=coerce_bool
+      ), # True here for backward compatibility
     )
   )
 )