Skip to content

Commit

Permalink
Set catalog interface and api_url to none if Atlas and Navigator are …
Browse files Browse the repository at this point in the history
…not available (#2750)

Internal Jira: CDPD-24219
PR: 2750
  • Loading branch information
quadoss committed Mar 14, 2022
1 parent 70d6a89 commit 9123b75
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions desktop/libs/metadata/src/metadata/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ def default_catalog_config_dir():

def default_catalog_interface():
"""Detect if the configured catalog is Navigator or default to Atlas"""
return 'atlas' if atlas_flags.get_api_url() else 'navigator'
from metadata.metadata_sites import get_navigator_server_url
catalog_interface = ''
if atlas_flags.get_api_url():
catalog_interface = 'atlas'
elif get_navigator_server_url():
catalog_interface = 'navigator'
return catalog_interface

def default_navigator_config_dir():
"""Get from usual main Hue config directory"""
Expand All @@ -63,7 +69,7 @@ def default_navigator_config_dir():
def default_navigator_url():
"""Get from usual main Hue config directory"""
from metadata.metadata_sites import get_navigator_server_url
return get_navigator_server_url() + '/api'
return get_navigator_server_url() + '/api' if get_navigator_server_url() else None


def get_optimizer_url():
Expand Down
4 changes: 2 additions & 2 deletions desktop/libs/metadata/src/metadata/metadata_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_conf(name='navigator'):

def get_navigator_server_url():
"""Returns the navigator.server.url"""
return get_conf('navigator-lineage').get(_CONF_NAVIGATOR_SERVER_URL, 'http://localhost:7187')
return get_conf('navigator-lineage').get(_CONF_NAVIGATOR_SERVER_URL, None)


def get_navigator_audit_log_dir():
Expand All @@ -66,7 +66,7 @@ def _parse_sites():
from metadata.conf import NAVIGATOR

global _SITE_DICT
_SITE_DICT ={}
_SITE_DICT = {}

paths = [
('navigator', os.path.join(NAVIGATOR.CONF_DIR.get(), 'navigator.client.properties')), # 'audit'
Expand Down
2 changes: 1 addition & 1 deletion desktop/libs/metadata/src/metadata/metadata_sites_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_missing_navigator_site(self):
try:
metadata_sites.reset()

assert_equal(get_navigator_server_url(), 'http://localhost:7187')
assert_equal(get_navigator_server_url(), None)
finally:
metadata_sites.reset()
for reset in resets:
Expand Down

0 comments on commit 9123b75

Please sign in to comment.