mirror of
https://github.com/munki/munki.git
synced 2026-04-23 21:40:25 -05:00
Smarter handling of malformed Info.plists in packages. Instead of throwing an exception, return pkginfo describing the problem.
git-svn-id: http://munki.googlecode.com/svn/trunk@243 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -508,22 +508,26 @@ def getOnePackageInfo(pkgpath):
|
||||
plistpath = os.path.join(pkgpath, "Contents", "Info.plist")
|
||||
if os.path.exists(plistpath):
|
||||
pkginfo['filename'] = os.path.basename(pkgpath)
|
||||
pl = FoundationPlist.readPlist(plistpath)
|
||||
if "CFBundleIdentifier" in pl:
|
||||
pkginfo['packageid'] = pl["CFBundleIdentifier"]
|
||||
elif "Bundle identifier" in pl:
|
||||
# special case for JAMF Composer generated packages. WTF?
|
||||
pkginfo['packageid'] = pl["Bundle identifier"]
|
||||
else:
|
||||
pkginfo['packageid'] = os.path.basename(pkgpath)
|
||||
try:
|
||||
pl = FoundationPlist.readPlist(plistpath)
|
||||
if "CFBundleIdentifier" in pl:
|
||||
pkginfo['packageid'] = pl["CFBundleIdentifier"]
|
||||
elif "Bundle identifier" in pl:
|
||||
# special case for JAMF Composer generated packages. WTF?
|
||||
pkginfo['packageid'] = pl["Bundle identifier"]
|
||||
else:
|
||||
pkginfo['packageid'] = os.path.basename(pkgpath)
|
||||
|
||||
if "CFBundleName" in pl:
|
||||
pkginfo['name'] = pl["CFBundleName"]
|
||||
if "CFBundleName" in pl:
|
||||
pkginfo['name'] = pl["CFBundleName"]
|
||||
|
||||
if "IFPkgFlagInstalledSize" in pl:
|
||||
pkginfo['installed_size'] = pl["IFPkgFlagInstalledSize"]
|
||||
if "IFPkgFlagInstalledSize" in pl:
|
||||
pkginfo['installed_size'] = pl["IFPkgFlagInstalledSize"]
|
||||
|
||||
pkginfo['version'] = getExtendedVersion(pkgpath)
|
||||
pkginfo['version'] = getExtendedVersion(pkgpath)
|
||||
except:
|
||||
pkginfo['packageid'] = "BAD PLIST in %s" % os.path.basename(pkgpath)
|
||||
pkginfo['version'] = "0.0.0.0.0"
|
||||
return pkginfo
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user