From 89e7afbf74ffbbb54dd892bf2c4245aedee2a832 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 9 Dec 2014 11:10:24 -0600 Subject: Remove blanket excepts from plugins and lint This removes most blanket except: clauses from all plugins, including the base plugin libraries, and bcfg2-lint. The few that remain should all be necessary. Most of the changes were quite minor, but this did require some restructuring of the CfgPrivateKeyCreator; as a result, the tests for that module were rewritten. --- src/lib/Bcfg2/Server/Plugins/Guppy.py | 41 ++++++++++++++--------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Guppy.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Guppy.py b/src/lib/Bcfg2/Server/Plugins/Guppy.py index 8427a56c3..de994a2db 100644 --- a/src/lib/Bcfg2/Server/Plugins/Guppy.py +++ b/src/lib/Bcfg2/Server/Plugins/Guppy.py @@ -1,9 +1,9 @@ -""" -This plugin is used to trace memory leaks within the bcfg2-server -process using Guppy. By default the remote debugger is started -when this plugin is enabled. The debugger can be shutoff in a running -process using "bcfg2-admin xcmd Guppy.Disable" and reenabled using -"bcfg2-admin xcmd Guppy.Enable". +"""Debugging plugin to trace memory leaks within the bcfg2-server process. + +By default the remote debugger is started when this plugin is enabled. +The debugger can be shutoff in a running process using "bcfg2-admin +xcmd Guppy.Disable" and reenabled using "bcfg2-admin xcmd +Guppy.Enable". To attach the console run: @@ -23,36 +23,27 @@ Remote connection 1. To return to Monitor, type or . Remote interactive console. To return to Annex, type '-'. >>> hp.heap() ... - - """ import Bcfg2.Server.Plugin from guppy.heapy import Remote class Guppy(Bcfg2.Server.Plugin.Plugin): - """Guppy is a debugging plugin to help trace memory leaks""" + """Guppy is a debugging plugin to help trace memory leaks.""" __author__ = 'bcfg-dev@mcs.anl.gov' __rmi__ = Bcfg2.Server.Plugin.Plugin.__rmi__ + ['Enable', 'Disable'] __child_rmi__ = __rmi__[:] def __init__(self, core): Bcfg2.Server.Plugin.Plugin.__init__(self, core) - self.Enable() - def Enable(self): - """Enable remote debugging""" - try: - Remote.on() - except: - self.logger.error("Failed to create Heapy context") - raise Bcfg2.Server.Plugin.PluginInitError - - def Disable(self): - """Disable remote debugging""" - try: - Remote.off() - except: - self.logger.error("Failed to disable Heapy") - raise Bcfg2.Server.Plugin.PluginInitError + @staticmethod + def Enable(): + """Enable remote debugging.""" + Remote.on() + + @staticmethod + def Disable(): + """Disable remote debugging.""" + Remote.off() -- cgit v1.2.3-1-g7c22