From 4bc577bb97ca41132e019d18ab164f44edf63972 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Wed, 30 May 2018 13:54:50 -0700 Subject: [PATCH] When checking for evidence of installation when evaluating a managed_uninstall, do not be fooled by an empty installs array. --- .../munkilib/updatecheck/installationstate.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/code/client/munkilib/updatecheck/installationstate.py b/code/client/munkilib/updatecheck/installationstate.py index 2c5acba7..de0eadef 100644 --- a/code/client/munkilib/updatecheck/installationstate.py +++ b/code/client/munkilib/updatecheck/installationstate.py @@ -264,17 +264,18 @@ def evidence_this_is_installed(item_pl): item_pl.get('uninstall_method') != 'removepackages'): display.display_debug2("Checking 'installs' items...") installitems = item_pl['installs'] - foundallinstallitems = True - for item in installitems: - if 'path' in item: - # we can only check by path; if the item has been moved - # we're not clever enough to find it, and our removal - # methods are currently even less clever - if not os.path.exists(item['path']): - # this item isn't on disk - display.display_debug2( - '%s not found on disk.', item['path']) - foundallinstallitems = False + if installitems: + foundallinstallitems = True + for item in installitems: + if 'path' in item: + # we can only check by path; if the item has been moved + # we're not clever enough to find it, and our removal + # methods are currently even less clever + if not os.path.exists(item['path']): + # this item isn't on disk + display.display_debug2( + '%s not found on disk.', item['path']) + foundallinstallitems = False if (foundallinstallitems and item_pl.get('uninstall_method') != 'removepackages'): return True