mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 07:17:17 +00:00
move rsync and s3 options to configuration
This commit is contained in:
parent
a875225b78
commit
8d7d508bb2
@ -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`.
|
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.
|
* `remote` - remote server to rsync (e.g. `1.2.3.4:5678:path/to/sync`), string, required.
|
||||||
|
|
||||||
### `s3_*` groups
|
### `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`.
|
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.
|
* `bucket` - bucket name (e.g. `s3://bucket/path`), string, required.
|
||||||
|
|
||||||
## `web_*` groups
|
## `web_*` groups
|
||||||
|
@ -21,7 +21,6 @@ root = /var/lib/ahriman
|
|||||||
|
|
||||||
[sign]
|
[sign]
|
||||||
target =
|
target =
|
||||||
key =
|
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
target =
|
target =
|
||||||
@ -36,10 +35,10 @@ template_path = /usr/share/ahriman/repo-index.jinja2
|
|||||||
target =
|
target =
|
||||||
|
|
||||||
[rsync]
|
[rsync]
|
||||||
remote =
|
command = rsync --archive --verbose --compress --partial --delete
|
||||||
|
|
||||||
[s3]
|
[s3]
|
||||||
bucket =
|
command = aws s3 sync --quiet --delete
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
templates = /usr/share/ahriman
|
templates = /usr/share/ahriman
|
@ -40,6 +40,7 @@ class Rsync(Upload):
|
|||||||
"""
|
"""
|
||||||
Upload.__init__(self, architecture, config)
|
Upload.__init__(self, architecture, config)
|
||||||
section = config.get_section_name("rsync", architecture)
|
section = config.get_section_name("rsync", architecture)
|
||||||
|
self.command = config.getlist(section, "command")
|
||||||
self.remote = config.get(section, "remote")
|
self.remote = config.get(section, "remote")
|
||||||
|
|
||||||
def sync(self, path: Path) -> None:
|
def sync(self, path: Path) -> None:
|
||||||
@ -47,14 +48,4 @@ class Rsync(Upload):
|
|||||||
sync data to remote server
|
sync data to remote server
|
||||||
:param path: local path to sync
|
:param path: local path to sync
|
||||||
"""
|
"""
|
||||||
Rsync._check_output(
|
Rsync._check_output(*self.command, str(path), self.remote, exception=None, logger=self.logger)
|
||||||
"rsync",
|
|
||||||
"--archive",
|
|
||||||
"--verbose",
|
|
||||||
"--compress",
|
|
||||||
"--partial",
|
|
||||||
"--delete",
|
|
||||||
str(path),
|
|
||||||
self.remote,
|
|
||||||
exception=None,
|
|
||||||
logger=self.logger)
|
|
||||||
|
@ -41,6 +41,7 @@ class S3(Upload):
|
|||||||
Upload.__init__(self, architecture, config)
|
Upload.__init__(self, architecture, config)
|
||||||
section = config.get_section_name("s3", architecture)
|
section = config.get_section_name("s3", architecture)
|
||||||
self.bucket = config.get(section, "bucket")
|
self.bucket = config.get(section, "bucket")
|
||||||
|
self.command = config.getlist(section, "command")
|
||||||
|
|
||||||
def sync(self, path: Path) -> None:
|
def sync(self, path: Path) -> None:
|
||||||
"""
|
"""
|
||||||
@ -48,6 +49,4 @@ class S3(Upload):
|
|||||||
:param path: local path to sync
|
:param path: local path to sync
|
||||||
"""
|
"""
|
||||||
# TODO rewrite to boto, but it is bullshit
|
# TODO rewrite to boto, but it is bullshit
|
||||||
S3._check_output("aws", "s3", "sync", "--quiet", "--delete", str(path), self.bucket,
|
S3._check_output(*self.command, str(path), self.bucket, exception=None, logger=self.logger)
|
||||||
exception=None,
|
|
||||||
logger=self.logger)
|
|
||||||
|
@ -21,7 +21,6 @@ root = /var/lib/ahriman
|
|||||||
|
|
||||||
[sign]
|
[sign]
|
||||||
target =
|
target =
|
||||||
key =
|
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
target =
|
target =
|
||||||
@ -36,10 +35,12 @@ template_path = ../web/templates/repo-index.jinja2
|
|||||||
target =
|
target =
|
||||||
|
|
||||||
[rsync]
|
[rsync]
|
||||||
|
command = rsync --archive --verbose --compress --partial --delete
|
||||||
remote =
|
remote =
|
||||||
|
|
||||||
[s3]
|
[s3]
|
||||||
bucket =
|
bucket =
|
||||||
|
command = aws s3 sync --quiet --delete
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
templates = ../web/templates
|
templates = ../web/templates
|
Loading…
Reference in New Issue
Block a user