Adding class bodies
This commit is contained in:
parent
c7ae18e570
commit
77e979886b
|
@ -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)
|
|
@ -0,0 +1,14 @@
|
|||
import os
|
||||
|
||||
|
||||
class Backup:
|
||||
|
||||
config = {}
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
||||
|
|
@ -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 []
|
Loading…
Reference in New Issue