From db01ca6d163f01ad9622da9ab0a60203fee51acc Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 9 May 2016 13:19:09 +1000 Subject: [PATCH] Fix return code detection in plugin list generation As can be seen in logs of the periodic generation job, our cgit does a weird thing where sometimes it returns a 404 page with content, and sometimes a zero response (see [1] for example, the last number is response size). This appears to be an openstack CI issue; possibly due to cgit caching or similar (see [2] for manual test). It will have to be investigated with the host apache logs. This is resulting in a lot of projects incorrectly being picked up as having plugins (I7116571d2a2b1fc3a61e5f1ed46ac2cbc244775a). I'm not sure if this problem is also releated to the original status-code issues mentioned in the code, but testing shows that cgit is correctly returning 404's for missing files (you can see in the logs [1]). Thus switch the logic to examine the return code which avoids this issue. [1] http://logs.openstack.org/periodic/propose-devstack-plugins-list/e55790c/console.html.gz#_2016-05-04_06_46_51_660 [2] http://paste.openstack.org/show/496434/ Change-Id: I6a06347d91d091441f6f7b70f99aba6d8e9add4b --- tools/generate-devstack-plugins-list.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/generate-devstack-plugins-list.py b/tools/generate-devstack-plugins-list.py index 089a6ef93e..bbad1bf502 100644 --- a/tools/generate-devstack-plugins-list.py +++ b/tools/generate-devstack-plugins-list.py @@ -44,16 +44,10 @@ def is_in_openstack_namespace(proj): # stackforge, etc) return proj.startswith('openstack/') -# Rather than returning a 404 for a nonexistent file, cgit delivers a -# 0-byte response to a GET request. It also does not provide a -# Content-Length in a HEAD response, so the way we tell if a file exists -# is to check the length of the entire GET response body. +# Check if this project has a plugin file def has_devstack_plugin(proj): r = requests.get("https://git.openstack.org/cgit/%s/plain/devstack/plugin.sh" % proj) - if len(r.text) > 0: - return True - else: - return False + return r.status_code == 200 logging.debug("Getting project list from %s" % url) r = requests.get(url)