From 596d6cceab851798de37fc02eddf64a7b2fd1d93 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Wed, 19 Oct 2011 09:31:16 +1100
Subject: s4-s3-upgrade Fix samba3upgrade code to cope with a missing wins.dat

---
 source4/scripting/python/samba/upgrade.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'source4/scripting/python')

diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 265bdbdd28..f9f7be1d99 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -243,6 +243,7 @@ def import_wins(samba4_winsdb, samba3_winsdb):
     :param samba4_winsdb: WINS database to import to
     :param samba3_winsdb: WINS database to import from
     """
+
     version_id = 0
 
     for (name, (ttl, ips, nb_flags)) in samba3_winsdb.items():
@@ -641,7 +642,15 @@ Please fix this account before attempting to upgrade again
 
     # Import WINS database
     logger.info("Importing WINS database")
-    import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
+
+    samba3_winsdb = None
+    try:
+        samba3_winsdb = samba3.get_wins_db()
+    except IOError, e:
+        logger.warn('Cannot open wins database, Ignoring: %s', str(e))
+
+    if samba3_winsdb:
+        import_wins(Ldb(result.paths.winsdb), samba3_winsdb)
 
     # Set Account policy
     logger.info("Importing Account policy")
-- 
cgit