move rsync and s3 options to configuration

This commit is contained in:
2021-03-30 02:38:18 +03:00
parent 7280d30748
commit bd2b61494f
5 changed files with 10 additions and 18 deletions

View File

@ -40,6 +40,7 @@ class Rsync(Upload):
"""
Upload.__init__(self, architecture, config)
section = config.get_section_name("rsync", architecture)
self.command = config.getlist(section, "command")
self.remote = config.get(section, "remote")
def sync(self, path: Path) -> None:
@ -47,14 +48,4 @@ class Rsync(Upload):
sync data to remote server
:param path: local path to sync
"""
Rsync._check_output(
"rsync",
"--archive",
"--verbose",
"--compress",
"--partial",
"--delete",
str(path),
self.remote,
exception=None,
logger=self.logger)
Rsync._check_output(*self.command, str(path), self.remote, exception=None, logger=self.logger)

View File

@ -41,6 +41,7 @@ class S3(Upload):
Upload.__init__(self, architecture, config)
section = config.get_section_name("s3", architecture)
self.bucket = config.get(section, "bucket")
self.command = config.getlist(section, "command")
def sync(self, path: Path) -> None:
"""
@ -48,6 +49,4 @@ class S3(Upload):
:param path: local path to sync
"""
# TODO rewrite to boto, but it is bullshit
S3._check_output("aws", "s3", "sync", "--quiet", "--delete", str(path), self.bucket,
exception=None,
logger=self.logger)
S3._check_output(*self.command, str(path), self.bucket, exception=None, logger=self.logger)