mirror of
https://github.com/munki/munki.git
synced 2026-04-24 05:49:42 -05:00
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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user