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

A few PEP8 fixes

parent dcfb047a
......@@ -22,7 +22,7 @@ class AttrTree(object):
return self._attrs[key]
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)
elif isinstance(self._attrs[key], AttrTree):
raise KeyError('Key "%s" is not settable' % key)
......
......@@ -9,21 +9,20 @@ from picomon import mails
# launch picomon
retcode = subprocess.call(["python3", "picomon.py"] + sys.argv[1:])
# load config file
# (unprotected, will trigger exceptions if problems but real picomon beforehand)
# load config file (unprotected, will trigger exceptions if problems but real
# picomon beforehand)
configfile = "config.py"
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:
configfile = sys.argv[sys.argv.index("--config")+1]
configfile = sys.argv[sys.argv.index("--config")+1]
sys.path.append(os.path.dirname(configfile))
filename = os.path.basename(configfile)
filename = os.path.basename(configfile)
base, ext = os.path.splitext(filename)
importlib.import_module(base)
# send warning
mails.send_email(config.emails.watchdog_subject,
"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