[Kimchi-devel] [PATCH 1/2 v4] Ginger Base : Plugin path changes

chandra at linux.vnet.ibm.com chandra at linux.vnet.ibm.com
Tue Nov 3 15:42:23 UTC 2015


From: chandrureddy <chandra at linux.vnet.ibm.com>

Plug in path for gingerbase been changed to /var/lib/gingerbase
Fix issue #744 : 'unable to open database file' in root.py and gingerbase.py
---
 src/wok/plugins/gingerbase/Makefile.am     | 15 +++++++--------
 src/wok/plugins/gingerbase/config.py.in    |  6 +++---
 src/wok/plugins/gingerbase/gingerbase.conf |  2 +-
 src/wok/plugins/gingerbase/gingerbase.py   | 16 ++++++++--------
 4 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/wok/plugins/gingerbase/Makefile.am b/src/wok/plugins/gingerbase/Makefile.am
index 99a69df..e7a89f6 100644
--- a/src/wok/plugins/gingerbase/Makefile.am
+++ b/src/wok/plugins/gingerbase/Makefile.am
@@ -80,8 +80,8 @@ do_substitution = \
 	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'         \
 	-e 's,[@]wokdir[@],$(wokdir),g'           \
 	-e 's,[@]gingerbasedir[@],$(gingerbasedir),g'           \
-	-e 's,[@]kimchiversion[@],$(PACKAGE_VERSION),g' \
-	-e 's,[@]kimchirelease[@],$(PACKAGE_RELEASE),g' \
+	-e 's,[@]gingerbaseversion[@],$(PACKAGE_VERSION),g' \
+	-e 's,[@]gingerbaserelease[@],$(PACKAGE_RELEASE),g' \
 	-e 's,[@]withspice[@],$(WITH_SPICE),g'
 
 config.py: config.py.in Makefile
@@ -94,8 +94,8 @@ config.py: config.py.in Makefile
 
 install-deb: install
 	cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
-	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi
-	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase/debugreports
 
 
 deb: contrib/make-deb.sh
@@ -131,18 +131,17 @@ ChangeLog:
 	fi
 
 install-data-local:
-	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/kimchi/
+	$(MKDIR_P) $(DESTDIR)/$(localstatedir)/lib/gingerbase/
 	$(MKDIR_P) $(DESTDIR)$(gingerbasedir)
 	$(INSTALL_DATA) API.json $(DESTDIR)$(gingerbasedir)/API.json
-	mkdir -p $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
+	mkdir -p $(DESTDIR)/$(localstatedir)/lib/gingerbase/debugreports
 
 uninstall-local:
 	@if test -f $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; then \
 		$(RM) $(DESTDIR)/etc/systemd/system/wokd.service.d/gingerbase.conf; \
 	fi; \
 	$(RM) $(DESTDIR)$(gingerbasedir)/API.json
-	$(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi/debugreports
-	$(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi/objectstore_gingerbase
+	$(RM) -rf $(DESTDIR)/$(localstatedir)/lib/gingerbase/debugreports
 
 VERSION:
 	@if test -d .git; then                                \
diff --git a/src/wok/plugins/gingerbase/config.py.in b/src/wok/plugins/gingerbase/config.py.in
index 922c914..48d595f 100644
--- a/src/wok/plugins/gingerbase/config.py.in
+++ b/src/wok/plugins/gingerbase/config.py.in
@@ -27,12 +27,12 @@ gingerBaseLock = threading.Lock()
 
 
 def get_debugreports_path():
-    return os.path.join('/var/lib/kimchi', 'debugreports')
+    return os.path.join(PluginPaths('gingerbase').state_dir, 'debugreports')
 
 
 def get_object_store():
-    return os.path.join('/var/lib/kimchi',
-                        'objectstore' + '_gingerbase')
+    return os.path.join(PluginPaths('gingerbase').state_dir,
+                        'objectstore')
 
 
 class GingerBasePaths(PluginPaths):
diff --git a/src/wok/plugins/gingerbase/gingerbase.conf b/src/wok/plugins/gingerbase/gingerbase.conf
index cbe3358..560e38b 100644
--- a/src/wok/plugins/gingerbase/gingerbase.conf
+++ b/src/wok/plugins/gingerbase/gingerbase.conf
@@ -20,7 +20,7 @@ tools.wokauth.on = True
 
 [/data/debugreports]
 tools.staticdir.on = True
-tools.staticdir.dir = '/var/lib/kimchi/debugreports'
+tools.staticdir.dir =  wok.config.PluginPaths('gingerbase').state_dir + '/debugreports'
 tools.nocache.on = False
 tools.wokauth.on = True
 tools.staticdir.content_types = {'xz': 'application/x-xz'}
diff --git a/src/wok/plugins/gingerbase/gingerbase.py b/src/wok/plugins/gingerbase/gingerbase.py
index 0d3709e..bca1503 100644
--- a/src/wok/plugins/gingerbase/gingerbase.py
+++ b/src/wok/plugins/gingerbase/gingerbase.py
@@ -29,6 +29,14 @@ from wok.root import WokRoot
 
 class GingerBase(WokRoot):
     def __init__(self, wok_options):
+        make_dirs = [
+            os.path.dirname(os.path.abspath(config.get_object_store())),
+            os.path.abspath(config.get_debugreports_path())
+        ]
+        for directory in make_dirs:
+            if not os.path.isdir(directory):
+                os.makedirs(directory)
+
         if hasattr(wok_options, "model"):
             self.model = wok_options.model
         elif wok_options.test:
@@ -48,13 +56,5 @@ class GingerBase(WokRoot):
         self.domain = 'gingerbase'
         self.messages = messages
 
-        make_dirs = [
-            os.path.dirname(os.path.abspath(config.get_object_store())),
-            os.path.abspath(config.get_debugreports_path())
-        ]
-        for directory in make_dirs:
-            if not os.path.isdir(directory):
-                os.makedirs(directory)
-
     def get_custom_conf(self):
         return config.GingerBaseConfig()
-- 
2.1.0




More information about the Kimchi-devel mailing list