Extend backup_runner with additonal parameters

This commit is contained in:
Einar Forselv
2019-04-17 20:20:52 +02:00
parent 2913398564
commit dd091041b8
2 changed files with 14 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ import docker
from restic_volume_backup.config import Config
def run(image: str, command: str):
def run(image: str = None, command: str = None, volumes: dict = None, enviroment: dict = None):
config = Config()
client = docker.DockerClient(base_url=config.docker_base_url)
@@ -15,14 +15,8 @@ def run(image: str, command: str):
labels={"restic-volume-backup.backup_process": 'True'},
auto_remove=True,
detach=True,
environment={
'test1': 'value1',
'test2': 'value2',
},
volumes={
'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},
'/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'},
},
environment={},
volumes=volumes,
working_dir=os.getcwd(),
)