aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-06-26 12:47:24 +0200
committernico <nico@magicbroccoli.de>2019-06-26 12:47:24 +0200
commit9188329c74667cec29efca9ecd4b582ef1c88a62 (patch)
tree0f33f3f98ab2f3dd73716e306eab20a60246c83c
parente245cb68de0a832ef233a623a2bf392fef782bd0 (diff)
ejabberdctl missing catch
+ add catch to prevent ejabberdctl missing FIleNotFoundError
-rw-r--r--main.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.py b/main.py
index a8be9b8..e39d82b 100644
--- a/main.py
+++ b/main.py
@@ -76,7 +76,15 @@ class BlacklistImporter:
# reload config if changes have been applied
if self.change:
- subprocess.call(['/usr/sbin/ejabberdctl', 'reload_config'], shell=False)
+ # catch ejabberdctl missing
+ if os.path.isfile('/usr/sbin/ejabberdctl'):
+ subprocess.call(['/usr/sbin/ejabberdctl', 'reload_config'], shell=False)
+
+ # report missing ejabberdctl reload_config
+ else:
+ print('/usr/sbin/ejabberdctl was not found', file=sys.stderr)
+ print('blacklist changes have been applied\nejabberd config was not reloaded', file=sys.stderr)
+ sys.exit(1)
def process(self):
"""