You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by st...@apache.org on 2012/02/29 20:51:07 UTC
svn commit: r1295265 - in
/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data:
fromconfig.py getentoverride.py sql.py
Author: stroucki
Date: Wed Feb 29 20:51:07 2012
New Revision: 1295265
URL: http://svn.apache.org/viewvc?rev=1295265&view=rev
Log:
fromconfig, sql, getentoverride: enforce type on specific functions, to better catch errors
Modified:
incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/fromconfig.py
incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/getentoverride.py
incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/sql.py
Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/fromconfig.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/fromconfig.py?rev=1295265&r1=1295264&r2=1295265&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/fromconfig.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/fromconfig.py Wed Feb 29 20:51:07 2012
@@ -134,6 +134,10 @@ class FromConfig(DataInterface):
self.releaseLock(self.instanceLock)
def acquireHost(self, hostId):
+ if type(hostId) is not int:
+ self.log.exception("Argument is not of type int, but of type %s" % (type(hostId)))
+ raise TypeError
+
self.hostLock.acquire()
host = self.hosts.get(hostId, None)
if (host is None):
Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/getentoverride.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/getentoverride.py?rev=1295265&r1=1295264&r2=1295265&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/getentoverride.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/getentoverride.py Wed Feb 29 20:51:07 2012
@@ -57,6 +57,10 @@ class GetentOverride(DataInterface):
return self.baseDataObject.removeInstance(instance)
def acquireHost(self, hostId):
+ if type(hostId) is not int:
+ self.log.exception("Argument is not of type int, but of type %s" % (type(hostId)))
+ raise TypeError
+
return self.baseDataObject.acquireHost(hostId)
def releaseHost(self, host):
Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/sql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/sql.py?rev=1295265&r1=1295264&r2=1295265&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/sql.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/data/sql.py Wed Feb 29 20:51:07 2012
@@ -217,6 +217,10 @@ class SQL(DataInterface):
self.instanceLock.release()
def acquireHost(self, hostId):
+ if type(hostId) is not int:
+ self.log.exception("Argument is not of type int, but of type %s" % (type(hostId)))
+ raise TypeError
+
host = self.getHost(hostId)
self.hostLock.acquire()
self.hostLocks[host.id] = self.hostLocks.get(host.id, threading.Lock())