summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-06-15 15:20:06 +0400
committerMatthieu Patou <mat@samba.org>2011-06-19 23:21:08 +0200
commit12b379e9831131c251fde3ebebb76b00323f6bf0 (patch)
tree301b9e46a47d08941d256e12263127ae5cbc7278 /source4/scripting/python
parent5e81ee8b341c3c6a6f9a321ec6ddf9b29932b683 (diff)
downloadsamba-12b379e9831131c251fde3ebebb76b00323f6bf0.tar.gz
samba-12b379e9831131c251fde3ebebb76b00323f6bf0.tar.bz2
samba-12b379e9831131c251fde3ebebb76b00323f6bf0.zip
s4-upgradeprovision: handle the fact that oEMInformation might not be present
Diffstat (limited to 'source4/scripting/python')
-rwxr-xr-xsource4/scripting/python/samba/upgradehelpers.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py
index baba332c23..47ea660e43 100755
--- a/source4/scripting/python/samba/upgradehelpers.py
+++ b/source4/scripting/python/samba/upgradehelpers.py
@@ -548,7 +548,7 @@ def getOEMInfo(samdb, rootdn):
"""
res = samdb.search(expression="(objectClass=*)", base=str(rootdn),
scope=SCOPE_BASE, attrs=["dn", "oEMInformation"])
- if len(res) > 0:
+ if len(res) > 0 and res[0].get("oEMInformation"):
info = res[0]["oEMInformation"]
return info
else:
@@ -565,7 +565,10 @@ def updateOEMInfo(samdb, rootdn):
res = samdb.search(expression="(objectClass=*)", base=rootdn,
scope=SCOPE_BASE, attrs=["dn", "oEMInformation"])
if len(res) > 0:
- info = res[0]["oEMInformation"]
+ if res[0].get("oEMInformation"):
+ info = str(res[0]["oEMInformation"])
+ else:
+ info = ""
info = "%s, upgrade to %s" % (info, version)
delta = ldb.Message()
delta.dn = ldb.Dn(samdb, str(res[0]["dn"]))