Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(worker): Allow indexing URLs from a whitelist of S3 buckets #3138

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions services/datalad/datalad_service/common/annex.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

SERVICE_EMAIL = '[email protected]'
SERVICE_USER = 'Git Worker'
S3_BUCKETS_WHITELIST = ['openneuro.org', 'openneuro-dev-datalad-public', 'bobsrepository']


def init_annex(dataset_path):
Expand Down Expand Up @@ -86,11 +87,10 @@ def compute_rmet(key, legacy=False):
return f'{keyHash[0:3]}/{keyHash[3:6]}/{key}.log.rmet'


def parse_remote_line(remoteLine,
preferredRemote='s3-PUBLIC'):
def parse_remote_line(remoteLine):
remoteConfig = dict(item.split('=')
for item in remoteLine[37:].split(' '))
if remoteConfig['name'] == preferredRemote:
if remoteConfig['type'] == 'S3' and remoteConfig['bucket'] in S3_BUCKETS_WHITELIST:
remoteUuid = remoteLine[0:36]
remoteUrl = remoteConfig['publicurl'] if 'publicurl' in remoteConfig else None
return {'uuid': remoteUuid, 'url': remoteUrl}
Expand Down
Loading