mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-16 07:19:57 +00:00
move rsync and s3 options to configuration
This commit is contained in:
@ -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)
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user