Error when trying to clean up "share with domain"

48 views
Skip to first unread message

Kim Nilsson

unread,
Nov 21, 2020, 10:46:44 AM11/21/20
to GAM for Google Workspace
Turns out I had many incorrect shares to domain.
So I used the GetSharedWithDomain script, and then started the process of deleting the permissions.

gam config auto_batch_min 1 csv deleteperms.csv gam user "~Owner" delete drivefileacl "~driveFileId" "~permissionId"

That started 25 threads.
It ran for a very long time, and I'm not sure when it started to fail, as I wasn't watching it.

Traceback (most recent call last):
  File "/home/travis/python/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 302, in get_code
  File "/home/travis/python/lib/python3.8/site-packages/PyInstaller/loader/pyimod02_archive.py", line 325, in extract
zlib.error: Error -3 while decompressing data: incorrect header check

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "gam.py", line 48971, in ProcessGAMCommand
  File "gam.py", line 5509, in getEntityToModify
  File "gam.py", line 4357, in buildGAPIObject
  File "gam.py", line 3645, in getClientCredentials
  File "gam.py", line 3560, in getOauth2TxtCredentials
  File "/home/travis/python/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 473, in exec_module
  File "/home/travis/python/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 304, in get_code
ImportError: Loader FrozenImporter cannot handle module _strptime

Ross Scroggs

unread,
Nov 21, 2020, 11:58:54 AM11/21/20
to google-ap...@googlegroups.com
I'm not sure what going on here.
Drop the config auto_batch_min 1 as it's not required when you're doing gam csv.

gam csv deleteperms.csv gam user "~Owner" delete drivefileacl "~driveFileId" "~permissionId"


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/47c01a14-2679-4aea-8fb8-99ecdc91eba2n%40googlegroups.com.

Kim Nilsson

unread,
Nov 21, 2020, 12:01:57 PM11/21/20
to Google Apps Manager
Right.

I should probably redo the file list first, right? Since the delete permissions ran for a long time, watching failed delete commands would be wasteful, don't you think? 

Ross Scroggs

unread,
Nov 21, 2020, 12:31:42 PM11/21/20
to google-ap...@googlegroups.com
Yes. How many are left?
On Nov 21, 2020, at 9:01 AM, Kim Nilsson <there.is.no...@gmail.com> wrote:

Right.

I should probably redo the file list first, right? Since the delete permissions ran for a long time, watching failed delete commands would be wasteful, don't you think? 

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

Kim Nilsson

unread,
Nov 21, 2020, 1:57:37 PM11/21/20
to Google Apps Manager
Started the new file list just now. We'll see how many are left.

Kim Nilsson

unread,
Nov 24, 2020, 3:05:05 AM11/24/20
to Google Apps Manager
Old file had 40268 lines, new has only 12. :-)
And one is the header.

Kim Nilsson

unread,
Nov 24, 2020, 4:33:33 AM11/24/20
to Google Apps Manager
It of course completed in seconds, no issues.

/Kim

Kim Nilsson

unread,
Nov 24, 2020, 7:39:18 AM11/24/20
to Google Apps Manager
facepalm and slap on my own head

Just realised that I had run the script with ANY for AllowFileDiscovery, so I acted on way too many files... (maybe) correctly shared with link inside the domain, aaaand sent somewhat harsh emails to the users that had done new link-shares since just the other day.

Silly me for not immediately realising that the number of incorrect shares was much too high.

:-(

Well, well, caused me to create two guides on what correct and incorrect sharing looks like to the user.

Mike Beane

unread,
Nov 24, 2020, 7:53:46 AM11/24/20
to google-ap...@googlegroups.com
Oof!

I hadn't thought of this until your prior email and if I do this again on a large scale I am making notes to try it with this approach:

1) run the print filelist for the entire scope (files and folders) desired and store for reference
2) run the print filelist with for the entire scope, but for folders only: query "mimeType = 'application/vnd.google-apps.folder'"   (I tested on my student account, appears to have worked fine)
3) run the deleteperms routine
4) run the print filelist for the entire scope (files and folders) and reconcile with the reference (step 1).  What falls out s/b files that were directly shared (vs a folder share & inheritance), but hopefully a lot less items to deal with from an efficiency standpoint.  Repeat Step 3 if needed.

The realization is that when I did this over a month ago, I found a fair amount of items with the search and after looking at them for commonalities, I found that the majority (95%) of them were sourcing out of sub-folders that were beneath a folder of a departed employee.  I fixed one permission set and eliminated 95% of the issues because the files in the folders were corrected.  

Mostly untested theory and just connected a dot as  your "40268 lines" made me think of this.  YMMV




--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

Kim Nilsson

unread,
Nov 24, 2020, 8:30:45 AM11/24/20
to GAM for Google Workspace
Yeah, keeping the large filelist is a good idea, especially when you make mistakes, as you can fix it, if you want.
This time I chose not to fix anything.

I'd rather help out those few that notice that some of their files aren't linked to domain anymore.
Reply all
Reply to author
Forward
0 new messages