[Kimchi-devel] [PATCH ] Fix screenshots and debug reports paths.

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Wed Feb 26 17:26:37 UTC 2014


-- 
Tested-by: Paulo Vital <pvital at linux.vnet.ibm.com>
Reviewed-by: Paulo Vital <pvital at linux.vnet.ibm.com>


On Wed, 2014-02-26 at 12:38 -0300, Leonardo Garcia wrote:
> From: Leonardo Garcia <lagarcia at br.ibm.com>
> 
> The definitions of the screenshots and debug reports paths in Cherrypy
> config were pointing to a relative path that, when concatenated with the
> root path defined in the [/] section, were not mapping to the correct path
> when Kimchi is installed through its RPM package.
> 
> This fix removes the use of the root path in the [/] config section and
> specifies the absolute path for all resources. That way we can easily
> handle running Kimchi directly from the git source tree or after a
> package installation --- in the later case the paths will not always be
> relative to the same root path, but will rather be spread in the file system
> according to the unix file system standard.
> 
> Signed-off-by: Leonardo Garcia <lagarcia at br.ibm.com>
> ---
>  src/kimchi/server.py | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/src/kimchi/server.py b/src/kimchi/server.py
> index ef8e701..6c7dfc1 100644
> --- a/src/kimchi/server.py
> +++ b/src/kimchi/server.py
> @@ -65,8 +65,6 @@ class Server(object):
>      CACHEEXPIRES = 31536000
>      configObj = {
>          '/': {'tools.trailing_slash.on': False,
> -              'tools.staticdir.root': paths.prefix,
> -              'tools.staticfile.root': paths.prefix,
>                'request.methods_with_bodies': ('POST', 'PUT'),
>                'tools.nocache.on': True,
>                'tools.sessions.on': True,
> @@ -77,45 +75,45 @@ class Server(object):
>                'tools.kimchiauth.on': False},
>          '/css': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'ui/css',
> +            'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
>              'tools.expires.on': True,
>              'tools.expires.secs': CACHEEXPIRES,
>              'tools.nocache.on': False
>          },
>          '/js': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'ui/js',
> +            'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
>              'tools.expires.on': True,
>              'tools.expires.secs': CACHEEXPIRES,
>              'tools.nocache.on': False
>          },
>          '/libs': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'ui/libs',
> +            'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
>              'tools.expires.on': True,
>              'tools.expires.secs': CACHEEXPIRES,
>              'tools.nocache.on': False,
>          },
>          '/images': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'ui/images',
> +            'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
>              'tools.nocache.on': False
>          },
>          '/data/screenshots': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'data/screenshots',
> +            'tools.staticdir.dir': config.get_screenshot_path(),
>              'tools.nocache.on': False
>          },
>          '/data/debugreports': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'data/debugreports',
> +            'tools.staticdir.dir': config.get_debugreports_path(),
>              'tools.nocache.on': False,
>              'tools.kimchiauth.on': True,
>              'tools.staticdir.content_types': {'xz': 'application/x-xz'}
>          },
>          '/config/ui/tabs.xml': {
>              'tools.staticfile.on': True,
> -            'tools.staticfile.filename': 'config/ui/tabs.xml',
> +            'tools.staticfile.filename': '%s/config/ui/tabs.xml' % paths.prefix,
>              'tools.nocache.on': True
>          },
>          '/favicon.ico': {
> @@ -124,7 +122,7 @@ class Server(object):
>          },
>          '/help': {
>              'tools.staticdir.on': True,
> -            'tools.staticdir.dir': 'ui/pages/help',
> +            'tools.staticdir.dir': '%s/ui/pages/help' % paths.prefix,
>              'tools.nocache.on': False
>          }
>      }




More information about the Kimchi-devel mailing list