incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mry...@apache.org
Subject svn commit: r792252 - /incubator/tashi/trunk/src/tashi/client/tashi-client.py
Date Wed, 08 Jul 2009 18:33:16 GMT
Author: mryan3
Date: Wed Jul  8 18:33:16 2009
New Revision: 792252

URL: http://svn.apache.org/viewvc?rev=792252&view=rev
Log:
Committed from Jim Cipar's patch on tashi-dev@i.a.o:

Currently if the cluster manager returns an unknown state for hosts or
VMs, the client throws an exception in transformState.  Confusingly
(for the user), the client program does not print a list of hosts/VMs,
or an exception message; it just prints "0".  This patch for the
client translates all unknown states to the word "Unknown" so the
client can print meaningful output even when the CM is returning bad
states.

I came across this problem when I initialized the database using a
shell script, and gave all of the hosts the state value "0".


Modified:
    incubator/tashi/trunk/src/tashi/client/tashi-client.py

Modified: incubator/tashi/trunk/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/client/tashi-client.py?rev=792252&r1=792251&r2=792252&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/trunk/src/tashi/client/tashi-client.py Wed Jul  8 18:33:16 2009
@@ -319,7 +319,10 @@
 def transformState(obj):
 	if (type(obj) == Instance):
 		fetchUsers()
-		obj.state = vmStates[obj.state]
+		try:
+				obj.state = vmStates[obj.state]
+		except:
+				obj.state = 'Unknown'
 		if (obj.userId in users):
 			obj.user = users[obj.userId].name
 		else:
@@ -328,7 +331,10 @@
 		if (obj.disks[0].persistent):
 			obj.disk += ":True"
 	elif (type(obj) == Host):
-		obj.state = hostStates[obj.state]
+		try:
+			obj.state = hostStates[obj.state]
+		except:
+			obj.state = 'Unknown'
 
 def genKeys(list):
 	keys = {}



Mime
View raw message