Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit c4814f0e authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Add creation date to drive sifter output

parent cefd9ed8
......@@ -73,6 +73,7 @@ class Sifter:
'id',
'alternateLink',
'mimeType',
'createddate',
'anyowner',
'owners',
'query',
......@@ -100,9 +101,9 @@ class Sifter:
'name': child['title'],
'id': child['id'],
'link': child['alternateLink'],
'parent': '\\'.join(self.parent)
'parent': '\\'.join(self.parent),
'created': child['createdDate']
}
_title = child['title'].lower()
if in_private or _title in self.omit_folders:
self.private_files[child['id']] = data
......@@ -133,6 +134,7 @@ class Sifter:
'filelist',
'name',
'id',
'createddate',
'owners',
'alternateLink'
], stderr=devnull
......@@ -146,7 +148,8 @@ class Sifter:
'owner': item['owners.0.emailAddress'],
'name': item['title'],
'id': item['id'],
'link': item['alternateLink']
'link': item['alternateLink'],
'created': item['createdDate']
}
except CalledProcessError as e:
self.logger.error(e.output, extra={'entity': self.account})
......@@ -162,6 +165,7 @@ class Sifter:
'name',
'id',
'mimetype',
'createddate',
'alternateLink',
'anyowner',
'owners',
......@@ -177,7 +181,8 @@ class Sifter:
'owner': item['owners.0.emailAddress'],
'name': item['title'],
'id': item['id'],
'link': item['alternateLink']
'link': item['alternateLink'],
'created': item['createdDate']
}
except CalledProcessError as e:
self.logger.error(e.output, extra={'entity': self.account})
......@@ -191,7 +196,7 @@ class Sifter:
if len(self.transfer_files) > 0:
target = '{}/transfer_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent']
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for item in self.transfer_files:
......@@ -201,7 +206,7 @@ class Sifter:
if len(self.private_files) > 0:
target = '{}/private_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent']
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for item in self.private_files:
......@@ -211,7 +216,7 @@ class Sifter:
if len(self.unknown_files) > 0:
target = '{}/unknown_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link', 'parent']
fieldnames = ['owner', 'name', 'id', 'link', 'parent', 'created'] # NOQA 501
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for item in self.unknown_files:
......@@ -221,7 +226,7 @@ class Sifter:
if len(self.shared_files) > 0:
target = '{}/shared_files.csv'.format(self.log_path)
with open(target, 'w+') as csvfile:
fieldnames = ['owner', 'name', 'id', 'link']
fieldnames = ['owner', 'name', 'id', 'link', 'created']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for item in self.shared_files:
......
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user1@domain.tld,transferfile_decended1.ppsx,8B6p2FkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,transferfile_decended2.dmg,9B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user1@domain.tld,transferfile_decended1.ppsx,8B6p2FkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,transferfile_decended2.dmg,9B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user1@domain.tld,Google Domain Reports,1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user1@domain.tld,Google Domain Reports,1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user1@domain.tld,unknownfile1.ppsx,10B6p2jkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,unknownfile2.dmg,11B6p23kiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user1@domain.tld,unknownfile1.ppsx,10B6p2jkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,unknownfile2.dmg,11B6p23kiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user1@domain.tld,privateFile1.ppsz,4B6p2FkiYp6vSSE1menV0M0J091k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,privateFile2.dmg,5B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user1@domain.tld,privateFile1.ppsz,4B6p2FkiYp6vSSE1menV0M0J091k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,privateFile2.dmg,5B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user1@domain.tld,transferfolder,1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,private,privatefolderid,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,transferfile1,2fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas,https://docs.google.com/spreadsheets/d/1fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas/edit?usp=drivesdk,application/vnd.google-apps.spreadsheet,,user1@domain.tld,True,Test User,10517881608702789413
user1@domain.tld,transferfile2,3fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas,https://docs.google.com/spreadsheets/d/1fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas/edit?usp=drivesdk,application/vnd.google-apps.spreadsheet,,user1@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user1@domain.tld,transferfolder,1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,private,privatefolderid,https://drive.google.com/drive/folders/1yBVyih1VJm9bQyJPigKXMMdtCr4rqGNZ,application/vnd.google-apps.folder,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,transferfile1,2fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas,https://docs.google.com/spreadsheets/d/1fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas/edit?usp=drivesdk,application/vnd.google-apps.spreadsheet,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user1@domain.tld,transferfile2,3fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas,https://docs.google.com/spreadsheets/d/1fU8drBRheUh_PJQkVPDFFZHjDpI_H8tdtKURmDecLas/edit?usp=drivesdk,application/vnd.google-apps.spreadsheet,,user1@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId
user2@domain.tld,sharedfile1.ico,6B6p2FkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user5@domain.tld,True,Test User,10517881608702789413
user2@domain.tld,sharedfile2.dmg,7B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user2@domain.tld,True,Test User,10517881608702789413
Owner,title,id,alternateLink,mimeType,owners,owners.0.emailAddress,owners.0.isAuthenticatedUser,owners.0.displayName,owners.0.permissionId,createdDate
user2@domain.tld,sharedfile1.ico,6B6p2FkiYp6vSSE1menV0M0JHb1k,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSSE1menV0M0JHb1k/view?usp=drivesdk,application/vnd.openxmlformats-officedocument.presentationml.slideshow,,user5@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
user2@domain.tld,sharedfile2.dmg,7B6p2FkiYp6vSLWRVVjlJd29mMU0,https://drive.google.com/a/domain.tld/file/d/0B6p2FkiYp6vSLWRVVjlJd29mMU0/view?usp=drivesdk,application/x-diskcopy,,user2@domain.tld,True,Test User,10517881608702789413,2015-07-10T20:23:06.540Z
......@@ -92,16 +92,13 @@ resourceEmail: {}@resource.calendar.google.com
# Show user files
if sys.argv[4] == 'filelist':
if len(sys.argv) >= 12:
if 'root' in sys.argv[12]:
if 'root' in sys.argv[13]:
print(get_testdata('show_filelist_root'))
elif 'privatefolderid' in sys.argv[12]:
elif 'privatefolderid' in sys.argv[13]:
print(get_testdata('show_filelist_privatefolderid'))
elif 'emptyfolder' in sys.argv[12]:
elif 'emptyfolder' in sys.argv[13]:
print(get_testdata('show_filelist_emptyfolder'))
elif 'sharedWithMe=True' in sys.argv[12]:
elif 'sharedWithMe=True' in sys.argv[13]:
print(get_testdata('show_filelist_sharedwithme'))
else:
print(get_testdata('show_filelist_child'))
......
......@@ -21,7 +21,7 @@ def test_sift(mock_login):
args = {
'account': 'user1',
'destination_account': 'testuser',
'root_folder_id': 'root'
'root_folder_id': 'root',
}
sifter = sift_drive.Sifter(
args,
......@@ -30,6 +30,7 @@ def test_sift(mock_login):
sifter.sift('root')
sifter.find_unorganized()
sifter.find_shared()
print(sifter.shared_files)
sifter.scrub_duplicates()
sifter.write_logfiles()
for logfile in expected_files:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment