summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-09-04 12:10:36 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-09-04 06:34:16 +0200
commit389cb93450b191f1ac1442f4f28e3919de38c5c5 (patch)
treed8c0c13f90cd670176eadbc296dbd90f60c511fa /source4/scripting/python
parent329ec81288451a0110a755aeb61d4f910c393b09 (diff)
downloadsamba-389cb93450b191f1ac1442f4f28e3919de38c5c5.tar.gz
samba-389cb93450b191f1ac1442f4f28e3919de38c5c5.tar.bz2
samba-389cb93450b191f1ac1442f4f28e3919de38c5c5.zip
s4-provision Allow a missing idmap DB in upgrade.py
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Sun Sep 4 06:34:16 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/upgrade.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 1ac1ef9054..09a66dbf13 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -109,13 +109,20 @@ def add_idmap_entry(idmapdb, sid, xid, xid_type, logger):
str(sid), str(xid), xid_type, str(e))
-def import_idmap(idmapdb, samba3_idmap, logger):
+def import_idmap(idmapdb, samba3, logger):
"""Import idmap data.
:param idmapdb: Samba4 IDMAP database
:param samba3_idmap: Samba3 IDMAP database to import from
:param logger: Logger object
"""
+
+ try:
+ samba3_idmap = samba3.get_idmap_db()
+ except IOError as (errno, strerror):
+ logger.warn('Cannot open idmap database, Ignoring: ({0}): {1}'.format(errno, strerror))
+ return
+
currentxid = max(samba3_idmap.get_user_hwm(), samba3_idmap.get_group_hwm())
lowerbound = currentxid
# FIXME: upperbound
@@ -559,7 +566,7 @@ def upgrade_from_samba3(samba3, logger, targetdir, session_info=None):
# Migrate IDMAP database
logger.info("Importing idmap database")
- import_idmap(result.idmap, samba3.get_idmap_db(), logger)
+ import_idmap(result.idmap, samba3, logger)
# Set the s3 context for samba4 configuration
new_lp_ctx = s3param.get_context()