Changeset 4503

Show
Ignore:
Timestamp:
09/02/11 00:28:27 (8 years ago)
Author:
sportzer
Message:

Converted some common tracebacks in the softwareupdater log into one line messages.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/softwareupdater/softwareupdater.py

    r4142 r4503  
    167167    urllib.urlretrieve(serverpath+filename,destdir+filename) 
    168168    return True 
     169 
    169170  except Exception,e: 
    170     safe_log_last_exception() 
     171    # Steven: these errors are common enough that they don't merit tracebacks 
     172    if 'timed out' in str(e): 
     173      safe_log('Retrieve timed out') 
     174    elif 'Name or service not known' in str(e): 
     175      safe_log('[Error] Name or service not known') 
     176    elif 'Temporary failure in name resolution' in str(e): 
     177      safe_log('[Error] Temporary failure in name resolution') 
     178    else: 
     179      safe_log_last_exception() 
     180 
    171181    safe_log('[safe_download] Failed to download ' + serverpath + filename) 
    172182    return False 
     
    246256 
    247257  # get the metainfo (like a directory listing) 
    248   safe_download(serverpath, "metainfo", tempdir, 1024*32) 
     258  metainfo_downloaded = safe_download(serverpath, "metainfo", tempdir, 1024*32) 
     259 
     260  # if downloading the new metainfo failed, then we can't really do anything 
     261  if not metainfo_downloaded: 
     262    safe_log("[do_rsync] Failed to download metainfo. Not updating.") 
     263    return [] 
    249264 
    250265  # read the file data into a string 
     
    263278    oldmetafiledata = oldmetafileobject.read() 
    264279    oldmetafileobject.close() 
    265   except: 
     280  except Exception: 
    266281    # The old file has problems.   We'll use the new one since it's signed 
    267282    pass 
     
    271286      # Armon: Update our time via NTP, before we check the meta info 
    272287      time_updatetime(TIME_PORT) 
    273     except: 
    274       time_updatetime(TIME_PORT_2) 
     288    except Exception: 
     289      try: 
     290        time_updatetime(TIME_PORT_2) 
     291      except Exception: 
     292        # Steven: Sometimes we can't successfully update our time, so this is 
     293        # better than generating a traceback. 
     294        safe_log("[do_rsync] Unable to update ntp time. Not updating.") 
     295        return [] 
    275296     
    276297    # they're both good.   Let's compare them...