Skip to content

Commit

Permalink
Added test on mount crawl.
Browse files Browse the repository at this point in the history
  • Loading branch information
FastLee committed Oct 10, 2024
1 parent 5b86cab commit 1569413
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/databricks/labs/ucx/hive_metastore/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from functools import cached_property
from typing import ClassVar, Optional
from urllib.parse import urlparse
from py4j.protocol import Py4JError

from databricks.labs.blueprint.installation import Installation
from databricks.labs.lsql import Row
Expand Down Expand Up @@ -320,8 +321,15 @@ def _deduplicate_mounts(mounts: list) -> list:

def _crawl(self) -> Iterable[Mount]:
mounts = []
for mount_point, source, _ in self._dbutils.fs.mounts():
mounts.append(Mount(mount_point, source))
try:
for mount_point, source, _ in self._dbutils.fs.mounts():
mounts.append(Mount(mount_point, source))
except Py4JError as error:
if "com.databricks.backend.daemon.dbutils.DBUtilsCore.mounts() is not whitelisted" in str(error):
logger.warning(
"dbutils.fs.mounts() is not whitelisted. Skipping mount point discovery."
"Please make sure you run the assessment workflow."
)
return self._deduplicate_mounts(mounts)

def _try_fetch(self) -> Iterable[Mount]:
Expand Down

0 comments on commit 1569413

Please sign in to comment.