On Mon, May 31, 2010 at 12:24 PM, Michael Hanselmann <han...@google.com> wrote: > Am 31. Mai 2010 18:09 schrieb Tom Limoncelli <t...@google.com>: >> --- a/daemons/ganeti-watcher >> +++ b/daemons/ganeti-watcher >> +def IsRapiResponding(hostname): >> + """Connects to RAPI port and does a simple test. >> + >> + �...@type hostname: string >> + �...@param hostname: hostname of the node to connect to. >> + >> + Returns: > > There must be nothing except epydoc tags once you start them. See how > it's done in other functions: > > """Foo blaz > > Longer description goes here. > > @type …: … > @param …: … > @rtype: bool > @return: mooo
Done. > > """ > >> + �...@rtype: bool >> + �...@return: Whether RAPI is working properly > >> + >> + """ >> + ssl_config = rapi.client.CertAuthorityVerify(constants.RAPI_CERT_FILE) >> + rapi_client = \ >> + rapi.client.GanetiRapiClient(hostname, >> + config_ssl_verification=ssl_config) >> + >> + try: >> + master_version = rapi_client.GetVersion() >> + except urllib2.URLError, err: >> + # Connection refused: >> + logging.warning("RAPI Error: URLError (%s)", err) >> + return False > > Please put this in a separate patch for rapi.client (to be committed > before this one). Catch URLError in there and convert it to > GanetiApiError. You're killing me, dude. Patch sent in other email. >> + except rapi.client.CertificateError, err: >> + logging.warning("RAPI Error: CertificateError (%s)", err) >> + return False >> + except rapi.client.GanetiApiError, err: >> + logging.warning("RAPI Error: GanetiApiError (%s)", err) >> + return False >> + logging.debug("RAPI Result: master_version is %s", master_version) >> + return master_version == constants.RAPI_VERSION > > Michael >