ADPS-1406 Implement multiple servers in database connection Ranger#54
ADPS-1406 Implement multiple servers in database connection Ranger#54slavachy wants to merge 4 commits into
Conversation
| #db_host=host:port:SID # for DB_FLAVOR=ORACLE #for SID example: db_host=localhost:1521:ORCL | ||
| #db_host=host:port/ServiceName # for DB_FLAVOR=ORACLE #for Service example: db_host=localhost:1521/XE | ||
| #db_host=host:port:GL # for DB_FLAVOR=ORACLE #for TNSNAME example: db_host=localhost:1521:GL | ||
| #_host=host:port/ServiceName # for DB_FLAVOR=ORACLE #for Service example: db_host=localhost:1521/XE |
There was a problem hiding this comment.
thx, i copied it bad,fixed
| <include>setup.sh</include> | ||
| <include>setup_authentication.sh</include> | ||
| <include>set_globals.sh</include> | ||
| <include>pg_jdbc_util.py</include> |
There was a problem hiding this comment.
Inconsistent build. In kms.xml we have fileMode=544, but not there
There was a problem hiding this comment.
both packages already use 544. In admin-web.xml, pg_jdbc_util.py inherits <fileMode>544</fileMode> from the enclosing <fileSet> (same as db_setup.py and dba_script.py)
in kms.xml it is set explicitly to 544 as a standalone <file> entry
| from os.path import basename | ||
| from subprocess import Popen,PIPE | ||
| from datetime import date | ||
| from pg_jdbc_util import build_pg_query_params |
There was a problem hiding this comment.
Only build_pg_query_params is imported; the jisql JDBC URL is built using raw self.host directly, bypassing build_pg_host_segment. This function is actually used only in ranger_install.py. Either drop the unnecessary import from the 4 files where it's not used, or hook build_pg_host_segment into the jisql URL construction there too.
There was a problem hiding this comment.
only build_pg_query_params is imported in these 4 files- intentionally
In db_setup.py/dba_script.py the host field already contains the full host:port string (stored as-is in __init__), so build_pg_host_segment would add no value:
it would just hit the if ':' in host: return host branch and return unchanged. build_pg_host_segment is needed only in ranger_install.py where host and port arrive as separate config variables and must be joined
| from subprocess import Popen,PIPE | ||
|
|
||
| try: | ||
| sys.path.insert(0, os.getenv('RANGER_ADMIN_HOME', os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'scripts'))) |
There was a problem hiding this comment.
try/except ImportError fallback block duplicates the logic of build_pg_host_segment and build_pg_query_params
There was a problem hiding this comment.
fallback is intentional and follows the same pattern already used in this file for StringIO/ConfigParser
ranger_install.py lives in src/bin/, while pg_jdbc_util.py is in scripts/- they can be on different paths depending on the deployment layout
without the fallback, an ImportError would abort entire script for all DB flavors (MySQL, Oracle, MSSQL), not just Postgres
inline copies are kept minimal on purpose,full implementation is in pg_jdbc_util.py
| updatePropertyToFilePy(propertyName ,newPropertyValue ,to_file_ranger) | ||
|
|
||
| elif RANGER_DB_FLAVOR == "POSTGRES": | ||
| pg_admin_host = build_pg_host_segment(MYSQL_HOST, RANGER_ADMIN_DB_PORT) |
There was a problem hiding this comment.
MYSQL_HOST variable name in PG context is confusing
There was a problem hiding this comment.
MYSQL_HOST is a legacy variable used throughout the file for all DB
It was there before this PR
idk if this edit makes sense in this PR
No description provided.