Skip to content

Commit

Permalink
Throwing ManyError on migrate-groups tasks (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
william-conti authored and FastLee committed Jan 18, 2024
1 parent 1a2711b commit c41917d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/databricks/labs/ucx/workspace_access/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ def delete_original_workspace_groups(self):
tasks.append(functools.partial(self._delete_workspace_group, mg.id_in_workspace, mg.temporary_name))
_, errors = Threads.gather("removing original workspace groups", tasks)
if len(errors) > 0:
msg = f"During account-to-workspace reflection got {len(errors)} errors. See debug logs"
raise RuntimeWarning(msg)
logger.error(f"During account-to-workspace reflection got {len(errors)} errors. See debug logs")
raise ManyError(errors)

def _fetcher(self) -> Iterable[MigratedGroup]:
for row in self._backend.fetch(f"SELECT * FROM {self._full_name}"):
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/workspace_access/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def apply_group_permissions(self, migration_state: MigrationState):
if len(errors) > 0:
# TODO: https://github.com/databrickslabs/ucx/issues/406
logger.error(f"Detected {len(errors)} while applying permissions")
return False
raise ManyError(errors)
logger.info("Permissions were applied")
return True

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/workspace_access/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def test_delete_original_workspace_groups_should_fail_if_delete_does_not_work():
wsclient.groups.delete.side_effect = RuntimeError("Something bad")
gm = GroupManager(backend, wsclient, inventory_database="inv")

with pytest.raises(RuntimeWarning):
with pytest.raises(ManyError):
gm.delete_original_workspace_groups()


Expand Down

0 comments on commit c41917d

Please sign in to comment.