[Kimchi-devel] [PATCH 1/2 v2] Plug in path for gingerbase been changed to /var/lib/gingerbase Fix issue 'unable to open database file' in gingerbase.py

Chandra Shehkhar Reddy Potula chandra at linux.vnet.ibm.com
Sat Oct 31 13:58:42 UTC 2015



On 10/30/2015 10:52 PM, Aline Manera wrote:
>
>
> On 30/10/2015 12:16, chandra at linux.vnet.ibm.com wrote:
>> From: chandrureddy <chandra at linux.vnet.ibm.com>
>>
>> ---
>>   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..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 exclusive for gingerbase matters, we can name the 
> file only as 'objectstore'
Done.
>
>
>
>>   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()
>




More information about the Kimchi-devel mailing list