def connect_and_run(self, host, run, hosts, keyfile, certfile, timeout, **args): self.connection = XMLRPCClient( 'https://{0}/'.format(host if ':' in host else ':'. join([host, str(DEFAULT_PORT)])), keyfile, certfile, timeout) result = self.run(**args) check_std = lambda x: isinstance(x, str) or x == None result_ok = False if len(result) == 3: retval, stdout, stderr = result if isinstance(retval, int) and \ check_std(stdout) and check_std(stderr): result_ok = True if result_ok: return result else: raise ViriError( 'command Local class must return a tuple of ' '(int, str, str), representing (retval, stdout, stderr)')