Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #3 from brunobord/pep8-to-be-tested

Pep8 to be tested
  • Loading branch information...
commit 51e38ccaffba133d4a3a9fcaa0f42ad17e64362d 2 parents 93958c3 + cab5da6
@sebastien authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 Sources/watchdog.py
View
14 Sources/watchdog.py
@@ -672,7 +672,6 @@ def run(self, monitor, service, rule, runner):
Logger.Err("Could not send email to %s (#%s)" % (self.recipient, monitor.iteration))
def send(self, monitor=None, service=None, rule=None, runner=None):
- data = {}
server = smtplib.SMTP(self.host)
origin = self.origin or "<Watchdog for %s> watchdog@%s" % (service and service.name, popen("hostname")[:-1])
message = string.Template(self.MESSAGE).safe_substitute({
@@ -762,7 +761,6 @@ def run(self, monitor, service, rule, runner):
elapsed_time = now() - self.errorStartTime
self.errorValues.append(runner.result)
if len(self.errorValues) >= self.errors and elapsed_time >= self.during:
- error_values = self.errorValues
self.errorValues = []
for action in self.actions:
# FIXME: Should clone the runner and return the result
@@ -785,7 +783,7 @@ def getZMQContext(self):
@classmethod
def getZMQSocket(self, url):
- if not self.ZMQ_SOCKETS.has_key(url):
+ if url not in self.ZMQ_SOCKETS.keys():
import zmq
self.ZMQ_SOCKETS[url] = self.getZMQContext().socket(zmq.PUB)
self.ZMQ_SOCKETS[url].bind(url)
@@ -856,13 +854,13 @@ class HTTP(Rule):
def __init__(self, GET=None, POST=None, timeout=Time.s(10), freq=Time.m(1), fail=(), success=()):
Rule.__init__(self, freq, fail, success)
url = None
- method = None
+ #method = None
if GET:
url = GET
- method = "GET"
+ #method = "GET"
if POST:
url = POST
- method = "POST"
+ #method = "POST"
if url.startswith("http://"):
url = url[7:]
server, uri = url.split("/", 1)
@@ -1086,7 +1084,7 @@ def getAction(self, nameOrAction):
def act(self, name, event):
"""Runs the action with the given name."""
- assert self.actions.has_key(name)
+ assert name in self.actions.keys()
# NOTE: Document the protocol
# FIXME: Use pools ?
runner = Runner.Create(self.actions[name])
@@ -1217,7 +1215,7 @@ def __init__(self, *services):
map(self.addService, services)
def runnerForRule(self, rule, context, iteration):
- if self.runners.has_key(rule.id):
+ if rule.id in self.runners.keys():
self.logger.err("Previous iteration's rule is still running: %s, you should increase its frequency." % (rule))
return None
else:

0 comments on commit 51e38cc

Please sign in to comment.
Something went wrong with that request. Please try again.