mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix oopsies
This commit is contained in:
parent
83d03dc074
commit
22e397f71c
3 changed files with 15 additions and 12 deletions
|
@ -17,6 +17,15 @@ class MyMigration(Migration):
|
||||||
Add protected attribute in LDAP permission
|
Add protected attribute in LDAP permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@Migration.ldap_migration
|
||||||
|
def run(self, backup_folder):
|
||||||
|
|
||||||
|
# Update LDAP database
|
||||||
|
self.add_new_ldap_attributes()
|
||||||
|
|
||||||
|
# Migrate old settings
|
||||||
|
migrate_legacy_permission_settings()
|
||||||
|
|
||||||
def add_new_ldap_attributes(self):
|
def add_new_ldap_attributes(self):
|
||||||
|
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
@ -75,12 +84,3 @@ class MyMigration(Migration):
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap.update("cn=%s,ou=permission" % permission, update)
|
ldap.update("cn=%s,ou=permission" % permission, update)
|
||||||
|
|
||||||
@ldap_migration
|
|
||||||
def run(self, backup_folder):
|
|
||||||
|
|
||||||
# Update LDAP database
|
|
||||||
self.add_new_ldap_attributes()
|
|
||||||
|
|
||||||
# Migrate old settings
|
|
||||||
migrate_legacy_permission_settings()
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from moulinette.utils.log import getActionLogger
|
||||||
from moulinette.utils.filesystem import read_yaml
|
from moulinette.utils.filesystem import read_yaml
|
||||||
|
|
||||||
from yunohost.tools import Migration
|
from yunohost.tools import Migration
|
||||||
from yunohost.permission import user_permission_update
|
from yunohost.permission import user_permission_update, permission_sync_to_user
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.migration')
|
logger = getActionLogger('yunohost.migration')
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
dependencies = ["extend_permissions_features"]
|
dependencies = ["extend_permissions_features"]
|
||||||
|
|
||||||
@ldap_migration
|
@Migration.ldap_migration
|
||||||
def run(self, *args):
|
def run(self, *args):
|
||||||
|
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
|
|
@ -28,6 +28,7 @@ import os
|
||||||
import yaml
|
import yaml
|
||||||
import subprocess
|
import subprocess
|
||||||
import pwd
|
import pwd
|
||||||
|
import time
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
from moulinette import msignals, m18n
|
from moulinette import msignals, m18n
|
||||||
|
@ -1144,7 +1145,7 @@ class Migration(object):
|
||||||
os.system(f"cp -r --preserve /etc/yunohost/apps {backup_folder}/apps_settings")
|
os.system(f"cp -r --preserve /etc/yunohost/apps {backup_folder}/apps_settings")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YunohostError(
|
raise YunohostError(
|
||||||
"migration_ldap_can_not_backup_before_migration", error=e
|
"migration_ldap_can_not_backup_before_migration", error=str(e)
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
os.system("systemctl start slapd")
|
os.system("systemctl start slapd")
|
||||||
|
@ -1165,3 +1166,5 @@ class Migration(object):
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
os.system(f"rm -r {backup_folder}")
|
os.system(f"rm -r {backup_folder}")
|
||||||
|
|
||||||
|
return func
|
||||||
|
|
Loading…
Add table
Reference in a new issue