ejabberdctl missing catch

+ add catch to prevent ejabberdctl missing FIleNotFoundError
This commit is contained in:
nico 2019-06-26 12:47:24 +02:00
parent e245cb68de
commit 9188329c74
Signed by: mightyBroccoli
GPG Key ID: EA7C31AAB1BDC1A2
1 changed files with 9 additions and 1 deletions

View File

@ -76,8 +76,16 @@ class BlacklistImporter:
# reload config if changes have been applied # reload config if changes have been applied
if self.change: if self.change:
# catch ejabberdctl missing
if os.path.isfile('/usr/sbin/ejabberdctl'):
subprocess.call(['/usr/sbin/ejabberdctl', 'reload_config'], shell=False) 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): def process(self):
""" """
function to build and compare the local yaml file to the remote file function to build and compare the local yaml file to the remote file