def check_config(): """ Check crucial configuration details for existence and workability. Runs checks to see whether bugtracker's URL is reachable, whether backend is available at the right filename, and whether the script has the key arguments it needs to run: URL, backend, and database details. The filename for the backend in the backends/ directory needs to be the same as the configuration argument specifying that backend. For instance, invoking the Launchpad backend uses 'lp', and so the filename is 'lp.py'. """ Config.check_params(['url', 'backend']) if Config.backend + ".py" not in Backend.get_all_backends(): raise InvalidConfig('Backend "' + Config.backend + '" does not exist') url = urlparse.urlparse(Config.url) check_url = urlparse.urljoin(url.scheme + '://' + url.netloc, '') print("Checking URL: " + check_url) req = Request(check_url) try: response = urlopen(req) except HTTPError, e: raise InvalidConfig('The server could not fulfill the request ' + str(e.msg) + '(' + str(e.code) + ')')
def check_config(): """ Check crucial configuration details for existence and workability. Runs checks to see whether bugtracker's URL is reachable, whether backend is available at the right filename, and whether the script has the key arguments it needs to run: URL, backend, and database details. The filename for the backend in the backends/ directory needs to be the same as the configuration argument specifying that backend. For instance, invoking the Launchpad backend uses 'lp', and so the filename is 'lp.py'. """ Config.check_params(['url', 'backend']) if Config.backend + ".py" not in Backend.get_all_backends(): raise InvalidConfig('Backend "' + Config.backend + '" does not exist') url = urlparse.urlparse(Config.url) check_url = urlparse.urljoin(url.scheme + '://' + url.netloc, '') print("Checking URL: " + check_url) req = Request(check_url) if Config.backend != 'github': try: response = urlopen(req) except HTTPError, e: raise InvalidConfig('The server could not fulfill the request ' + str(e.msg) + '(' + str(e.code) + ')') except URLError, e: raise InvalidConfig('We failed to reach a server. ' + str(e.reason))
def check_config(): """ """ Config.check_params(['url','backend']) if Config.backend+".py" not in Backend.get_all_backends(): raise InvalidConfig('Backend "'+ Config.backend + '" does not exist') url = urlparse.urlparse(Config.url) check_url = urlparse.urljoin(url.scheme + '://' + url.netloc,'') print("Checking URL: " + check_url) req = Request(check_url) try: response = urlopen(req) except HTTPError, e: raise InvalidConfig('The server could not fulfill the request ' + str(e.msg) + '('+ str(e.code)+')')
def check_config(): """ """ Config.check_params(['url', 'backend']) if Config.backend + ".py" not in Backend.get_all_backends(): raise InvalidConfig('Backend "' + Config.backend + '" does not exist') url = urlparse.urlparse(Config.url) check_url = urlparse.urljoin(url.scheme + '://' + url.netloc, '') print("Checking URL: " + check_url) req = Request(check_url) try: response = urlopen(req) except HTTPError, e: raise InvalidConfig('The server could not fulfill the request ' + str(e.msg) + '(' + str(e.code) + ')')