[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.52-50-g1ca8406

Andreas Beckmann anbe at debian.org
Sat Jun 1 13:43:16 UTC 2013


The following commit has been merged in the develop branch:
commit 35154e1af2de1d727df390e87fa50b45b14181dc
Author: Andreas Beckmann <anbe at debian.org>
Date:   Fri May 31 16:34:28 2013 +0200

    p: allow check_for_no_processes() to be non-fatal
    
    the very first (before any installation) and the very last (after restoring
    the package list to the reference) test for running processes should
    always fail if something is found
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/piuparts.py b/piuparts.py
index 3f17e32..87e84e5 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1435,15 +1435,16 @@ class Chroot:
         return vdict
 
 
-    def check_for_no_processes(self):
+    def check_for_no_processes(self, fail=True):
         """Check there are no processes running inside the chroot."""
         (status, output) = run(["lsof", "-w", "+D", self.name], ignore_errors=True)
         count = len(output.split("\n")) - 1
         if count > 0:
-            logging.error("FAIL: Processes are running inside chroot:\n%s" %
-                          indent_string(output))
-            self.terminate_running_processes()
-            panic()
+            logging.error("%s: Processes are running inside chroot:\n%s" %
+                          ("FAIL" if fail else "WARN", indent_string(output)))
+            if fail:
+                self.terminate_running_processes()
+                panic()
 
 
     def terminate_running_processes(self):
@@ -2233,6 +2234,9 @@ def install_purge_test(chroot, chroot_state, package_files, packages, extra_pack
 
     chroot.enable_testdebs_repo()
 
+    chroot.check_for_no_processes(fail=True)
+    chroot.check_for_broken_symlinks()
+
     chroot.run_scripts("pre_install")
 
     chroot.install_packages([], extra_packages, with_scripts=False)
@@ -2325,7 +2329,7 @@ def install_purge_test(chroot, chroot_state, package_files, packages, extra_pack
     # Remove all packages from the chroot that weren't there initially.
     chroot.restore_selections(chroot_state["selections"], packages)
 
-    chroot.check_for_no_processes()
+    chroot.check_for_no_processes(fail=True)
     chroot.check_for_broken_symlinks()
 
     return check_results(chroot, chroot_state, file_owners, deps_info=deps_info)
@@ -2366,7 +2370,7 @@ def install_upgrade_test(chroot, chroot_state, package_files, packages, old_pack
     # Remove all packages from the chroot that weren't there initially.
     chroot.restore_selections(chroot_state["selections"], packages)
 
-    chroot.check_for_no_processes()
+    chroot.check_for_no_processes(fail=True)
     chroot.check_for_broken_symlinks()
 
     return check_results(chroot, chroot_state, file_owners)
@@ -2434,7 +2438,7 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
 
         chroot.upgrade_to_distros(settings.debian_distros[1:], [])
 
-        chroot.check_for_no_processes()
+        chroot.check_for_no_processes(fail=True)
 
         # set root_info and selections
         chroot_state = {}
@@ -2459,7 +2463,7 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
             chroot.remove_temp_tgz_file(temp_tgz)
             dont_do_on_panic(panic_handler_id)
 
-    chroot.check_for_no_processes()
+    chroot.check_for_no_processes(fail=True)
 
     chroot.run_scripts("pre_test")
 
@@ -2502,7 +2506,7 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
     # Remove all packages from the chroot that weren't in the reference chroot.
     chroot.restore_selections(chroot_state["selections"], packages_qualified)
 
-    chroot.check_for_no_processes()
+    chroot.check_for_no_processes(fail=True)
 
     result = check_results(chroot, chroot_state, file_owners)
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list