[Kimchi-devel] [PATCH 1/2] Fix Issue #744 - gingerbase: objectstore issues

Aline Manera alinefm at linux.vnet.ibm.com
Fri Oct 30 16:50:19 UTC 2015



On 29/10/2015 18:25, chandra at linux.vnet.ibm.com wrote:
> From: chandrureddy <chandra at linux.vnet.ibm.com>
>
> plug in path for gingerbase been changed to /var/lib/gingerbase
> Fix issue 'unable to open database file' in root.py and gingerbase.py
> ---
>   src/wok/plugins/gingerbase/Makefile.am     | 18 ++++++++++--------
>   src/wok/plugins/gingerbase/config.py.in    |  6 +++---
>   src/wok/plugins/gingerbase/gingerbase.conf |  2 +-
>   src/wok/plugins/gingerbase/gingerbase.py   | 16 ++++++++--------
>   src/wok/plugins/kimchi/root.py             | 18 +++++++++---------
>   5 files changed, 31 insertions(+), 29 deletions(-)
>
> diff --git a/src/wok/plugins/gingerbase/Makefile.am b/src/wok/plugins/gingerbase/Makefile.am
> index 99a69df..533cdf8 100644
> --- a/src/wok/plugins/gingerbase/Makefile.am
> +++ b/src/wok/plugins/gingerbase/Makefile.am
> @@ -31,6 +31,9 @@ gingerbasedir = $(pythondir)/wok/plugins/gingerbase
>   confdir = $(sysconfdir)/wok/plugins.d
>   dist_conf_DATA = gingerbase.conf
>
> +name=ginger-base
> +distdir=$(name)-$(PACKAGE_VERSION)
> +
>   AUTOMAKE_OPTIONS = foreign
>
>   ACLOCAL_AMFLAGS = --install -I m4
> @@ -80,8 +83,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 +97,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 +134,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
>
>   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..9d911da 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').conf_dir, 'debugreports')
>


>   def get_object_store():
> -    return os.path.join('/var/lib/kimchi',
> -                        'objectstore' + '_gingerbase')
> +    return os.path.join(PluginPaths('gingerbase').state_dir,
> +                        'objectstore_gingerbase')
>

As the directory is excluded for gingerbase matters, we can name the 
file only as '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()
> diff --git a/src/wok/plugins/kimchi/root.py b/src/wok/plugins/kimchi/root.py
> index 44452b4..37da8b3 100644
> --- a/src/wok/plugins/kimchi/root.py
> +++ b/src/wok/plugins/kimchi/root.py
> @@ -30,6 +30,15 @@ from wok.root import WokRoot
>
>   class KimchiRoot(WokRoot):
>       def __init__(self, wok_options):
> +        make_dirs = [
> +            os.path.dirname(os.path.abspath(config.get_object_store())),
> +            os.path.abspath(config.get_distros_store()),
> +            os.path.abspath(config.get_screenshot_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:
> @@ -53,14 +62,5 @@ class KimchiRoot(WokRoot):
>           self.domain = 'kimchi'
>           self.messages = messages
>
> -        make_dirs = [
> -            os.path.dirname(os.path.abspath(config.get_object_store())),
> -            os.path.abspath(config.get_distros_store()),
> -            os.path.abspath(config.get_screenshot_path())
> -        ]
> -        for directory in make_dirs:
> -            if not os.path.isdir(directory):
> -                os.makedirs(directory)
> -
>       def get_custom_conf(self):
>           return config.KimchiConfig()




More information about the Kimchi-devel mailing list