mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-11 01:40:11 +01:00
deploy: rclone_config always as list to avoid code duplication
This commit is contained in:
parent
567e3dbaba
commit
5126a58af8
@ -299,8 +299,13 @@ def update_remote_storage_with_rclone(
|
|||||||
else:
|
else:
|
||||||
sources = [repo_section]
|
sources = [repo_section]
|
||||||
|
|
||||||
|
if isinstance(config['rclone_config'], str):
|
||||||
|
rclone_config = [config['rclone_config']]
|
||||||
|
else:
|
||||||
|
rclone_config = config['rclone_config']
|
||||||
|
|
||||||
for source in sources:
|
for source in sources:
|
||||||
if isinstance(config['rclone_config'], str):
|
for remote_config in rclone_config:
|
||||||
rclone_sync_command = (
|
rclone_sync_command = (
|
||||||
'rclone sync '
|
'rclone sync '
|
||||||
+ source
|
+ source
|
||||||
@ -333,40 +338,6 @@ def update_remote_storage_with_rclone(
|
|||||||
if subprocess.call(rclone_sync_command) != 0:
|
if subprocess.call(rclone_sync_command) != 0:
|
||||||
raise FDroidException()
|
raise FDroidException()
|
||||||
|
|
||||||
if isinstance(config['rclone_config'], list):
|
|
||||||
for remote_config in config['rclone_config']:
|
|
||||||
rclone_sync_command = (
|
|
||||||
'rclone sync '
|
|
||||||
+ source
|
|
||||||
+ ' '
|
|
||||||
+ remote_config
|
|
||||||
+ ':'
|
|
||||||
+ config['awsbucket']
|
|
||||||
+ '/'
|
|
||||||
+ upload_dir
|
|
||||||
)
|
|
||||||
|
|
||||||
rclone_sync_command = split(rclone_sync_command)
|
|
||||||
|
|
||||||
if verbose:
|
|
||||||
rclone_sync_command += ['--verbose']
|
|
||||||
elif quiet:
|
|
||||||
rclone_sync_command += ['--quiet']
|
|
||||||
|
|
||||||
if configfilename:
|
|
||||||
rclone_sync_command += split('--config=' + configfilename)
|
|
||||||
|
|
||||||
complete_remote_path = (
|
|
||||||
remote_config + ':' + config['awsbucket'] + '/' + upload_dir
|
|
||||||
)
|
|
||||||
|
|
||||||
logging.debug(
|
|
||||||
"rclone sync all files in " + source + ' to ' + complete_remote_path
|
|
||||||
)
|
|
||||||
|
|
||||||
if subprocess.call(rclone_sync_command) != 0:
|
|
||||||
raise FDroidException()
|
|
||||||
|
|
||||||
|
|
||||||
def update_awsbucket_libcloud(repo_section, is_index_only=False):
|
def update_awsbucket_libcloud(repo_section, is_index_only=False):
|
||||||
"""No summary.
|
"""No summary.
|
||||||
|
Loading…
Reference in New Issue
Block a user