samba-tool domain provision: Remove experimental OpenLDAP support
[amitay/samba.git] / python / samba / provision / backend.py
1 #
2 # Unix SMB/CIFS implementation.
3 # backend code for provisioning a Samba4 server
4
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
8 #
9 # Based on the original in EJS:
10 # Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
11 #
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.
16 #
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.
21 #
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/>.
24 #
25
26 """Functions for setting up a Samba configuration (LDB and LDAP backends)."""
27
28 import shutil
29
30 class BackendResult(object):
31
32     def report_logger(self, logger):
33         """Rerport this result to a particular logger.
34
35         """
36         raise NotImplementedError(self.report_logger)
37
38
39 class ProvisionBackend(object):
40
41     def __init__(self, paths=None, lp=None,
42                  names=None, logger=None):
43         """Provision a backend for samba4"""
44         self.paths = paths
45         self.lp = lp
46         self.credentials = None
47         self.names = names
48         self.logger = logger
49
50         self.type = "ldb"
51
52     def init(self):
53         """Initialize the backend."""
54         raise NotImplementedError(self.init)
55
56     def start(self):
57         """Start the backend."""
58         raise NotImplementedError(self.start)
59
60     def shutdown(self):
61         """Shutdown the backend."""
62         raise NotImplementedError(self.shutdown)
63
64     def post_setup(self):
65         """Post setup.
66
67         :return: A BackendResult or None
68         """
69         raise NotImplementedError(self.post_setup)
70
71
72 class LDBBackend(ProvisionBackend):
73
74     def init(self):
75         self.credentials = None
76
77         # Wipe the old sam.ldb databases away
78         shutil.rmtree(self.paths.samdb + ".d", True)
79
80     def start(self):
81         pass
82
83     def shutdown(self):
84         pass
85
86     def post_setup(self):
87         pass
88
89