Allow get_projects to fall-back to master.
In the event that the governance repo isn't tagged we want to be able to fall-back to master so we can still potentially validate a candidate. Change-Id: Ie13770f92dd05a3aa79bdc85b1bb482df3f3b8f3
This commit is contained in:
parent
1b4ee26009
commit
57d160b7b3
@ -24,6 +24,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from six.moves.urllib.error import HTTPError
|
||||||
from six.moves.urllib.parse import quote_plus
|
from six.moves.urllib.parse import quote_plus
|
||||||
from six.moves.urllib.request import urlopen
|
from six.moves.urllib.request import urlopen
|
||||||
|
|
||||||
@ -204,7 +205,7 @@ def check_atc_date(atc):
|
|||||||
return conf['timeframe']['end'] < expires_in
|
return conf['timeframe']['end'] < expires_in
|
||||||
|
|
||||||
|
|
||||||
def get_projects(tag=None):
|
def _get_projects(tag=None):
|
||||||
url = PROJECTS_URL
|
url = PROJECTS_URL
|
||||||
cache_file = '.projects.pkl'
|
cache_file = '.projects.pkl'
|
||||||
|
|
||||||
@ -223,6 +224,17 @@ def get_projects(tag=None):
|
|||||||
return pickle.load(open(cache_file, "rb"))
|
return pickle.load(open(cache_file, "rb"))
|
||||||
|
|
||||||
|
|
||||||
|
def get_projects(tag=None, fallback_to_master=False):
|
||||||
|
try:
|
||||||
|
projects = _get_projects(tag)
|
||||||
|
except HTTPError as exc:
|
||||||
|
if exc.code == 404 and tag and fallback_to_master:
|
||||||
|
projects = _get_projects()
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
return projects
|
||||||
|
|
||||||
|
|
||||||
# Election functions
|
# Election functions
|
||||||
def name2dir(name):
|
def name2dir(name):
|
||||||
"""Convert project name to directory name: only [a-zA-Z_] in camelcase"""
|
"""Convert project name to directory name: only [a-zA-Z_] in camelcase"""
|
||||||
|
Loading…
Reference in New Issue
Block a user