From d819200b7e48aba6a6e5f21b3891e77b185c4e0c Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Wed, 17 Apr 2019 03:28:07 +0200 Subject: [PATCH] runner -> backup_runner --- restic_volume_backup/backup_runner.py | 27 +++++++++++++++++++++++++++ restic_volume_backup/runner.py | 25 ------------------------- 2 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 restic_volume_backup/backup_runner.py delete mode 100644 restic_volume_backup/runner.py diff --git a/restic_volume_backup/backup_runner.py b/restic_volume_backup/backup_runner.py new file mode 100644 index 0000000..bfb52f9 --- /dev/null +++ b/restic_volume_backup/backup_runner.py @@ -0,0 +1,27 @@ +import os +import docker + +from restic_volume_backup.config import Config + +def run(): + client = docker.Client(base_url=DOCKER_BASE_URL) + + container = client.containers.run( + 'image', + 'command', + labels={"restic-volume-backup.backup_process": True}, + auto_remove=True, + remove=True, + detach=True, + environment={ + 'test1': 'value1', + 'test2': 'value2', + }, + volumes={ + '/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'}, + '/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'}, + }, + working_dir=os.getcwd(), + ) + + # Pull logs and exist status of container diff --git a/restic_volume_backup/runner.py b/restic_volume_backup/runner.py deleted file mode 100644 index f5c5031..0000000 --- a/restic_volume_backup/runner.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import docker - - -client = docker.Client(base_url=DOCKER_BASE_URL) - -container = client.containers.run( - 'image', - 'command', - labels={"restic-volume-backup.process": True}, - auto_remove=True, - remove=True, - detach=True, - environment={ - 'test1': 'value1', - 'test2': 'value2', - }, - volumes={ - '/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'}, - '/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'}, - }, - working_dir=os.getcwd(), -) - -# Pull logs and exist status of container