After a successful removal, remove the itemname from the SelfServeManifest's managed_uninstalls list if applicable.

git-svn-id: http://munki.googlecode.com/svn/trunk@707 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-09-01 22:13:40 +00:00
parent 5863306955
commit 929ae48a67
+22
View File
@@ -771,6 +771,7 @@ def processRemovals(removallist):
munkicommon.log(success_msg, "Install.log")
munkicommon.report[
'RemovalResults'].append(success_msg)
removeItemFromSelfServeUninstallList(item.get('name'))
else:
failure_msg = "Removal of %s: " % name + \
" FAILED with return code: %s" % retcode
@@ -781,6 +782,27 @@ def processRemovals(removallist):
return restartFlag
def removeItemFromSelfServeUninstallList(itemname):
ManagedInstallDir = munkicommon.pref('ManagedInstallDir')
selfservemanifest = os.path.join(ManagedInstallDir, "manifests",
"SelfServeManifest")
if os.path.exists(selfservemanifest):
# if item_name is in the managed_uninstalls in the self-serve
# manifest, we should remove it from the list
try:
plist = FoundationPlist.readPlist(selfservemanifest)
except FoundationPlist.FoundationPlistException:
pass
else:
plist['managed_uninstalls'] = \
[item for item in plist.get('managed_uninstalls',[])
if item != itemname]
try:
FoundationPlist.writePlist(plist, selfservemanifest)
except FoundationPlist.FoundationPlistException:
pass
def run():
'''Runs the install/removal session'''
managedinstallbase = munkicommon.pref('ManagedInstallDir')