Split up modules

This commit is contained in:
Einar Forselv 2019-04-15 17:25:42 +02:00
parent 5202353e03
commit f6ce330d56
2 changed files with 21 additions and 21 deletions

View File

@ -1,22 +1,5 @@
import os from restic_volume_backup.config import Config
import sys from restic_volume_backup.containers import RunningContainers
from containers import RunningContainers
import restic
cmds = ['status', 'backup', 'snapshots', 'check']
class Config:
repository = os.environ['RESTIC_REPOSITORY']
password = os.environ['RESTIC_PASSWORD']
@classmethod
def check(cls):
if not cls.repository:
raise ValueError("CONTAINER env var not set")
if not cls.password:
raise ValueError("PASSWORD env var not set")
def main(): def main():
@ -51,8 +34,6 @@ def main():
# for vol in containers.backup_volumes(): # for vol in containers.backup_volumes():
# restic.backup_volume(Config.repository, vol) # restic.backup_volume(Config.repository, vol)
if mode == 'snapshots': if mode == 'snapshots':
restic.snapshots(Config.repository) restic.snapshots(Config.repository)

View File

@ -0,0 +1,19 @@
import os
import sys
from containers import RunningContainers
import restic
cmds = ['status', 'backup', 'snapshots', 'check']
class Config:
repository = os.environ['RESTIC_REPOSITORY']
password = os.environ['RESTIC_PASSWORD']
@classmethod
def check(cls):
if not cls.repository:
raise ValueError("CONTAINER env var not set")
if not cls.password:
raise ValueError("PASSWORD env var not set")