My team is working with an operating system that doesn't support runlevel,
so I'd like to wrap that in a try block.

-- 
K.D. Lucas
[email protected]
Index: client/common_lib/hosts/base_classes.py
===================================================================
--- client/common_lib/hosts/base_classes.py	(revision 4241)
+++ client/common_lib/hosts/base_classes.py	(working copy)
@@ -137,8 +137,12 @@
 
     def is_shutting_down(self):
         """ Indicates is a machine is currently shutting down. """
-        runlevel = int(self.run("runlevel").stdout.strip().split()[1])
-        return runlevel in (0, 6)
+        # runlevel() may not be available, so wrap it in try block.
+        try:
+            runlevel = int(self.run("runlevel").stdout.strip().split()[1])
+            return runlevel in (0, 6)
+        except:
+            return False
 
 
     def get_wait_up_processes(self):
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to