diff --git a/code/client/munkilib/appleupdates.py b/code/client/munkilib/appleupdates.py index b82ee520..526c4a83 100644 --- a/code/client/munkilib/appleupdates.py +++ b/code/client/munkilib/appleupdates.py @@ -120,7 +120,7 @@ class AppleUpdates(object): def __init__(self): self._managed_install_dir = munkicommon.pref('ManagedInstallDir') - + real_cache_dir = os.path.join(self._managed_install_dir, 'swupd') if os.path.exists(real_cache_dir): if not os.path.isdir(real_cache_dir): @@ -139,15 +139,15 @@ class AppleUpdates(object): if os.path.exists(self.cache_dir): # there should not be a file or directory at that path! # move it - new_name = os.path.join('/tmp', - ('munki_swupd_cache_moved_%s' % + new_name = os.path.join('/tmp', + ('munki_swupd_cache_moved_%s' % time.strftime('%Y.%m.%d.%H.%M.%S'))) os.rename(self.cache_dir, new_name) os.symlink(real_cache_dir, self.cache_dir) except (OSError, IOError), err: # error in setting up the cache directories raise Error('Could not configure cache directory: %s' % err) - + self.temp_cache_dir = os.path.join(self.cache_dir, 'mirror') self.local_catalog_dir = os.path.join( self.cache_dir, LOCAL_CATALOG_DIR_REL_PATH) @@ -391,7 +391,7 @@ class AppleUpdates(object): return list_of_localizations[0] def GetDistributionForProductKey(self, product_key): - '''Returns the path to a distibution file from the local cache for the + '''Returns the path to a distibution file from the local cache for the given product_key.''' try: catalog = FoundationPlist.readPlist(self.local_catalog_path) @@ -421,7 +421,7 @@ class AppleUpdates(object): try: dom = minidom.parse(distfile) - except expat.ExpatError: + except (expat.ExpatError, IOError): return [] must_close_app_ids = [] @@ -1124,7 +1124,7 @@ class AppleUpdates(object): last_result_code = self.GetSoftwareUpdatePref('LastResultCode') or 0 if last_result_code > 2: retcode = last_result_code - + if results['failures']: return 1