mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
users: Handle upgrade for ldapscripts config
Increment users module version so existing users will get FreedomBox copy of ldapscripts config file. Avoid reconfiguration of slapd during module upgrade, because this will move the existing database. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
4cbb60ccfe
commit
87eecb7c62
@ -39,6 +39,7 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
|
||||
subparsers.add_parser('first-setup', help='Perform initial setup of LDAP')
|
||||
subparsers.add_parser('setup', help='Setup LDAP')
|
||||
|
||||
subparser = subparsers.add_parser('create-user',
|
||||
@ -90,6 +91,13 @@ def parse_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_first_setup(_):
|
||||
"""Perform initial setup of LDAP."""
|
||||
# Avoid reconfiguration of slapd during module upgrades, because
|
||||
# this will move the existing database.
|
||||
action_utils.dpkg_reconfigure('slapd', {'domain': 'thisbox'})
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
"""Setup LDAP."""
|
||||
# Update pam configs for access and mkhomedir.
|
||||
@ -97,14 +105,13 @@ def subcommand_setup(_):
|
||||
|
||||
configure_ldapscripts()
|
||||
|
||||
configure_slapd()
|
||||
configure_ldap_authentication()
|
||||
|
||||
configure_ldap_structure()
|
||||
|
||||
|
||||
def configure_slapd():
|
||||
def configure_ldap_authentication():
|
||||
"""Configure LDAP authentication."""
|
||||
action_utils.dpkg_reconfigure('slapd', {'domain': 'thisbox'})
|
||||
action_utils.dpkg_reconfigure('nslcd', {
|
||||
'ldap-uris': 'ldapi:///',
|
||||
'ldap-base': 'dc=thisbox',
|
||||
|
||||
@ -25,7 +25,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from plinth import action_utils, actions
|
||||
from plinth.menu import main_menu
|
||||
|
||||
version = 1
|
||||
version = 2
|
||||
|
||||
is_essential = True
|
||||
|
||||
@ -57,6 +57,8 @@ def init():
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.install(managed_packages)
|
||||
if old_version is None:
|
||||
helper.call('post', actions.superuser_run, 'users', ['first-setup'])
|
||||
helper.call('post', actions.superuser_run, 'users', ['setup'])
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user