Skip to content

Commit a64e16e

Browse files
Throwing ManyError on migrate-groups tasks (#710)
1 parent 06a3539 commit a64e16e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/databricks/labs/ucx/workspace_access/groups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ def delete_original_workspace_groups(self):
391391
tasks.append(functools.partial(self._delete_workspace_group, mg.id_in_workspace, mg.temporary_name))
392392
_, errors = Threads.gather("removing original workspace groups", tasks)
393393
if len(errors) > 0:
394-
msg = f"During account-to-workspace reflection got {len(errors)} errors. See debug logs"
395-
raise RuntimeWarning(msg)
394+
logger.error(f"During account-to-workspace reflection got {len(errors)} errors. See debug logs")
395+
raise ManyError(errors)
396396

397397
def _fetcher(self) -> Iterable[MigratedGroup]:
398398
for row in self._backend.fetch(f"SELECT * FROM {self._full_name}"):

src/databricks/labs/ucx/workspace_access/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def apply_group_permissions(self, migration_state: MigrationState):
134134
if len(errors) > 0:
135135
# TODO: https://github.com/databrickslabs/ucx/issues/406
136136
logger.error(f"Detected {len(errors)} while applying permissions")
137-
return False
137+
raise ManyError(errors)
138138
logger.info("Permissions were applied")
139139
return True
140140

tests/unit/workspace_access/test_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def test_delete_original_workspace_groups_should_fail_if_delete_does_not_work():
449449
wsclient.groups.delete.side_effect = RuntimeError("Something bad")
450450
gm = GroupManager(backend, wsclient, inventory_database="inv")
451451

452-
with pytest.raises(RuntimeWarning):
452+
with pytest.raises(ManyError):
453453
gm.delete_original_workspace_groups()
454454

455455

0 commit comments

Comments
 (0)