If InstallInfo.plist is corrupt, delete it and move on instead of crashing indefinitely.

This commit is contained in:
Justin McWilliams
2012-01-18 14:34:59 -05:00
parent 73b2155117
commit 896bd9a80c
+12 -1
View File
@@ -3151,10 +3151,21 @@ def check(client_id='', localmanifestpath=None):
installinfochanged = True
installinfopath = os.path.join(ManagedInstallDir, 'InstallInfo.plist')
if os.path.exists(installinfopath):
oldinstallinfo = FoundationPlist.readPlist(installinfopath)
try:
oldinstallinfo = FoundationPlist.readPlist(installinfopath)
except FoundationPlist.NSPropertyListSerializationException:
oldinstallinfo = None
munkicommon.display_error(
'Could not read InstallInfo.plist. Deleting...')
try:
os.unlink(installinfopath)
except OSError, e:
munkicommon.display_error(
'Failed to delete InstallInfo.plist: %s', str(e))
if oldinstallinfo == installinfo:
installinfochanged = False
munkicommon.display_detail('No change in InstallInfo.')
if installinfochanged:
FoundationPlist.writePlist(installinfo,
os.path.join(ManagedInstallDir,