Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group migration: change error logging format #2215

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/databricks/labs/ucx/workspace_access/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def _apply_to_groups(self, ws: WorkspaceClient, *, renamed: bool = False) -> boo
total_permissions += group_permissions
success_groups += 1
except IOError as e:
logger.exception(
f"Migration of group permissions failed: {name_in_workspace} (workspace) -> {name_in_account} (account)"
)
logger.error(f"failed-group-migration: {name_in_workspace} -> {name_in_account}: {e}")
errors.append(e)
logger.info(f"Migrated {total_permissions} permissions for {success_groups}/{len(self)} groups successfully.")
if errors:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/workspace_access/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ def test_migrate_permissions_continue_on_error(run_workflow, caplog) -> None:
assert len(raised_exception.errs) == 2
expected_exceptions = {"simulate group failure: immediately", "simulate group failure: midway"}
assert {str(e) for e in raised_exception.errs} == expected_exceptions
assert "Migration of group permissions failed: temp_1" in caplog.text
assert "Migration of group permissions failed: temp_2" in caplog.text
assert "failed-group-migration: temp_1 -> account_group_1: simulate group failure: immediately" in caplog.text
assert "failed-group-migration: temp_2 -> account_group_2: simulate group failure: midway" in caplog.text
assert "Migrated 50 permissions for 1/3 groups successfully." in caplog.messages
assert "Migrating permissions failed for 2/3 groups." in caplog.messages

Expand Down