ctdb/wscript: Remove long pending unsupported option
[Samba.git] / python / samba / provision / backend.py
blob4ffe30822d9f515d86ec7f0e113e70f4a150391d
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)."""
28 import shutil
30 class BackendResult(object):
32 def report_logger(self, logger):
33 """Rerport this result to a particular logger.
35 """
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"""
44 self.paths = paths
45 self.lp = lp
46 self.names = names
47 self.logger = logger
49 self.type = "ldb"
51 def init(self):
52 """Initialize the backend."""
53 raise NotImplementedError(self.init)
55 def start(self):
56 """Start the backend."""
57 raise NotImplementedError(self.start)
59 def shutdown(self):
60 """Shutdown the backend."""
61 raise NotImplementedError(self.shutdown)
63 def post_setup(self):
64 """Post setup.
66 :return: A BackendResult or None
67 """
68 raise NotImplementedError(self.post_setup)
71 class LDBBackend(ProvisionBackend):
73 def init(self):
75 # Wipe the old sam.ldb databases away
76 shutil.rmtree(self.paths.samdb + ".d", True)
78 def start(self):
79 pass
81 def shutdown(self):
82 pass
84 def post_setup(self):
85 pass