Don't delete the ejabberd backup database if it fails to load.

This commit is contained in:
James Valleroy 2014-12-15 23:23:10 -05:00 committed by Sunil Mohan Adapa
parent 5bee775bc8
commit b98a9ad84d

View File

@ -168,9 +168,13 @@ def subcommand_change_hostname(arguments):
# load backup database
if os.path.exists(EJABBERD_BACKUP):
time.sleep(10)
subprocess.call(['ejabberdctl', 'load', EJABBERD_BACKUP])
os.remove(EJABBERD_BACKUP)
try:
subprocess.check_output(['ejabberdctl',
'load',
EJABBERD_BACKUP])
os.remove(EJABBERD_BACKUP)
except subprocess.CalledProcessError as err:
print('Failed to load ejabberd backup database: %s', err)
else:
print('Could not load ejabberd backup database: %s not found'
% EJABBERD_BACKUP)