Inline function _migrate_system_if_needed in backup

This commit is contained in:
Josué Tille 2019-05-10 22:02:06 +02:00
parent bca4e39b24
commit 975341a0b5
No known key found for this signature in database
GPG key ID: D5E068C6DFA8681D

View file

@ -893,22 +893,6 @@ class RestoreManager():
logger.debug("executing the post-install...")
tools_postinstall(domain, 'Yunohost', True)
def _migrate_system_if_needed(self, auth):
"""
Do some migration if needed
"""
# Check if we need to do the migration 0009 : setup group and permission
result = auth.search('ou=groups,dc=yunohost,dc=org',
'(&(objectclass=groupOfNamesYnh)(cn=all_users))',
['cn'])
if not result:
from yunohost.tools import _get_migration_by_name
setup_group_permission = _get_migration_by_name("setup_group_permission")
# Update LDAP schema restart slapd
logger.info(m18n.n("migration_0009_update_LDAP_schema"))
service_regen_conf(names=['slapd'], force=True)
setup_group_permission.migrate_LDAP_db(auth)
def clean(self, auth):
"""
@ -1130,7 +1114,6 @@ class RestoreManager():
self._patch_backup_csv_file()
self._restore_system(auth)
self._migrate_system_if_needed(auth)
self._restore_apps(auth)
finally:
self.clean(auth)
@ -1215,6 +1198,20 @@ class RestoreManager():
service_regen_conf()
# Check if we need to do the migration 0009 : setup group and permission
# Legacy code
result = auth.search('ou=groups,dc=yunohost,dc=org',
'(&(objectclass=groupOfNamesYnh)(cn=all_users))',
['cn'])
if not result:
from yunohost.tools import _get_migration_by_name
setup_group_permission = _get_migration_by_name("setup_group_permission")
# Update LDAP schema restart slapd
logger.info(m18n.n("migration_0009_update_LDAP_schema"))
service_regen_conf(names=['slapd'], force=True)
setup_group_permission.migrate_LDAP_db(auth)
def _restore_apps(self, auth):
"""Restore all apps targeted"""