Skip to content

Commit 22b3651

Browse files
authored
Log message as error when legacy permissions API is enabled/disabled depending on the workflow ran (#3443)
## Changes Log message as error when legacy permissions API is enabled/disabled depending on the workflow ranso that the workflow fails, signaling to the user to take action ### Linked issues Resolves #3388 ### Functionality - [x] modified existing workflow: `migrate-groups-legacy`, `migrate-groups`, `validate-groups-permissions` and `remove-workspace-local-backup-groups`
1 parent e5d5429 commit 22b3651

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def verify_metastore_attached(self, ctx: RuntimeContext):
1818
Account level groups are only available when a metastore is attached to the workspace.
1919
"""
2020
if not ctx.config.use_legacy_permission_migration:
21-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
21+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
2222
return
2323
ctx.verify_has_metastore.verify_metastore()
2424

2525
@job_task(depends_on=[Assessment.crawl_groups, verify_metastore_attached])
2626
def rename_workspace_local_groups(self, ctx: RuntimeContext):
2727
"""Renames workspace local groups by adding `db-temp-` prefix."""
2828
if not ctx.config.use_legacy_permission_migration:
29-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
29+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
3030
return
3131
ctx.group_manager.rename_groups()
3232

@@ -35,7 +35,7 @@ def reflect_account_groups_on_workspace(self, ctx: RuntimeContext):
3535
"""Adds matching account groups to this workspace. The matching account level group(s) must preexist(s) for this
3636
step to be successful. This process does not create the account level group(s)."""
3737
if not ctx.config.use_legacy_permission_migration:
38-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
38+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
3939
return
4040
ctx.group_manager.reflect_account_groups_on_workspace()
4141

@@ -56,7 +56,7 @@ def apply_permissions_to_account_groups(self, ctx: RuntimeContext):
5656
5757
See [interactive tutorial here](https://app.getreprise.com/launch/myM3VNn/)."""
5858
if not ctx.config.use_legacy_permission_migration:
59-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
59+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
6060
return
6161
migration_state = ctx.group_manager.get_migration_state()
6262
if len(migration_state.groups) == 0:
@@ -68,7 +68,7 @@ def apply_permissions_to_account_groups(self, ctx: RuntimeContext):
6868
def validate_groups_permissions(self, ctx: RuntimeContext):
6969
"""Validate that all the crawled permissions are applied correctly to the destination groups."""
7070
if not ctx.config.use_legacy_permission_migration:
71-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
71+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
7272
return
7373
if not ctx.permission_manager.verify_group_permissions():
7474
raise ValueError(
@@ -89,15 +89,15 @@ def verify_metastore_attached(self, ctx: RuntimeContext):
8989
Account level groups are only available when a metastore is attached to the workspace.
9090
"""
9191
if ctx.config.use_legacy_permission_migration:
92-
logger.info("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
92+
logger.error("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
9393
return
9494
ctx.verify_has_metastore.verify_metastore()
9595

9696
@job_task(depends_on=[Assessment.crawl_groups, verify_metastore_attached])
9797
def rename_workspace_local_groups(self, ctx: RuntimeContext):
9898
"""Renames workspace local groups by adding `db-temp-` prefix."""
9999
if ctx.config.use_legacy_permission_migration:
100-
logger.info("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
100+
logger.error("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
101101
return
102102
ctx.group_manager.rename_groups()
103103

@@ -106,7 +106,7 @@ def reflect_account_groups_on_workspace(self, ctx: RuntimeContext):
106106
"""Adds matching account groups to this workspace. The matching account level group(s) must preexist(s) for this
107107
step to be successful. This process does not create the account level group(s)."""
108108
if ctx.config.use_legacy_permission_migration:
109-
logger.info("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
109+
logger.error("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
110110
return
111111
ctx.group_manager.reflect_account_groups_on_workspace()
112112

@@ -130,7 +130,7 @@ def apply_permissions(self, ctx: RuntimeContext):
130130
131131
It covers local workspace-local permissions for all entities."""
132132
if ctx.config.use_legacy_permission_migration:
133-
logger.info("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
133+
logger.error("Remove `use_legacy_permission_migration: true` from config.yml to run this workflow.")
134134
return
135135
migration_state = ctx.group_manager.get_migration_state()
136136
if len(migration_state.groups) == 0:
@@ -150,7 +150,7 @@ def __init__(self):
150150
def validate_groups_permissions(self, ctx: RuntimeContext):
151151
"""Validate that all the crawled permissions are applied correctly to the destination groups."""
152152
if not ctx.config.use_legacy_permission_migration:
153-
logger.info("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
153+
logger.error("Use `migrate-groups` job, or set `use_legacy_permission_migration: true` in config.yml.")
154154
return
155155
if not ctx.permission_manager.verify_group_permissions():
156156
raise ValueError(

0 commit comments

Comments
 (0)