Changeset 13985 in genesis for tools


Ignore:
Timestamp:
Sep 22, 2017, 6:32:52 PM (7 years ago)
Author:
www
Message:

Fix error print statements handled as headers when updating with an error.

This quirck is to make the code somehow more object consistent, we also could have moved the header statement, yet that is no fun...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r13984 r13985  
    5050import textwrap
    5151import time
     52import traceback
    5253import urlparse
    5354
     
    237238            datadump[key]['autogen_iface'] = '_'.join(key.split('_')[1:])
    238239
    239     except Exception:
    240       print "# Error while processing interface %s" % key
     240    except Exception as exc:
     241      exc.args = ("# Error while processing interface %s" % key,) + exc.args
    241242      raise
    242243
     
    250251    datadump['autogen_fqdn'] = datadump['nodename'] + '.' + datadump['autogen_domain']
    251252    datadump_cache[item] = datadump.copy()
    252   except Exception:
    253     print "# Error while processing %s" % item
     253  except Exception as exc:
     254    exc.args = ("# Error while processing %s" % item,) + exc.args
    254255    raise
    255256  return datadump
     
    13811382          output += "  %-11s: %s\n" % (key, format_yaml_value(datadump[iface_key][key]))
    13821383      output += "\n\n"
    1383     except Exception:
    1384       print "# Error while processing interface %s" % iface_key
     1384    except Exception as exc:
     1385      exc.args = ("# Error while processing interface %s" % iface_key,) + exc.args
    13851386      raise
    13861387
     
    14941495    output += subprocess.Popen([SVN, 'cleanup', "%s/.." % NODE_DIR], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0]
    14951496    output += subprocess.Popen([SVN, 'up', "%s/.." % NODE_DIR], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0]
    1496     generate_static(CACHE_DIR, False)
     1497    try:
     1498        generate_static(CACHE_DIR, False)
     1499    except:
     1500        output += traceback.format_exc()
     1501        pass
    14971502    output += "[INFO] All done, redirecting in 5 seconds"
    14981503    response_headers += [
     
    22672272                datadump['monitoring_group'] = 'wleiden'
    22682273
    2269             except Exception:
    2270               print "# Error while processing interface %s" % iface_key
     2274            except Exception as exc:
     2275              exc.args = ("# Error while processing interface %s" % iface_key,) + exc.args
    22712276              raise
    22722277          store_yaml(datadump)
    2273         except Exception:
    2274           print "# Error while processing %s" % host
     2278        except Exception as exc:
     2279          exc.args = ("# Error while processing %s" % host,) + exc.args
    22752280          raise
    22762281    elif sys.argv[1] == "list":
Note: See TracChangeset for help on using the changeset viewer.