Commit 215d513b authored by Colomban Wendling's avatar Colomban Wendling

A few PEP8 fixes

parent dcfb047a
...@@ -22,7 +22,7 @@ class AttrTree(object): ...@@ -22,7 +22,7 @@ class AttrTree(object):
return self._attrs[key] return self._attrs[key]
def __setitem__(self, key, value): def __setitem__(self, key, value):
if not key in self._attrs: if key not in self._attrs:
raise KeyError('Key "%s" does not exist' % key) raise KeyError('Key "%s" does not exist' % key)
elif isinstance(self._attrs[key], AttrTree): elif isinstance(self._attrs[key], AttrTree):
raise KeyError('Key "%s" is not settable' % key) raise KeyError('Key "%s" is not settable' % key)
......
...@@ -9,21 +9,20 @@ from picomon import mails ...@@ -9,21 +9,20 @@ from picomon import mails
# launch picomon # launch picomon
retcode = subprocess.call(["python3", "picomon.py"] + sys.argv[1:]) retcode = subprocess.call(["python3", "picomon.py"] + sys.argv[1:])
# load config file # load config file (unprotected, will trigger exceptions if problems but real
# (unprotected, will trigger exceptions if problems but real picomon beforehand) # picomon beforehand)
configfile = "config.py" configfile = "config.py"
if "-c" in sys.argv: if "-c" in sys.argv:
configfile = sys.argv[sys.argv.index("-c")+1] configfile = sys.argv[sys.argv.index("-c")+1]
if "--config" in sys.argv: if "--config" in sys.argv:
configfile = sys.argv[sys.argv.index("--config")+1] configfile = sys.argv[sys.argv.index("--config")+1]
sys.path.append(os.path.dirname(configfile)) sys.path.append(os.path.dirname(configfile))
filename = os.path.basename(configfile) filename = os.path.basename(configfile)
base, ext = os.path.splitext(filename) base, ext = os.path.splitext(filename)
importlib.import_module(base) importlib.import_module(base)
# send warning # send warning
mails.send_email(config.emails.watchdog_subject, mails.send_email(config.emails.watchdog_subject,
"Picomon exited with status %s" % retcode) "Picomon exited with status %s" % retcode)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment