Split up modules
This commit is contained in:
parent
5202353e03
commit
f6ce330d56
|
@ -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)
|
||||||
|
|
|
@ -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")
|
Loading…
Reference in New Issue