Adding class bodies

This commit is contained in:
Marcel Otte 2019-01-06 17:34:02 +01:00
parent c7ae18e570
commit 77e979886b
3 changed files with 56 additions and 0 deletions

27
backive/config/config.py Normal file
View File

@ -0,0 +1,27 @@
import os
import pwd
from ruamel.yaml import YAML
import logging
class Config:
def __init__(self):
pass
def find_config(self):
# who are we?
uid = os.getuid()
# name?
user = pwd.getpwuid(uid).pw_name
try:
if uid == 0:
config_file = "/etc/mbd.yml"
else:
config_file = os.path.join(os.path.expanduser("~"), ".mbd", "mbd.yml")
pass
with open(config_file, "r") as cfg:
self._config = YAML().load(cfg)
except Exception as e:
logging.error(e)

14
backive/core/backup.py Normal file
View File

@ -0,0 +1,14 @@
import os
class Backup:
config = {}
def __init__(self):
pass
def run(self):
pass

15
backive/core/device.py Normal file
View File

@ -0,0 +1,15 @@
import os
class Device:
disks_by_uuid = "/dev/disk/by-uuid"
def __init__(self):
pass
@classmethod
def get_device_list(cls):
if os.path.exists(cls.disks_by_uuid):
uuids = os.listdir(cls.disks_by_uuid)
return uuids
return []