diff --git a/CONFIGURING.md b/CONFIGURING.md index 09fb5ccf..56d1bcd0 100644 --- a/CONFIGURING.md +++ b/CONFIGURING.md @@ -68,12 +68,14 @@ Remote synchronization settings. Group name must refer to architecture, e.g. it should be `rsync_x86_64` for x86_64 architecture. Requires `rsync` package to be installed. Do not forget to configure ssh for user `ahriman`. +* `command` - rsync command to run, space separated list of string, required. * `remote` - remote server to rsync (e.g. `1.2.3.4:5678:path/to/sync`), string, required. ### `s3_*` groups Group name must refer to architecture, e.g. it should be `s3_x86_64` for x86_64 architecture. Requires `aws-cli` package to be installed. Do not forget to configure it for user `ahriman`. +* `command` - s3 command to run, space separated list of string, required. * `bucket` - bucket name (e.g. `s3://bucket/path`), string, required. ## `web_*` groups diff --git a/package/etc/ahriman.ini b/package/etc/ahriman.ini index bb31ce99..042b9edf 100644 --- a/package/etc/ahriman.ini +++ b/package/etc/ahriman.ini @@ -21,7 +21,6 @@ root = /var/lib/ahriman [sign] target = -key = [report] target = @@ -36,10 +35,10 @@ template_path = /usr/share/ahriman/repo-index.jinja2 target = [rsync] -remote = +command = rsync --archive --verbose --compress --partial --delete [s3] -bucket = +command = aws s3 sync --quiet --delete [web] templates = /usr/share/ahriman \ No newline at end of file diff --git a/src/ahriman/core/upload/rsync.py b/src/ahriman/core/upload/rsync.py index 93eeafaf..64e15009 100644 --- a/src/ahriman/core/upload/rsync.py +++ b/src/ahriman/core/upload/rsync.py @@ -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) diff --git a/src/ahriman/core/upload/s3.py b/src/ahriman/core/upload/s3.py index 392cf421..98a3c577 100644 --- a/src/ahriman/core/upload/s3.py +++ b/src/ahriman/core/upload/s3.py @@ -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) diff --git a/tests/testresources/core/ahriman.ini b/tests/testresources/core/ahriman.ini index e7faa097..c8efca23 100644 --- a/tests/testresources/core/ahriman.ini +++ b/tests/testresources/core/ahriman.ini @@ -21,7 +21,6 @@ root = /var/lib/ahriman [sign] target = -key = [report] target = @@ -36,10 +35,12 @@ template_path = ../web/templates/repo-index.jinja2 target = [rsync] +command = rsync --archive --verbose --compress --partial --delete remote = [s3] bucket = +command = aws s3 sync --quiet --delete [web] templates = ../web/templates \ No newline at end of file