Skip to content

Commit cb9cfbb

Browse files
committed
fix(worker): Initialize backup sibling during configuration update if not configured
1 parent fa75f9a commit cb9cfbb

File tree

1 file changed

+13
-8
lines changed
  • services/datalad/datalad_service/common

1 file changed

+13
-8
lines changed

services/datalad/datalad_service/common/s3.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from botocore.config import Config
66

77
import datalad_service.config
8-
from datalad_service.common.annex import annex_initremote
8+
from datalad_service.common.annex import annex_initremote, is_git_annex_remote
99

1010

1111
class S3ConfigException(Exception):
@@ -135,13 +135,18 @@ def update_s3_sibling(dataset_path):
135135
check=True,
136136
cwd=dataset_path,
137137
)
138-
subprocess.run(
139-
['git-annex', 'enableremote', get_s3_backup_remote()]
140-
+ generate_s3_annex_options(dataset_path, backup=True),
141-
check=True,
142-
cwd=dataset_path,
143-
env=backup_remote_env(),
144-
)
138+
# Setup the backup remote if it doesn't exist yet
139+
if not is_git_annex_remote(dataset_path, get_s3_backup_remote()):
140+
setup_s3_backup_sibling_workaround(dataset_path)
141+
else:
142+
# Update the backup remote config
143+
subprocess.run(
144+
['git-annex', 'enableremote', get_s3_backup_remote()]
145+
+ generate_s3_annex_options(dataset_path, backup=True),
146+
check=True,
147+
cwd=dataset_path,
148+
env=backup_remote_env(),
149+
)
145150

146151

147152
def validate_s3_config(dataset_path):

0 commit comments

Comments
 (0)