Fix swapped volume/bind variables in Journald volume support (#2764)

This commit is contained in:
Franck Nijhof 2021-03-29 09:46:22 +02:00 committed by GitHub
parent 2be1529cb8
commit 65386b753f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -418,14 +418,14 @@ class DockerAddon(DockerInterface):
# System Journal access
if self.addon.with_journald:
# Systemd uses volatile by default, unless persistent location exists.
bind = SYSTEMD_JOURNAL_VOLATILE
journal = SYSTEMD_JOURNAL_VOLATILE
if SYSTEMD_JOURNAL_PERSISTENT.exists():
bind = SYSTEMD_JOURNAL_PERSISTENT
journal = SYSTEMD_JOURNAL_PERSISTENT
volumes.update(
{
str(SYSTEMD_JOURNAL_PERSISTENT): {
"bind": str(bind),
str(journal): {
"bind": str(SYSTEMD_JOURNAL_PERSISTENT),
"mode": "ro",
}
}

View File

@ -105,11 +105,11 @@ def test_journald_addon_volatile(coresys: CoreSys, addonsdata_system: Dict[str,
)
volumes = docker_addon.volumes
assert str(SYSTEMD_JOURNAL_PERSISTENT) in volumes
assert volumes.get(str(SYSTEMD_JOURNAL_PERSISTENT)).get("bind") == str(
SYSTEMD_JOURNAL_VOLATILE
assert str(SYSTEMD_JOURNAL_VOLATILE) in volumes
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("bind") == str(
SYSTEMD_JOURNAL_PERSISTENT
)
assert volumes.get(str(SYSTEMD_JOURNAL_PERSISTENT)).get("mode") == "ro"
assert volumes.get(str(SYSTEMD_JOURNAL_VOLATILE)).get("mode") == "ro"
def test_journald_addon_persistent(