From 666c7b7c440efd606a5b7d49055b80f117144b41 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 7 Mar 2018 16:50:39 -0600 Subject: [PATCH] Actually honor the static_path config value The puppet in puppet-zuul puts the static files somewhere that isn't inside the python path and sets static_path to point to it. Unfortunately, the refactor to split some handler base classes into the handlers file wound up with StaticHandler just using the STATIC_DIR default. Instead, let's use the value set on the zuul_web instance, since that will either be the config value or STATIC_DIR as a fallback. Change-Id: Ie512ceb8c9348749c9ad40ee4057950bbb2766ea --- zuul/web/handler.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zuul/web/handler.py b/zuul/web/handler.py index 43a4695e57..788aa637c5 100644 --- a/zuul/web/handler.py +++ b/zuul/web/handler.py @@ -17,8 +17,6 @@ import os from aiohttp import web -STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static') - class BaseWebHandler(object, metaclass=abc.ABCMeta): @@ -49,12 +47,13 @@ class StaticHandler(BaseWebHandler): def __init__(self, zuul_web, path, file_path=None): super(StaticHandler, self).__init__(None, zuul_web, 'GET', path) + self.static_path = zuul_web.static_path self.file_path = file_path or path.split('/')[-1] async def handleRequest(self, request): """Process a web request.""" headers = {} - fp = os.path.join(STATIC_DIR, self.file_path) + fp = os.path.join(self.static_path, self.file_path) if self.zuul_web.static_cache_expiry: headers['Cache-Control'] = "public, max-age=%d" % \ self.zuul_web.static_cache_expiry