Browse Source

HUE-8281 [spark] Can not connect to Livy Server with HTTPS (#688)

* Fix confusing variable name

* HUE-8281 [spark] Can not connect to Livy Server with HTTPS

* HUE-8281 Mark LIVY_SERVER_HOST and LIVY_SERVER_PORT as deprecated
Ivan Dzikovsky 7 years ago
parent
commit
ff52745da6

+ 12 - 1
apps/spark/src/spark/conf.py

@@ -29,11 +29,18 @@ LOG = logging.getLogger(__name__)
 
 
 # Livy
+LIVY_SERVER_URL = Config(
+  key="livy_server_url",
+  help=_t("The Livy Server URL."),
+  default="")
+
+# Deprecated
 LIVY_SERVER_HOST = Config(
   key="livy_server_host",
   help=_t("Host address of the Livy Server."),
   default="localhost")
 
+# Deprecated
 LIVY_SERVER_PORT = Config(
   key="livy_server_port",
   help=_t("Port of the Livy Server."),
@@ -64,7 +71,11 @@ SQL_SERVER_PORT = Config(
 
 
 def get_livy_server_url():
-  return 'http://%s:%s' % (LIVY_SERVER_HOST.get(), LIVY_SERVER_PORT.get())
+  url = LIVY_SERVER_URL.get()
+  if not url:
+    # backward compatibility
+    url = 'http://%s:%s' % (LIVY_SERVER_HOST.get(), LIVY_SERVER_PORT.get())
+  return url
 
 def get_spark_status(user):
   from spark.job_server_api import get_api

+ 2 - 2
apps/spark/src/spark/job_server_api.py

@@ -53,8 +53,8 @@ def get_api(user):
 
 class JobServerApi(object):
 
-  def __init__(self, oozie_url):
-    self._url = posixpath.join(oozie_url)
+  def __init__(self, livy_url):
+    self._url = posixpath.join(livy_url)
     self._client = HttpClient(self._url, logger=LOG)
     self._root = Resource(self._client)
     self._security_enabled = SECURITY_ENABLED.get()

+ 2 - 5
desktop/conf.dist/hue.ini

@@ -1130,11 +1130,8 @@
 ###########################################################################
 
 [spark]
-  # Host address of the Livy Server.
-  ## livy_server_host=localhost
-
-  # Port of the Livy Server.
-  ## livy_server_port=8998
+  # The Livy Server URL.
+  ## livy_server_url=http://localhost:8998
 
   # Configure Livy to start in local 'process' mode, or 'yarn' workers.
   ## livy_server_session_kind=yarn

+ 2 - 5
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1132,11 +1132,8 @@
 ###########################################################################
 
 [spark]
-  # Host address of the Livy Server.
-  ## livy_server_host=localhost
-
-  # Port of the Livy Server.
-  ## livy_server_port=8998
+  # The Livy Server URL.
+  ## livy_server_url=http://localhost:8998
 
   # Configure Livy to start in local 'process' mode, or 'yarn' workers.
   ## livy_server_session_kind=yarn