2 # Unix SMB/CIFS implementation.
3 # backend code for provisioning a Samba4 server
5 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
6 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008-2009
7 # Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
9 # Based on the original in EJS:
10 # Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 3 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 """Functions for setting up a Samba configuration (LDB and LDAP backends)."""
30 class BackendResult(object):
32 def report_logger(self, logger):
33 """Rerport this result to a particular logger.
36 raise NotImplementedError(self.report_logger)
39 class ProvisionBackend(object):
41 def __init__(self, paths=None, lp=None,
42 names=None, logger=None):
43 """Provision a backend for samba4"""
46 self.credentials = None
53 """Initialize the backend."""
54 raise NotImplementedError(self.init)
57 """Start the backend."""
58 raise NotImplementedError(self.start)
61 """Shutdown the backend."""
62 raise NotImplementedError(self.shutdown)
67 :return: A BackendResult or None
69 raise NotImplementedError(self.post_setup)
72 class LDBBackend(ProvisionBackend):
75 self.credentials = None
77 # Wipe the old sam.ldb databases away
78 shutil.rmtree(self.paths.samdb + ".d", True)