Skip to content

Commit

Permalink
Fixed missing group entitlement migration bug (#583)
Browse files Browse the repository at this point in the history
Iterator from `self._get_groups()` consumed in the first list
comprehension, leaving nothing for the second pass.

Closes #540
  • Loading branch information
nfx authored Nov 16, 2023
1 parent 24d55ed commit 43e8e38
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/databricks/labs/ucx/workspace_access/scim.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ def _is_item_relevant(item: Permissions, migration_state: GroupMigrationState) -
return migration_state.is_id_in_scope(item.object_id)

def get_crawler_tasks(self):
groups = self._get_groups()
with_roles = [g for g in groups if g.roles and len(g.roles) > 0]
with_entitlements = [g for g in groups if g.entitlements and len(g.entitlements) > 0]
for g in with_roles:
yield partial(self._crawler_task, g, "roles")
for g in with_entitlements:
yield partial(self._crawler_task, g, "entitlements")
for g in self._get_groups():
if g.roles and len(g.roles) > 0:
yield partial(self._crawler_task, g, "roles")
if g.entitlements and len(g.entitlements) > 0:
yield partial(self._crawler_task, g, "entitlements")

# TODO remove after ES-892977 is fixed
@retried(on=[DatabricksError])
Expand Down

0 comments on commit 43e8e38

Please sign in to comment.