From 12692193d5f05d7d55b82d2a536313e8f452cfcd Mon Sep 17 00:00:00 2001 From: Michael Reichenbach Date: Mon, 8 Mar 2021 14:57:01 +0100 Subject: [PATCH] fix: create directory if not exists --- src/restic_compose_backup/containers_db.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/restic_compose_backup/containers_db.py b/src/restic_compose_backup/containers_db.py index 1dae436..7344f68 100644 --- a/src/restic_compose_backup/containers_db.py +++ b/src/restic_compose_backup/containers_db.py @@ -55,12 +55,18 @@ class MariadbContainer(Container): def backup(self): config = Config() + destination = self.backup_destination_path() + commands.run([ + "mkdir", + "-p", + f"{destination}" + ]) commands.run(self.dump_command()) return restic.backup_files( config.repository, - self.backup_destination_path(), + destination, tags=self.tags ) @@ -124,12 +130,18 @@ class MysqlContainer(Container): def backup(self): config = Config() + destination = self.backup_destination_path() + commands.run([ + "mkdir", + "-p", + f"{destination}" + ]) commands.run(self.dump_command()) return restic.backup_files( config.repository, - self.backup_destination_path(), + destination, tags=self.tags )