def __init__ (self, service_url, print_message = False): ''' This rewrites the xmlrpc function bindings to use a decorator so that we can check the return status of the Slave functions before returning them back to the client It allows the client object to directly inherit all of the Slave calls exposed on the server side to the client side without writing ANOTHER lookup table. ''' _orig_Method = xmlrpclib._Method ''' XML-RPC doesn't support keyword arguments, so we have to do it ourselves... ''' class KeywordArgMethod(_orig_Method): def __call__(self, *args, **kwargs): args = list(args) if kwargs: args.append(("kwargs", kwargs)) return _orig_Method.__call__(self, *args) xmlrpclib._Method = KeywordArgMethod Server.__init__(self, service_url) setattr(self, "_ServerProxy__request", self.slave_error_check(self._ServerProxy__request)) self.vms = {} self.msattrs = None self.msci = None self.username = None self.print_message = print_message self.last_refresh = datetime_datetime.now()
def __init__(self, service_url): ''' This rewrites the xmlrpc function bindings to use a decorator so that we can check the return status of API functions before returning them back to the client It allows the client object to directly inherit all of the API calls exposed on the server side to the client side without writing ANOTHER lookup table. ''' Server.__init__(self, service_url) setattr(self, "_ServerProxy__request", self.api_error_check(self._ServerProxy__request)) self.vms = {} self.msattrs = None self.msci = None self.username = None
def __init__ (self, service_url): ''' This rewrites the xmlrpc function bindings to use a decorator so that we can check the return status of API functions before returning them back to the client It allows the client object to directly inherit all of the API calls exposed on the server side to the client side without writing ANOTHER lookup table. ''' Server.__init__(self, service_url) setattr(self, "_ServerProxy__request", self.api_error_check(self._ServerProxy__request)) self.vms = {} self.msattrs = None self.msci = None self.username = None