[tor-commits] [thandy/master] Add logCtrl for scripts that might fail from a thp

nickm at torproject.org nickm at torproject.org
Wed Nov 9 16:41:28 UTC 2011


commit d2f814426fc5bae6315daea3feb8a3f8a2a9efd5
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Sat Nov 5 14:54:57 2011 -0300

    Add logCtrl for scripts that might fail from a thp
---
 lib/thandy/packagesys/ThpPackages.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/thandy/packagesys/ThpPackages.py b/lib/thandy/packagesys/ThpPackages.py
index f82415e..4745767 100644
--- a/lib/thandy/packagesys/ThpPackages.py
+++ b/lib/thandy/packagesys/ThpPackages.py
@@ -16,6 +16,8 @@ import thandy.formats
 import thandy.packagesys.PackageSystem as PS
 import thandy.packagesys.PackageDB as PDB
 
+from thandy.util import logCtrl
+
 json = thandy.util.importJSON()
 
 class ThpDB(object):
@@ -184,15 +186,18 @@ class ThpTransaction(PS.Transaction):
             for pkg in order:
                 if pkg.run('checkinst') != 0:
                     logging.info("Check inst failed for %s" % pkg)
+                    logCtrl("ERROR", SCRIPT="checkinst")
                     sys.exit(1)
             for pkg in order:
                 logging.info("Starting installation using %s" % pkg)
                 if pkg.run('preinst') != 0:
                     logging.info("Preinst script for %s failed" % pkg)
+                    logCtrl("ERROR", SCRIPT="preinst")
                     sys.exit(1)
                 pkg.install()
                 if pkg.run('postinst') != 0:
                     logging.info("postinst script failed")
+                    logCtrl("ERROR", SCRIPT="postinst")
         except AlreadyLocked:
             print "You can't run more than one instance of Thandy"
         except LockFailed:





More information about the tor-commits mailing list