def __init__(self, resource_id, *args, **kwargs): """ Client constructor. @param resource_id The ID this service represents. @param name Use this kwarg to set the target exchange name (service or process). """ # Assert and set the resource ID. assert resource_id, "resource_id must be set for an agent" self.resource_id = resource_id # Set the name, retrieve as proc ID if not set by user. if not 'name' in kwargs: process_id = self._get_agent_process_id(self.resource_id) if process_id: kwargs = kwargs.copy() kwargs['name'] = process_id log.debug("Use agent process %s for resource_id=%s" % (process_id, self.resource_id)) else: # TODO: Check if there is a service for this type of resource log.debug("No agent process found for resource_id %s" % self.resource_id) raise NotFound("No agent process found for resource_id %s" % self.resource_id) assert "name" in kwargs, "Name argument for agent target not set" # transpose name -> to_name to make underlying layer happy kwargs["to_name"] = kwargs.pop("name") # Superclass constructor. ResourceAgentProcessClient.__init__(self, *args, **kwargs)
def __init__(self, resource_id, *args, **kwargs): assert resource_id, "resource_id must be set for an agent" self.resource_id = resource_id if not 'name' in kwargs: process_id = self._get_agent_process_id(self.resource_id) if process_id: kwargs['name'] = process_id log.debug("Use agent process %s for resource_id=%s" % (process_id, self.resource_id)) else: # TODO: Check if there is a service for this type of resource log.debug("No agent process found for resource_id=%s" % self.resource_id) assert "name" in kwargs, "Name argument for agent target not set" ResourceAgentProcessClient.__init__(self, *args, **kwargs)
def __init__(self, resource_id, *args, **kwargs): assert resource_id, "resource_id must be set for an agent" self.resource_id = resource_id if not 'name' in kwargs: process_id = self._get_agent_process_id(self.resource_id) if process_id: kwargs['name'] = process_id log.debug("Use agent process %s for resource_id=%s" % (process_id, self.resource_id)) else: # TODO: Check if there is a service for this type of resource log.debug("No agent process found for resource_id %s" % self.resource_id) raise iex.NotFound("No agent process found for resource_id %s" % self.resource_id) assert "name" in kwargs, "Name argument for agent target not set" ResourceAgentProcessClient.__init__(self, *args, **kwargs)
def __init__(self, resource_id, *args, **kwargs): assert resource_id, "resource_id must be set for an agent" self.resource_id = resource_id assert "name" in kwargs, "Name argument for agent target not set" ResourceAgentProcessClient.__init__(self, *args, **kwargs)