mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Server Upgrade: handle errors better
* Prevent to continue with upgrade if a fatal error happened * Use exceptions to handle failures https://fedorahosted.org/freeipa/ticket/4904 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
f6e3088b87
commit
78baeeb77c
@@ -167,8 +167,6 @@ class IPAUpgrade(service.Service):
|
||||
self.savefilename = '%s/%s.ipa.%s' % (paths.ETC_DIRSRV_SLAPD_INSTANCE_TEMPLATE % serverid, DSE, ext)
|
||||
self.files = files
|
||||
self.modified = False
|
||||
self.badsyntax = False
|
||||
self.upgradefailed = False
|
||||
self.serverid = serverid
|
||||
self.schema_files = schema_files
|
||||
self.realm = realm_name
|
||||
@@ -307,13 +305,11 @@ class IPAUpgrade(service.Service):
|
||||
if len(self.files) == 0:
|
||||
self.files = ld.get_all_files(ldapupdate.UPDATES_DIR)
|
||||
self.modified = (ld.update(self.files) or self.modified)
|
||||
except ldapupdate.BadSyntax, e:
|
||||
root_logger.error('Bad syntax in upgrade %s' % str(e))
|
||||
self.modified = False
|
||||
self.badsyntax = True
|
||||
except Exception, e:
|
||||
except ldapupdate.BadSyntax as e:
|
||||
root_logger.error('Bad syntax in upgrade %s', e)
|
||||
raise
|
||||
except Exception as e:
|
||||
# Bad things happened, return gracefully
|
||||
self.modified = False
|
||||
self.upgradefailed = True
|
||||
root_logger.error('Upgrade failed with %s' % str(e))
|
||||
root_logger.error('Upgrade failed with %s', e)
|
||||
root_logger.debug('%s', traceback.format_exc())
|
||||
raise RuntimeError(e)
|
||||
|
||||
Reference in New Issue
Block a user