eubnara commented on code in PR #4043:
URL: https://github.com/apache/ambari/pull/4043#discussion_r2247261663


##########
ambari-server/src/main/resources/stacks/BIGTOP/3.3.0/services/RANGER/package/scripts/setup_ranger_xml.py:
##########
@@ -465,24 +465,43 @@ def password_validation(password):
 def copy_jdbc_connector(ranger_home):
   import params
 
-  if params.jdbc_jar_name is None and 
params.driver_curl_source.endswith("/None"):
+  if params.jdbc_jar_name is None or 
params.driver_curl_source.endswith("/None"):
     error_message = format(
       "{db_flavor} jdbc driver cannot be downloaded from 
{jdk_location}\nPlease run 'ambari-server setup --jdbc-db={db_flavor} 
--jdbc-driver={{path_to_jdbc}}' on ambari-server host."
     )
     raise Fail(error_message)
 
-  if params.driver_curl_source and not 
params.driver_curl_source.endswith("/None"):
-    if params.previous_jdbc_jar and os.path.isfile(params.previous_jdbc_jar):
-      File(params.previous_jdbc_jar, action="delete")
+  ModifyPropertiesFile(
+    format("{ranger_home}/install.properties"),
+    properties=params.config["configurations"]["admin-properties"],
+    owner=params.unix_user,
+  )
+
+  if params.db_flavor.lower() == "sqla":
+    ModifyPropertiesFile(
+      format("{ranger_home}/install.properties"),
+      properties={"SQL_CONNECTOR_JAR": 
format("{ranger_home}/ews/lib/sajdbc4.jar")},
+      owner=params.unix_user,
+    )
+  else:
+    ModifyPropertiesFile(
+      format("{ranger_home}/install.properties"),
+      properties={"SQL_CONNECTOR_JAR": format("{driver_curl_target}")},
+      owner=params.unix_user,
+    )
+
+  if params.previous_jdbc_jar and os.path.isfile(params.previous_jdbc_jar):
+    if params.previous_jdbc_jar_name == params.jdbc_jar_name:
+      Logger.info(format("{params.previous_jdbc_jar} already exists. Skip to 
download it."))
+      return
+    File(params.previous_jdbc_jar, action="delete")
 
   File(
     params.downloaded_custom_connector,
     content=DownloadSource(params.driver_curl_source),
     mode=0o644,
   )
 
-  driver_curl_target = format("{ranger_home}/ews/lib/{jdbc_jar_name}")

Review Comment:
   It is already set at params.py.
   Remove it because it is unnecessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org
For additional commands, e-mail: dev-h...@ambari.apache.org

Reply via email to