Blob Blame History Raw
From c10e375b7832d2179ef9e43f3f4fadf468ffe503 Mon Sep 17 00:00:00 2001
From: Petr Oros <poros@redhat.com>
Date: Tue, 4 Feb 2014 07:09:28 +0100
Subject: [PATCH 06/15] CLI: fix traceback when -p is used with unsupported
 value

CLI: fix traceback when -p is used with unsupported value
$ tuna -t 4364 -p fif
Traceback (most recent call last):
  File "/usr/bin/tuna", line 647, in <module>
    main()
  File "/usr/bin/tuna", line 531, in main
    tuna.threads_set_priority(thread_list, a, affect_children)
  File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 502, in threads_set_priority
    rtprio = int(parms[0])
ValueError: invalid literal for int() with base 10: 'fif'

Signed-off-by: Petr Oros <poros@redhat.com>
Tested-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/tuna.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tuna/tuna.py b/tuna/tuna.py
index 0feb521fc5eb..49c9eabdf499 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -498,8 +498,11 @@ def threads_set_priority(tids, parm, affect_children = False):
 			rtprio = int(parms[1])
 		elif parms[0].upper() in ["FIFO", "RR"]:
 			rtprio = 1
-	else:
+	elif parms[0].isdigit():
 		rtprio = int(parms[0])
+	else:
+		print "tuna: " + _("\"%s\" is unsupported priority value!") % parms[0]
+		return
 
 	for tid in tids:
 		try:
-- 
1.8.3.1