[modules/http_status] quotes

This commit is contained in:
tobi-wan-kenobi 2020-04-19 14:39:21 +02:00
parent f4d382eb19
commit 967ec5892b

View file

@ -16,22 +16,22 @@ import bumblebee.output
import bumblebee.engine import bumblebee.engine
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
UNK = "UNK" UNK = 'UNK'
def __init__(self, engine, config): def __init__(self, engine, config):
widget = bumblebee.output.Widget(full_text=self.output) widget = bumblebee.output.Widget(full_text=self.output)
super(Module, self).__init__(engine, config, widget) super(Module, self).__init__(engine, config, widget)
self._label = self.parameter("label") self._label = self.parameter('label')
self._target = self.parameter("target") self._target = self.parameter('target')
self._expect = self.parameter("expect", "200") self._expect = self.parameter('expect', '200')
self._status = self.getStatus() self._status = self.getStatus()
self._output = self.getOutput() self._output = self.getOutput()
def labelize(self, s): def labelize(self, s):
if self._label is None: if self._label is None:
return s return s
return "{}: {}".format(self._label, s) return '{}: {}'.format(self._label, s)
def getStatus(self): def getStatus(self):
try: try:
@ -47,8 +47,8 @@ class Module(bumblebee.engine.Module):
if self._status == self._expect: if self._status == self._expect:
return self.labelize(self._status) return self.labelize(self._status)
else: else:
reason = " != {}".format(self._expect) reason = ' != {}'.format(self._expect)
return self.labelize("{}{}".format(self._status, reason)) return self.labelize('{}{}'.format(self._status, reason))
def output(self, widget): def output(self, widget):
return self._output return self._output
@ -59,9 +59,9 @@ class Module(bumblebee.engine.Module):
def state(self, widget): def state(self, widget):
if self._status == self.UNK: if self._status == self.UNK:
return "warning" return 'warning'
if self._status != self._expect: if self._status != self._expect:
return "critical" return 'critical'
return self._output return self._output