[PATCH 08/16] Move CONFIG_PATH to external from the Class, so you will not need a to create a container to get the path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Dan Walsh <dwalsh@xxxxxxxxxx>
---
 bin/virt-sandbox-service | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 7f4dcc8..b816933 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -50,11 +50,17 @@ except IOError:
     import __builtin__
     __builtin__.__dict__['_'] = unicode
 
+CONFIG_PATH = "/etc/libvirt-sandbox/services/"
+def get_config_path(name):
+    return CONFIG_PATH + name + ".sandbox"
+
+def read_config(name):
+    return LibvirtSandbox.Config.load_from_path(get_config_path(name))
+
 class Container:
     IGNORE_DIRS        = [ "/var/run/", "/etc/logrotate.d/", "/etc/pam.d" ]
     DEFAULT_DIRS       = [ "/etc", "/var" ]
     PROFILE_FILES      = [ ".bashrc", ".bash_profile" ]
-    CONFIG_PATH        = "/etc/libvirt-sandbox/services/"
     MACHINE_ID         = "/etc/machine-id"
     HOSTNAME           = "/etc/hostname"
     FUNCTIONS          = "/etc/rc.d/init.d/functions"
@@ -214,7 +220,7 @@ WantedBy=%(TARGET)s
     def get_config_path(self, name = None):
         if not name:
             name = self.get_name()
-        return self.CONFIG_PATH + name + ".sandbox"
+        return get_config_path()
 
     def get_filesystem_path(self, name = None):
         if not name:
@@ -789,8 +795,7 @@ def usage(parser, msg):
 
 def sandbox_list(args):
     import glob
-    container = Container()
-    g = glob.glob(container.CONFIG_PATH + "*.sandbox")
+    g = glob.glob(CONFIG_PATH + "*.sandbox")
     g.sort()
     for gc in g:
         try:
-- 
1.8.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]