浏览代码

HUE-3958 [core] Allow Oracle database config to use service name configuration by setting host and port to empty

Jenny Kim 9 年之前
父节点
当前提交
18cec50
共有 3 个文件被更改,包括 10 次插入8 次删除
  1. 1 1
      desktop/conf.dist/hue.ini
  2. 1 1
      desktop/conf/pseudo-distributed.ini.tmpl
  3. 8 6
      desktop/core/src/desktop/conf.py

+ 1 - 1
desktop/conf.dist/hue.ini

@@ -478,7 +478,7 @@
     #
     # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
-    # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
+    # Note for Oracle, you can use the Oracle Service Name by setting "host=" and "port=" and then "name=<host>:<port>/<service_name>".
     # Note for MariaDB use the 'mysql' engine.
     ## engine=sqlite3
     ## host=

+ 1 - 1
desktop/conf/pseudo-distributed.ini.tmpl

@@ -482,7 +482,7 @@
     #
     # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name.
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
-    # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
+    # Note for Oracle, you can use the Oracle Service Name by setting "host=" and "port=" and then "name=<host>:<port>/<service_name>".
     # Note for MariaDB use the 'mysql' engine.
     ## engine=sqlite3
     ## host=

+ 8 - 6
desktop/core/src/desktop/conf.py

@@ -46,11 +46,13 @@ def coerce_database(database):
 
 
 def coerce_port(port):
-  port = int(port)
-  if port == 0:
-    return ''
-  else:
-    return port
+  try:
+    port = int(port)
+    if port == 0:
+      port = ''
+  except ValueError, e:
+    port = ''
+  return port
 
 
 def coerce_file(path):
@@ -505,7 +507,7 @@ DATABASE = ConfigSection(
       key='port',
       help=_('Database port.'),
       type=coerce_port,
-      default='0',
+      default='',
     ),
     OPTIONS=Config(
       key='options',