From 9e5ff4892652ddb010588017d6b284ba4f52ff42 Mon Sep 17 00:00:00 2001 From: brent s Date: Thu, 31 Oct 2019 23:20:05 -0400 Subject: [PATCH] D'OH --- aif.xsd | 16 ++++++++-------- aif/config.py | 2 +- aif/disk/__init__.py | 2 +- aif/disk/filesystem.py | 14 +++++++++----- aif/disk/luks.py | 7 ++++--- aif/disk/lvm.py | 6 +++--- aif/disk/mdadm.py | 12 ++++++++---- examples/aif.xml | 8 -------- 8 files changed, 34 insertions(+), 33 deletions(-) diff --git a/aif.xsd b/aif.xsd index 0eb5f22..2d4d287 100644 --- a/aif.xsd +++ b/aif.xsd @@ -466,23 +466,23 @@ - + - + - + - + @@ -518,7 +518,7 @@ - + @@ -586,11 +586,11 @@ - + - + @@ -606,7 +606,7 @@ - + diff --git a/aif/config.py b/aif/config.py index f84bd69..5c66c5f 100644 --- a/aif/config.py +++ b/aif/config.py @@ -146,7 +146,7 @@ class LocalFile(Config): def __init__(self, path, xsd_path = None, *args, **kwargs): super().__init__(xsd_path = xsd_path, *args, **kwargs) self.type = 'local' - self.source = _patterns['local'].search(path).group('path') + self.source = path def fetch(self): self.source = os.path.realpath(self.source) diff --git a/aif/disk/__init__.py b/aif/disk/__init__.py index e7de234..f65e5eb 100644 --- a/aif/disk/__init__.py +++ b/aif/disk/__init__.py @@ -2,4 +2,4 @@ from . import block from . import filesystem from . import luks from . import lvm -from . import mdadm \ No newline at end of file +from . import mdadm diff --git a/aif/disk/filesystem.py b/aif/disk/filesystem.py index 0e58c19..b614ebb 100644 --- a/aif/disk/filesystem.py +++ b/aif/disk/filesystem.py @@ -4,10 +4,10 @@ import subprocess ## import psutil ## -from aif.disk.block import Partition -from aif.disk.luks import LUKS -from aif.disk.lvm import LV as LVMVolume -from aif.disk.mdadm import Array as MDArray +import aif.disk.block +import aif.disk.luks +import aif.disk.lvm +import aif.disk.mdadm # I wish there was a better way of doing this. # https://unix.stackexchange.com/a/98680 @@ -44,7 +44,11 @@ for i in os.listdir(_mod_dir): class FS(object): def __init__(self, fs_xml, sourceobj): self.xml = fs_xml - if not isinstance(sourceobj, (Partition, LUKS, LVMVolume, MDArray)): + if not isinstance(sourceobj, (aif.disk.block.Disk, + aif.disk.block.Partition, + aif.disk.luks.LUKS, + aif.disk.lvm.LV, + aif.disk.mdadm.Array)): raise ValueError(('sourceobj must be of type ' 'aif.disk.block.Partition, ' 'aif.disk.luks.LUKS, ' diff --git a/aif/disk/luks.py b/aif/disk/luks.py index 946ea73..9670f13 100644 --- a/aif/disk/luks.py +++ b/aif/disk/luks.py @@ -1,6 +1,7 @@ -from aif.disk.block import Disk, Partition -from aif.disk.lvm import LV -from aif.disk.mdadm import Array +import aif.disk.block +import aif.disk.lvm +import aif.disk.mdadm + class LUKS(object): def __init__(self, partobj): diff --git a/aif/disk/lvm.py b/aif/disk/lvm.py index fac8f74..5334ace 100644 --- a/aif/disk/lvm.py +++ b/aif/disk/lvm.py @@ -7,9 +7,9 @@ except ImportError: import subprocess has_mod = False ## -from aif.disk.block import Disk, Partition -from aif.disk.luks import LUKS -from aif.disk.mdadm import Array +import aif.disk.block +import aif.disk.luks +import aif.disk.mdadm class PV(object): diff --git a/aif/disk/mdadm.py b/aif/disk/mdadm.py index 3623e9f..aecc299 100644 --- a/aif/disk/mdadm.py +++ b/aif/disk/mdadm.py @@ -7,9 +7,9 @@ import uuid ## import mdstat ## -from aif.disk.block import Disk, Partition -from aif.disk.luks import LUKS -from aif.disk.lvm import LV +import aif.disk.block +import aif.disk.luks +import aif.disk.lvm SUPPORTED_LEVELS = (0, 1, 4, 5, 6, 10) @@ -50,7 +50,11 @@ class Member(object): def __init__(self, member_xml, partobj): self.xml = member_xml self.device = partobj - if not isinstance(self.device, (Partition, Disk, Array)): + if not isinstance(self.device, (aif.disk.block.Partition, + aif.disk.block.Disk, + aif.disk.mdadm.Array, + aif.disk.lvm.LV, + aif.disk.luks.LUKS)): raise ValueError(('partobj must be of type aif.disk.block.Partition, ' 'aif.disk.block.Disk, or aif.disk.mdadm.Array')) self.devpath = self.device.devpath diff --git a/examples/aif.xml b/examples/aif.xml index 7ff7575..28162e4 100644 --- a/examples/aif.xml +++ b/examples/aif.xml @@ -67,14 +67,6 @@ - - - - - - - -