taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
703 stars 87 forks source link

Claim ownership error - UnboundLocalError: 'changeParents' referenced before assignment #283

Closed FluXs closed 2 years ago

FluXs commented 2 years ago

Hi there, I am using the claim ownership command on the root of a user's personal drive to change ownership of any items created by other users within the same workspace (that are located in this user's personal drive).

The reason for this is to simplify file ownership in personal drives as part of a larger project to transfer all data to another workspace

This is the command I started with:

gam user mark@example.com claim ownership mydrive

However, I get this error unexpected error:

Traceback (most recent call last):
  File "__init__.py", line 63290, in ProcessGAMCommand
  File "__init__.py", line 51634, in claimOwnership
UnboundLocalError: local variable 'changeParents' referenced before assignment

I think the changeparents variable was introduced in the v6.24.08 update which added this:

Added option [<DriveFileParentAttribute>] to gam <UserTypeEntity> claim ownership <DriveFileEntity> 
By default, claim ownership does not change the parents of <DriveFileEntity>; this options allows
specification of a parent folder in the My Drive of the claiming user <UserTypeEntity>

I managed to find a workaround by referencing a folder within the user's personal drive e.g. "test folder" (however not really scaleable for all users):

gam user mark@example.com claim ownership mydrive parentname "Test folder"

The command now successfully runs and claims ownership of any file/folder starting at the root of their drive as I wanted.

Hope this is helpful and thank you for the tool, its amazing. I am using the latest version GAM 6.24.19 on Windows

Thank you

taers232c commented 2 years ago

Should be fixed in 6.24.20