def updateAgent(agentName, branch = None, version = None): """ Requires an agent to update to version/branch (if provided), or to update to the latest version of branch (if provided), or to update to the latest version of its default branch (if no version/branch provided). @since: 1.1 @type agentName: string @param agentName: the name of the agent to update (i.e. not its URI) @type branch: string @param branch: a version branch (usually 'experimental', 'stable', ...) @type version: string @param version: a valid version for the agent component @rtype: bool @returns: True """ getLogger().info(">> updateAgent(%s)" % (agentName)) # Raises an error if needed try: ProbeManager.instance().updateAgent(agentName) except Exception, e: getLogger().info("<< updateAgent: Fault:\n" + str(e)) raise(e)
def updateAgent(agentName, branch=None, version=None): """ Requires an agent to update to version/branch (if provided), or to update to the latest version of branch (if provided), or to update to the latest version of its default branch (if no version/branch provided). @since: 1.1 @type agentName: string @param agentName: the name of the agent to update (i.e. not its URI) @type branch: string @param branch: a version branch (usually 'experimental', 'stable', ...) @type version: string @param version: a valid version for the agent component @rtype: bool @returns: True """ getLogger().info(">> updateAgent(%s)" % (agentName)) # Raises an error if needed try: ProbeManager.instance().updateAgent(agentName) except Exception as e: getLogger().info("<< updateAgent: Fault:\n" + str(e)) raise (e) getLogger().info("<< updateAgent OK") return True
def deployProbe(agentName, probeName, probeType): """ Deploys a new probe on a already existent agent. @since: 1.0 @type agentName: string @param agentName: the agent name @type probeType: string @param probeType: the type of the probe to deploy @type probeName: string @param probeName: the name of the probe to deploy. The final probe URI will be: probe:probeName@agentName @rtype: bool @returns: True """ getLogger().info(">> deployProbe(%s, %s, %s)" % (agentName, probeType, probeName)) # Raises an error if needed try: ProbeManager.instance().deployProbe(agentName, probeName, probeType) except Exception, e: getLogger().info("<< deployProbe: Fault:\n" + str(e)) raise(e)
def deployProbe(agentName, probeName, probeType): """ Deploys a new probe on a already existent agent. @since: 1.0 @type agentName: string @param agentName: the agent name @type probeType: string @param probeType: the type of the probe to deploy @type probeName: string @param probeName: the name of the probe to deploy. The final probe URI will be: probe:probeName@agentName @rtype: bool @returns: True """ getLogger().info(">> deployProbe(%s, %s, %s)" % (agentName, probeType, probeName)) # Raises an error if needed try: ProbeManager.instance().deployProbe(agentName, probeName, probeType) except Exception as e: getLogger().info("<< deployProbe: Fault:\n" + str(e)) raise (e) getLogger().info("<< deployProbe OK") return True
def restartAgent(agentName): """ Restarts an agent whose uri is agent:agentName @since: 1.1 @type agentName: string @param agentName: the name of the agent to restart (i.e. not its URI) @rtype: bool @returns: True """ getLogger().info(">> restartAgent(%s)" % (agentName)) # Raises an error if needed try: ProbeManager.instance().restartAgent(agentName) except Exception, e: getLogger().info("<< restartAgent: Fault:\n" + str(e)) raise(e)
def restartAgent(agentName): """ Restarts an agent whose uri is agent:agentName @since: 1.1 @type agentName: string @param agentName: the name of the agent to restart (i.e. not its URI) @rtype: bool @returns: True """ getLogger().info(">> restartAgent(%s)" % (agentName)) # Raises an error if needed try: ProbeManager.instance().restartAgent(agentName) except Exception, e: getLogger().info("<< restartAgent: Fault:\n" + str(e)) raise (e)
def undeployProbe(agentName, probeName): """ Undeploys an existing probe on a already existent agent. @since: 1.0 @type agentName: string @param agentName: the agent name @type probeName: string @param probeName: the name of the probe to undeploy. @rtype: bool @returns: True """ getLogger().info(">> undeployProbe(%s, %s)" % (agentName, probeName)) # Raises an error if needed try: ProbeManager.instance().undeployProbe(agentName, probeName) except Exception, e: getLogger().info("<< undeployProbe: Fault:\n" + str(e)) raise(e)
def undeployProbe(agentName, probeName): """ Undeploys an existing probe on a already existent agent. @since: 1.0 @type agentName: string @param agentName: the agent name @type probeName: string @param probeName: the name of the probe to undeploy. @rtype: bool @returns: True """ getLogger().info(">> undeployProbe(%s, %s)" % (agentName, probeName)) # Raises an error if needed try: ProbeManager.instance().undeployProbe(agentName, probeName) except Exception, e: getLogger().info("<< undeployProbe: Fault:\n" + str(e)) raise (e)
def getRegisteredAgents(): """ Gets currently registered agents. @since: 1.0 @rtype: list of dict{name: string, type: string, contact: string, uri: string, supported-probes: list of strings, user-agent: string} @returns: a list of registered agents with their names, types, contact, uri, list of supported probe types, and user agent. """ res = [] getLogger().info(">> getRegisteredAgents") try: res = ProbeManager.instance().getRegisteredAgents() except Exception, e: getLogger().info("<< getRegisteredAgents: Fault:\n" + str(e)) raise(e)
def getRegisteredProbes(): """ Gets currently registered probes. @since: 1.0 @rtype: list of dict{name: string, type: string, contact: string, locked: bool, uri: string} @returns: a list of registered probes with their names, types, contact (extracted from their agent), uri, and locking state """ res = [] getLogger().info(">> getRegisteredProbes") try: res = ProbeManager.instance().getRegisteredProbes() except Exception, e: getLogger().info("<< getRegisteredProbes: Fault:\n" + str(e)) raise(e)
def getRegisteredAgents(): """ Gets currently registered agents. @since: 1.0 @rtype: list of dict{name: string, type: string, contact: string, uri: string, supported-probes: list of strings, user-agent: string} @returns: a list of registered agents with their names, types, contact, uri, list of supported probe types, and user agent. """ res = [] getLogger().info(">> getRegisteredAgents") try: res = ProbeManager.instance().getRegisteredAgents() except Exception, e: getLogger().info("<< getRegisteredAgents: Fault:\n" + str(e)) raise (e)
def getRegisteredProbes(): """ Gets currently registered probes. @since: 1.0 @rtype: list of dict{name: string, type: string, contact: string, locked: bool, uri: string} @returns: a list of registered probes with their names, types, contact (extracted from their agent), uri, and locking state """ res = [] getLogger().info(">> getRegisteredProbes") try: res = ProbeManager.instance().getRegisteredProbes() except Exception, e: getLogger().info("<< getRegisteredProbes: Fault:\n" + str(e)) raise (e)