incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1351880 [3/3] - in /incubator/tashi/branches/luke-zoni-staging: ./ doc/ etc/ src/tashi/ src/tashi/accounting/ src/tashi/agents/ src/tashi/client/ src/tashi/clustermanager/ src/tashi/clustermanager/data/ src/tashi/dfs/ src/tashi/messaging/ ...
Date Tue, 19 Jun 2012 22:05:54 GMT
Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/client/zoni-cli.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/client/zoni-cli.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/client/zoni-cli.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/client/zoni-cli.py Tue Jun 19 22:05:52 2012
@@ -20,43 +20,36 @@
 #
 #  $Id$
 #
-import os
-import sys
+
 import optparse
 import socket
 import logging.config
 import getpass
+import os
+import sys
 import re
+import string
 import subprocess
 
-
-
 #from zoni import *
 #from zoni.data.resourcequerysql import ResourceQuerySql
-import zoni
-from zoni.data.resourcequerysql import *
+#import zoni
+#from zoni.data.resourcequerysql import *
 
-from zoni.data.usermanagementinterface import UserManagementInterface
-from zoni.data.usermanagementinterface import UserManagementInterface
-
-from zoni.bootstrap.bootstrapinterface import BootStrapInterface
 from zoni.bootstrap.pxe import Pxe
 
-from zoni.hardware.systemmanagementinterface import SystemManagementInterface
 from zoni.hardware.ipmi import Ipmi
-from zoni.hardware.hwswitchinterface import HwSwitchInterface
 from zoni.hardware.dellswitch import HwDellSwitch
 from zoni.hardware.raritanpdu import raritanDominionPx
 from zoni.hardware.delldrac import dellDrac
+import zoni.hardware.systemmanagement
+from zoni.data import usermanagement
 from zoni.agents.dhcpdns import DhcpDns
 
-from zoni.hardware.systemmanagement import SystemManagement
-
-
-from zoni.extra.util import * 
-from zoni.version import *
+from zoni.extra.util import validIp, validMac 
+from zoni.version import version, revision
 
-from tashi.util import instantiateImplementation, signalHandler
+from tashi.util import instantiateImplementation, getConfig
 #import zoni.data.usermanagement 
 #from usermanagement import UserManagement
 
@@ -74,7 +67,7 @@ def main():
 	(configs, configFiles) = getConfig()
 
 	logging.config.fileConfig(configFiles)
-	log = logging.getLogger(os.path.basename(__file__))
+	#log = logging.getLogger(os.path.basename(__file__))
 	#logit(configs['logFile'], "Starting Zoni client")
 	#logit(configs['logFile'], "Loading config file")
 
@@ -359,11 +352,11 @@ def main():
 	if (options.nodeName):
 		cmdargs["sys_id"] = options.nodeName
 
-	if 	(options.numCores or options.clockSpeed or options.numMemory or options.numProcs or options.cpuFlags) and not options.showResources:
-			usage = "MISSING OPTION: When specifying hardware parameters, you need the -s or --showResources switch"
-			print usage
-			parser.print_help()	
-			exit()
+	if (options.numCores or options.clockSpeed or options.numMemory or options.numProcs or options.cpuFlags) and not options.showResources:
+		usage = "MISSING OPTION: When specifying hardware parameters, you need the -s or --showResources switch"
+		print usage
+		parser.print_help()	
+		exit()
 
 	if options.getResources:
 		print "ALL resources"
@@ -464,7 +457,7 @@ def main():
 			userId = usermgt.getUserId(options.userName)
 
 		if userId:
-			reservationId = reservation.createReservation(userId, options.reservationDuration, options.myNotes + " " + str(string.join(args[0:len(args)])))
+			__reservationId = reservation.createReservation(userId, options.reservationDuration, options.myNotes + " " + str(string.join(args[0:len(args)])))
 
 		else:
 			print "user doesn't exist"
@@ -771,7 +764,7 @@ def main():
 				try:
 					socket.gethostbyname(hostName)
 					sys.stdout.write("[Success]\n")
-				except Exception, e:
+				except Exception:
 					sys.stdout.write("[Fail]\n")
 			else:
 				mesg = "ERROR:  Malformed IP Address\n"
@@ -794,7 +787,7 @@ def main():
 				try:
 					socket.gethostbyname(hostName)
 					sys.stdout.write("[Fail]\n")
-				except Exception, e:
+				except Exception:
 					sys.stdout.write("[Success]\n")
 			if options.removeDhcp:	
 				dhcpdns.removeDhcp(hostName)

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/infostore.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/infostore.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/infostore.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/infostore.py Tue Jun 19 22:05:52 2012
@@ -18,10 +18,6 @@
 #  $Id$
 #
 
-import sys
-import os 
-import optparse
-
 
 class InfoStore (object):
 	"""  Interface description for query system resources

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservation.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservation.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservation.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservation.py Tue Jun 19 22:05:52 2012
@@ -18,7 +18,6 @@
 #  $Id:$ 
 #
 
-import sys
 import os 
 import string
 import logging
@@ -88,9 +87,9 @@ class reservationMysql(ReservationManage
 	def delReservation (self, userId):
 		raise NotImplementedError
 	
-	def defineReservation():
+	def defineReservation(self):
 		raise NotImplementedError
 
-	def showReservation():
+	def showReservation(self):
 		raise NotImplementedError
 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservationmanagementinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservationmanagementinterface.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservationmanagementinterface.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/reservationmanagementinterface.py Tue Jun 19 22:05:52 2012
@@ -18,9 +18,6 @@
 #  $Id:$
 #
 
-import sys
-import os 
-
 
 class ReservationManagementInterface(object):
 	"""  Interface description for reservation management
@@ -50,9 +47,9 @@ class ReservationManagementInterface(obj
 	def delReservation (self, userId):
 		raise NotImplementedError
 	
-	def defineReservation():
+	def defineReservation(self):
 		raise NotImplementedError
 
-	def showReservation():
+	def showReservation(self):
 		raise NotImplementedError
 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/resourcequerysql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/resourcequerysql.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/resourcequerysql.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/resourcequerysql.py Tue Jun 19 22:05:52 2012
@@ -22,16 +22,13 @@ import os 
 import sys
 import string
 import MySQLdb
-import subprocess
 import traceback
 import logging
-import threading
 import time
 
 import usermanagement
 from zoni.data.infostore import InfoStore
-from zoni.extra.util import checkSuper, createKey
-from zoni.agents.dhcpdns import DhcpDns
+from zoni.extra.util import createKey
 
 class ResourceQuerySql(InfoStore):
 	def __init__(self, config, verbose=None):
@@ -80,7 +77,7 @@ class ResourceQuerySql(InfoStore):
 		vlans = []
 		for val in vlanInfo.split(","):
 			try:
-				ret = self.getVlanId(val.split(":")[0])
+				__ret = self.getVlanId(val.split(":")[0])
 				vlans.append(val)
 			except Exception, e:
 				print e
@@ -96,7 +93,7 @@ class ResourceQuerySql(InfoStore):
 		domainKey = createKey(name)
 		query = "insert into domaininfo (domain_name, domain_desc, domain_key) values ('%s','%s', '%s')" % (name, desc, domainKey)
 		try:
-			result = self.insertDb(query)
+			__result = self.insertDb(query)
 			mesg = "Adding domain %s(%s)" % (name, desc)
 			self.log.info(mesg)
 		except Exception, e:
@@ -112,7 +109,7 @@ class ResourceQuerySql(InfoStore):
 			vlanType = i.split(":")[1]
 			query = "insert into domainmembermap values (%d, %d, '%s')" % (domainId, vlanId, vlanType)
 			try:
-				result = self.insertDb(query)
+				__result = self.insertDb(query)
 			except Exception, e:
 				print e
 		
@@ -133,16 +130,16 @@ class ResourceQuerySql(InfoStore):
 		mesg = "Removing domain %s" % (name)
 		self.log.info(mesg)
 		query = "delete from domaininfo where domain_name = '%s'" % (name)
-		result = self.__deleteDb(query)
+		__result = self.__deleteDb(query)
 		#  Need to remove any vlans attached to this domain
 		query = "delete from domainmembermap where domain_id = '%s'" % (domainId)
-		result = self.__deleteDb(query)
+		__result = self.__deleteDb(query)
 
 	def showDomains(self):
 		usermgt = eval("usermanagement.%s" % (self.config['userManagement']) + "()")
 		query = "select r.reservation_id, r.user_id, d.domain_name, d.domain_desc from domaininfo d, allocationinfo a, reservationinfo r where d.domain_id = a.domain_id and a.reservation_id = r.reservation_id"
 		result = self.selectDb(query)
-		desc = result.description
+		#desc = result.description
 		if result.rowcount > 0:
 			print "%s\t%s\t%s\t%s" % (result.description[0][0], result.description[1][0], result.description[2][0], result.description[3][0])
 			print "------------------------------------------------------------"
@@ -173,7 +170,7 @@ class ResourceQuerySql(InfoStore):
 			return -1
 		query = "insert into vlaninfo (vlan_num, vlan_desc) values ('%s','%s')" % (vnumber, desc)
 		try:
-			result = self.insertDb(query)
+			__result = self.insertDb(query)
 			mesg = "Adding vlan %s(%s)" % (vnumber, desc)
 			self.log.info(mesg)
 		except Exception, e:
@@ -290,8 +287,6 @@ class ResourceQuerySql(InfoStore):
 		
 
 	def showResources(self, cmdargs):
-
-		queryopt = ""
 		defaultFields = "mac_addr, location, num_procs, num_cores, clock_speed, mem_total "
 		#defaultFields = "*"
 		
@@ -315,20 +310,21 @@ class ResourceQuerySql(InfoStore):
 		#  header
 		print line
 
-		sum = {}
+		_sum = {}
 		for row in result.fetchall():
 			line = ""
-			sum['totProc'] = sum.get('totProc', 0)
-			sum['totProc'] += int(row[2])
-			sum['totCores'] = sum.get('totCores', 0)
-			sum['totCores'] += int(row[3])
-			sum['totMemory'] = sum.get('totMemory', 0)
-			sum['totMemory'] += int(row[5])
+			_sum['totProc'] = _sum.get('totProc', 0)
+			_sum['totProc'] += int(row[2])
+			_sum['totCores'] = _sum.get('totCores', 0)
+			_sum['totCores'] += int(row[3])
+			_sum['totMemory'] = _sum.get('totMemory', 0)
+			_sum['totMemory'] += int(row[5])
 			for val in row:
 				line += str(val).center(20)
 			
 			print line
-		print "\n%s systems registered -  %d procs | %d cores | %d bytes RAM" % (str(result.rowcount), sum['totProc'], sum['totCores'], sum['totMemory'],)
+		print "\n%s systems registered -  %d procs | %d cores | %d bytes RAM" % \
+			(str(result.rowcount), _sum['totProc'], _sum['totCores'], _sum['totMemory'],)
 
 	def getAvailableResources(self):
 		#  Maybe should add a status flag?
@@ -513,7 +509,7 @@ class ResourceQuerySql(InfoStore):
 		result = self.selectDb(query)
 		
 		print "NODE ALLOCATION\n"
-		sum = {}
+		_sum = {}
 		if self.verbose:
 			print "%-5s%-10s%-10s%-10s%-13s%-12s%-10s%-34s%-20s%s" % ("Res", "User", "Host", "Domain", "Cores/Mem","Expiration", "Hostname", "Boot Image Name", "Vlan Member", "Notes")
 		else:
@@ -538,10 +534,10 @@ class ResourceQuerySql(InfoStore):
 			allocation_id = i[11]
 			userName = usermgt.getUserName(uid)
 			combined_notes = str(rnotes) + "|" + str(anotes)
-			sum['totCores'] = sum.get('totCores', 0)
-			sum['totCores'] += cores
-			sum['totMemory'] = sum.get('totMemory', 0)
-			sum['totMemory'] += memory
+			_sum['totCores'] = _sum.get('totCores', 0)
+			_sum['totCores'] += cores
+			_sum['totMemory'] = _sum.get('totMemory', 0)
+			_sum['totMemory'] += memory
 			if self.verbose:
 				query = "select v.vlan_num, m.vlan_type from vlaninfo v, vlanmembermap m where v.vlan_id = m.vlan_id and allocation_id = '%d' order by vlan_num asc" % allocation_id
 				vlanRes = self.selectDb(query)
@@ -555,7 +551,7 @@ class ResourceQuerySql(InfoStore):
 				print "%-5s%-10s%-10s%-10s%-2s/%-10s%-12s%-10s%-34s%-20s%s" % (resId, userName, host, domain, cores, memory,expire, hostname, image_name, vlanMember,combined_notes)
 			else:
 				print "%-10s%-10s%-10s%-2s/%-10s%-12s%s" % (userName, host, domain, cores, memory,expire, combined_notes)
-		print "\n%s systems allocated - %d cores| %d bytes RAM" % (str(result.rowcount), sum['totCores'], sum['totMemory'])
+		print "\n%s systems allocated - %d cores| %d bytes RAM" % (str(result.rowcount), _sum['totCores'], _sum['totMemory'])
 
 	def showReservation(self, userId=None):
 		#from IPython.Shell import IPShellEmbed
@@ -617,7 +613,7 @@ class ResourceQuerySql(InfoStore):
 		query = "select image_name from imageinfo"
 		result = self.selectDb(query)
 		row = result.fetchall()
-		desc = result.description
+		#desc = result.description
 
 		imagelist = []
 		for i in row:
@@ -630,7 +626,7 @@ class ResourceQuerySql(InfoStore):
 		query = "select image_name, dist, dist_ver  from imageinfo"
 		result = self.selectDb(query)
 		row = result.fetchall()
-		desc = result.description
+		#desc = result.description
 
 		for i in row:
 			print i
@@ -805,7 +801,7 @@ class ResourceQuerySql(InfoStore):
 			cursor.execute (query)
 			self.conn.commit()
 			row = cursor.fetchall()
-			desc = cursor.description
+			#desc = cursor.description
 		except MySQLdb.OperationalError, e:
 			msg = "%s : %s" % (e[1], query)
 			self.log.error(msg)
@@ -886,12 +882,12 @@ class ResourceQuerySql(InfoStore):
 		return cursor
 
 
-	def updateReservation (self, reservationId, userId=None, reservationDuration=None, vlanIsolate=None, allocationNotes=None):
+	def updateReservation (self, reservationId, userId=None, resDuration=None, vlanIsolate=None, allocationNotes=None):
 
 		mesg = "Updating reservation %s" % (str(reservationId))
 		self.log.info(mesg)
 
-		if reservationDuration:
+		if resDuration:
 			if len(resDuration) == 8:
 				expireDate = resDuration
 			elif len(resDuration) < 4:
@@ -906,7 +902,7 @@ class ResourceQuerySql(InfoStore):
 
 			mesg = "Updating reservationDuration :" + resDuration
 			self.log.info(mesg)
-			query = "update reservationinfo set reservation_exiration = \"" + expireDate_ + "\" where reservation_id = \"" + str(reservationId) + "\""
+			query = "update reservationinfo set reservation_expiration = \"" + expireDate + "\" where reservation_id = \"" + str(reservationId) + "\""
 			self.__updateDb(query)
 
 		if allocationNotes:
@@ -1062,7 +1058,7 @@ class ResourceQuerySql(InfoStore):
 		vId = self.getVlanId(v)
 		query = "delete from vlanmembermap where allocation_id = '%s' and vlan_id = '%s'" % (allocationId, vId)
 
-		result = self.insertDb(query)
+		__result = self.insertDb(query)
 		mesg = "Removing vlan %s from node %s" % (v, nodeName)
 		self.log.info(mesg)
 
@@ -1153,7 +1149,7 @@ class ResourceQuerySql(InfoStore):
 		#  imagemap db should be sys_id instead of mac_addr
 		#  change later
 
-		cur_image = host['pxe_image_name']
+		#cur_image = host['pxe_image_name']
 		#  Get the id of the new image
 		query = "select image_id from imageinfo where image_name = " + "\"" + image + "\""
 		row = self.__queryDb(query)
@@ -1234,7 +1230,7 @@ class ResourceQuerySql(InfoStore):
 		return cap
 
 	#  print out data in a consistent format
-	def __showIt(data):
+	def __showIt(self, data):
 		pass
 
 	

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagement.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagement.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagement.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagement.py Tue Jun 19 22:05:52 2012
@@ -18,7 +18,6 @@
 #  $Id$
 #
 
-import sys
 import os 
 
 from usermanagementinterface import UserManagementInterface

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagementinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagementinterface.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagementinterface.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/data/usermanagementinterface.py Tue Jun 19 22:05:52 2012
@@ -18,9 +18,6 @@
 #  $Id$
 #
 
-import sys
-import os 
-
 
 class UserManagementInterface(object):
 	"""  Interface description for user management

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/extra/util.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/extra/util.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/extra/util.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/extra/util.py Tue Jun 19 22:05:52 2012
@@ -19,6 +19,7 @@
 #
 
 import os
+import sys
 import string
 import ConfigParser
 import time
@@ -26,7 +27,6 @@ import shutil
 import re
 import threading
 import subprocess
-import logging
 
 def loadConfigFile(parser):
 	#parser = ConfigParser.ConfigParser()
@@ -222,32 +222,43 @@ def createKey(name):
 	f.close()
 	return val
 	
-
-
+def __getShellFn():
+	try:
+		from IPython.Shell import IPShellEmbed
+		return (1, IPShellEmbed)
+	except ImportError:
+		import IPython
+		return (2, IPython.embed)
 
 def debugConsole(globalDict):
 	"""A debugging console that optionally uses pysh"""
 	def realDebugConsole(globalDict):
 		try :
 			import atexit
-			from IPython.Shell import IPShellEmbed
+			(calltype, shellfn) = __getShellFn()
 			def resetConsole():
 # XXXpipe: make input window sane
-				(stdin, stdout) = os.popen2("reset")
+				(__stdin, stdout) = os.popen2("reset")
 				stdout.read()
-			dbgshell = IPShellEmbed()
 			atexit.register(resetConsole)
-			dbgshell(local_ns=globalDict, global_ns=globalDict)
-		except Exception:
+			if calltype == 1:
+				dbgshell=shellfn(user_ns=globalDict)
+				dbgshell()
+			elif calltype == 2:
+				dbgshell=shellfn
+				dbgshell(user_ns=globalDict)
+		except Exception, e:
 			CONSOLE_TEXT=">>> "
-			input = " "
-			while (input != ""):
+			inputline = " " 
+			while (inputline != ""):
 				sys.stdout.write(CONSOLE_TEXT)
-				input = sys.stdin.readline()
+				inputline = sys.stdin.readline()
 				try:
-					exec(input) in globalDict
+					exec(inputline) in globalDict
 				except Exception, e:
 					sys.stdout.write(str(e) + "\n")
+
+		os._exit(0)
+
 	if (os.getenv("DEBUG", "0") == "1"):
 		threading.Thread(target=lambda: realDebugConsole(globalDict)).start()
-

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/apcswitchedrackpdu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/apcswitchedrackpdu.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/apcswitchedrackpdu.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/apcswitchedrackpdu.py Tue Jun 19 22:05:52 2012
@@ -18,8 +18,6 @@
 #  $Id$
 #
 
-import sys
-import os 
 import warnings
 warnings.filterwarnings("ignore")
 
@@ -46,7 +44,7 @@ class apcSwitchedRackPdu(SystemManagemen
 
 	def getPowerStatus(self):
 		thisoid = eval(str(self.oid_status) + "," + str(self.port))
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 0), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), thisoid)
 		output = varBinds[0][1]
@@ -81,7 +79,7 @@ class apcSwitchedRackPdu(SystemManagemen
 
 	def powerOn(self):
 		thisoid = eval(str(self.oid_status) + "," + str(self.port)) 
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().setCmd( \
+		__errorIndication, __errorStatus, __errorIndex, __varBinds = cmdgen.CommandGenerator().setCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 1), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), \
 		(thisoid, rfc1902.Integer('1')))
@@ -89,7 +87,7 @@ class apcSwitchedRackPdu(SystemManagemen
 
 	def powerOff(self):
 		thisoid = eval(str(self.oid_status) + "," + str(self.port)) 
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().setCmd( \
+		__errorIndication, __errorStatus, __errorIndex, __varBinds = cmdgen.CommandGenerator().setCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 1), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), \
 		(thisoid, rfc1902.Integer('2')))

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/delldrac.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/delldrac.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/delldrac.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/delldrac.py Tue Jun 19 22:05:52 2012
@@ -19,14 +19,13 @@
 #
 
 import sys
-import os 
 import pexpect
 import time
 import logging
 import tempfile
 
 from systemmanagementinterface import SystemManagementInterface
-from zoni.extra.util import timeF, log
+from zoni.extra.util import timeF
 
 
 class dellDrac(SystemManagementInterface):
@@ -116,19 +115,19 @@ class dellDrac(SystemManagementInterface
 			
 		child = self.__login()
 		child.logfile = fout
-		cmd = "racadm serveraction -m " +  self.server + " powerup"
+		cmd = "racadm serveraction -m %s powerup" % (self.server)
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		fout.seek(0)
-		self.log.info("Hardware power on : %s", self.hostname)
+		self.log.info("Hardware power on : %s" % self.hostname)
 		for val in fout.readlines():
 			if "OK" in val:
 				code = 1 
 			if "ALREADY POWER-ON" in val:
 				code = 1 
-				self.log.info("Hardware already powered on : %s", self.hostname)
+				self.log.info("Hardware already powered on : %s" % self.hostname)
 		if code < 1:
-			self.log.info("Hardware power on failed : %s", self.hostname)
+			self.log.info("Hardware power on failed : %s" % self.hostname)
 		fout.close()
 		child.terminate()
 		return code
@@ -139,15 +138,15 @@ class dellDrac(SystemManagementInterface
 		fout = tempfile.TemporaryFile()
 		child = self.__login()
 		child.logfile = fout
-		cmd = "racadm serveraction -m " + self.server + " powerdown"
+		cmd = "racadm serveraction -m %s powerdown" % (self.server)
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		fout.seek(0)
-		self.log.info("Hardware power off : %s", self.hostname)
+		self.log.info("Hardware power off : %s" % self.hostname)
 		for val in fout.readlines():
 			if "OK" in val:
 				code = 1
- 			if "CURRENTLY POWER-OFF" in val:
+			if "CURRENTLY POWER-OFF" in val:
 				self.log.info("Hardware already power off : %s", self.hostname)
 				code = 1
 		if code < 1:
@@ -164,14 +163,14 @@ class dellDrac(SystemManagementInterface
 		child.logfile = fout
 		cmd = "racadm serveraction -m " + self.server + " graceshutdown"
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		fout.seek(0)
 		self.log.info("Hardware power off (soft): %s", self.hostname)
 
 		for val in fout.readlines():
 			if "OK" in val:
 				code = 1
- 			if "CURRENTLY POWER-OFF" in val:
+			if "CURRENTLY POWER-OFF" in val:
 				self.log.info("Hardware already power off : %s", self.hostname)
 				code = 1
 		if code < 1:
@@ -188,7 +187,7 @@ class dellDrac(SystemManagementInterface
 		child.logfile = fout
 		cmd = "racadm serveraction -m " + self.server + " powercycle"
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		fout.seek(0)
 		self.log.info("Hardware power cycle : %s", self.hostname)
 		for val in fout.readlines():
@@ -208,7 +207,7 @@ class dellDrac(SystemManagementInterface
 		child.logfile = fout
 		cmd = "racadm serveraction -m " + self.server + " hardreset"
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		fout.seek(0)
 		for val in fout.readlines():
 			if "OK" in val:
@@ -225,5 +224,5 @@ class dellDrac(SystemManagementInterface
 		child = self.__login()
 		cmd = "connect -F " + self.server
 		child.sendline(cmd)
-		i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
+		__i=child.expect(['DRAC/MC:', pexpect.EOF, pexpect.TIMEOUT])
 		child.terminate()

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/dellswitch.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/dellswitch.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/dellswitch.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/dellswitch.py Tue Jun 19 22:05:52 2012
@@ -18,24 +18,22 @@
 #  $Id$
 #
 
-import os
-import sys
+
 import pexpect
 import datetime
-import time
 import thread
-import string
-import getpass
 import socket
 import tempfile
+import os
 import logging
+import sys
+import time
+import string
 
-#import zoni
-from zoni.data.resourcequerysql import *
 from zoni.hardware.hwswitchinterface import HwSwitchInterface
 from zoni.data.resourcequerysql import ResourceQuerySql
 from zoni.agents.dhcpdns import DhcpDns
-from zoni.extra.util import *
+from zoni.extra.util import normalizeMac
 
 
 '''  Using pexpect to control switches because couldn't get snmp to work 
@@ -54,7 +52,7 @@ class HwDellSwitch(HwSwitchInterface):
 			pass
 
 
- 	def setVerbose(self, verbose):
+	def setVerbose(self, verbose):
 		self.verbose = verbose
 
 	def __login(self):
@@ -261,10 +259,10 @@ class HwDellSwitch(HwSwitchInterface):
 				i=child.expect(['console','#', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 				i=child.expect(['console','#', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 				
-			except EOF:
+			except pexpect.EOF:
 				print "EOF", i
 				#child.sendline()
-			except TIMEOUT:
+			except pexpect.TIMEOUT:
 				print "TIMEOUT", i
 		#child.interact(escape_character='\x1d', input_filter=None, output_filter=None)
 
@@ -463,16 +461,16 @@ class HwDellSwitch(HwSwitchInterface):
 		child = self.__login()
 		cmd = "copy running-config startup-config"
 		child.sendline(cmd)
-		i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
+		__i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
 		child.sendline("y")
 		child.terminate()
 
-	def __saveConfig(self):
-		cmd = "copy running-config startup-config"
-		child.sendline(cmd)
-		i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
-		child.sendline("y")
-		child.terminate()
+#	def __saveConfig(self):
+#		cmd = "copy running-config startup-config"
+#		child.sendline(cmd)
+#		__i = child.expect(['y/n', pexpect.EOF, pexpect.TIMEOUT])
+#		child.sendline("y")
+#		child.terminate()
 
 	
 	def registerToZoni(self, user, password, host):
@@ -511,7 +509,7 @@ class HwDellSwitch(HwSwitchInterface):
 		child.sendline(cmd)
 		val = host + "#"
 		tval = host + ">"
-		i = child.expect([val, tval, '\n\r\n\r', "--More--",  pexpect.EOF, pexpect.TIMEOUT])
+		__i = child.expect([val, tval, '\n\r\n\r', "--More--",  pexpect.EOF, pexpect.TIMEOUT])
 		cmd = "show version"
 		child.sendline(cmd)
 		i = child.expect([val, tval, '\n\r\n\r', pexpect.EOF, pexpect.TIMEOUT])
@@ -547,19 +545,19 @@ class HwDellSwitch(HwSwitchInterface):
 
 		user = "public"
 		oid = eval("1,3,6,1,4,1,674,10895,3000,1,2,100,1,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_model'] = str(varBinds[0][1])
 
 		oid = eval("1,3,6,1,4,1,674,10895,3000,1,2,100,3,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_make'] = str(varBinds[0][1])
 
 		oid = eval("1,3,6,1,4,1,674,10895,3000,1,2,100,4,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_version_sw'] = str(varBinds[0][1])

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/f10s50switch.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/f10s50switch.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/f10s50switch.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/f10s50switch.py Tue Jun 19 22:05:52 2012
@@ -26,15 +26,13 @@ import datetime
 import time
 import thread
 import string
-import getpass
 import socket
 import tempfile
 import logging
 
 #import zoni
-from zoni.data.resourcequerysql import *
-from zoni.hardware.hwswitchinterface import HwSwitchInterface
 from zoni.data.resourcequerysql import ResourceQuerySql
+from zoni.hardware.hwswitchinterface import HwSwitchInterface
 from zoni.agents.dhcpdns import DhcpDns
 
 
@@ -49,7 +47,7 @@ class HwF10S50Switch(HwSwitchInterface):
 		self.log = logging.getLogger(os.path.basename(__file__))
 
 
- 	def setVerbose(self, verbose):
+	def setVerbose(self, verbose):
 		self.verbose = verbose
 
 	def __login(self):
@@ -138,7 +136,7 @@ class HwF10S50Switch(HwSwitchInterface):
 		child.expect(["conf-if", pexpect.EOF])
 		child.sendline("switchport")
 		child.sendline("exit")
-		child.sendline("interface vlan " + vlan")
+		child.sendline("interface vlan %s" % vlan)
 		child.expect(["conf-if", pexpect.EOF])
 		cmd = "tagged port-channel 1"
 		child.sendline(cmd)
@@ -214,10 +212,10 @@ class HwF10S50Switch(HwSwitchInterface):
 				i=child.expect(['console','#', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 				i=child.expect(['console','#', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 				
-			except EOF:
+			except pexpect.EOF:
 				print "EOF", i
 				#child.sendline()
-			except TIMEOUT:
+			except pexpect.TIMEOUT:
 				print "TIMEOUT", i
 		#child.interact(escape_character='\x1d', input_filter=None, output_filter=None)
 
@@ -237,7 +235,7 @@ class HwF10S50Switch(HwSwitchInterface):
 		child = self.__login()
 		child.logfile = sys.stdout
 		child.sendline('config')
-		cmd = "interface vlan " + vlan)
+		cmd = "interface vlan %s" % (vlan)
 		child.sendline(cmd)
 		i=child.expect(['conf-if', pexpect.EOF, pexpect.TIMEOUT])
 		if i > 0:
@@ -270,7 +268,7 @@ class HwF10S50Switch(HwSwitchInterface):
 		child.logfile = sys.stdout
 		cmd = "show interfaces g 0/" + str(self.host['hw_port'])
 		child.sendline(cmd)
-		i = child.expect(['#', pexpect.EOF, pexpect.TIMEOUT])
+		__i = child.expect(['#', pexpect.EOF, pexpect.TIMEOUT])
 		child.terminate()
 
 	def interactiveSwitchConfig(self):
@@ -374,12 +372,12 @@ class HwF10S50Switch(HwSwitchInterface):
 
 		user = "public"
 		oid = eval("1,3,6,1,4,1,674,10895,3000,1,2,100,1,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_model'] = str(varBinds[0][1])
 		oid = eval("1,3,6,1,4,1,674,10895,3000,1,2,100,3,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_make'] = str(varBinds[0][1])

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpilo.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpilo.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpilo.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpilo.py Tue Jun 19 22:05:52 2012
@@ -19,7 +19,6 @@
 #
 
 import sys
-import os 
 import pexpect
 import time
 
@@ -29,6 +28,26 @@ from zoni.extra.util import timeF, log
 #XXX  Need to add more error checking!
 #XXX  Need to consider difference in responses between a rackmount server and a blade server - MIMOS
 
+def log(f):
+	def myF(*args, **kw):
+		print "calling %s%s" % (f.__name__, str(args))
+		res = f(*args, **kw)
+		print "returning from %s -> %s" % (f.__name__, str(res))
+		return res
+	myF.__name__ = f.__name__
+	return myF
+
+def timeF(f):
+	def myF(*args, **kw):
+		start = time.time()
+		res = f(*args, **kw)
+		end = time.time()
+		print "%s took %f" % (f.__name__, end-start)
+		return res
+	myF.__name__ = f.__name__
+	return myF
+
+
 class hpILo(SystemManagementInterface):
 	def __init__(self, config, nodeName, hostInfo):
 		self.config = config

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpswitch.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpswitch.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpswitch.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hpswitch.py Tue Jun 19 22:05:52 2012
@@ -25,13 +25,11 @@ import sys
 import pexpect
 import datetime
 import thread
-import time
 import threading
 import logging
 
 
 from hwswitchinterface import HwSwitchInterface
-from resourcequerysql import ResourceQuerySql
 
 
 class HwHPSwitch(HwSwitchInterface):
@@ -74,10 +72,10 @@ class HwHPSwitch(HwSwitchInterface):
 		child.sendline(cmd)
 		opt = child.expect(["Confirm(.*)", "No save(.*)", pexpect.EOF, pexpect.TIMEOUT])
 		if opt == 0:
-				print "saving to flash"
-				child.sendline("y\n")
+			print "saving to flash"
+			child.sendline("y\n")
 		if opt == 1:
-				print "no save needed"
+			print "no save needed"
 		child.sendline('exit')
 		child.terminate()
 
@@ -169,10 +167,10 @@ class HwHPSwitch(HwSwitchInterface):
 				i=child.expect(['console','sw', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 				i=child.expect(['console','sw', 'Name:', pexpect.EOF, pexpect.TIMEOUT], timeout=2)
 
-			except EOF:
+			except pexpect.EOF:
 				print "EOF", i
 				#child.sendline()
-			except TIMEOUT:
+			except pexpect.TIMEOUT:
 				print "TIMEOUT", i
 		#child.interact(escape_character='\x1d', input_filter=None, output_filter=None)
 
@@ -245,7 +243,7 @@ class HwHPSwitch(HwSwitchInterface):
 		cmd = "/info/port " + str(self.host['hw_port'])
 		child.sendline(cmd)
 		child.logfile = sys.stdout
-		opt = child.expect(['Info(.*)', pexpect.EOF, pexpect.TIMEOUT])
+		__opt = child.expect(['Info(.*)', pexpect.EOF, pexpect.TIMEOUT])
 
 	#  this needs to be removed or rewritten
 	def interactiveSwitchConfig(self):

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hwswitchinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hwswitchinterface.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hwswitchinterface.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/hwswitchinterface.py Tue Jun 19 22:05:52 2012
@@ -18,8 +18,6 @@
 #  $Id$
 #
 
-import sys
-import os 
 
 class HwSwitchInterface(object):
 	"""  Interface description for hardware switches

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/ipmi.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/ipmi.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/ipmi.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/ipmi.py Tue Jun 19 22:05:52 2012
@@ -18,11 +18,8 @@
 #  $Id$
 #
 
-import sys
-import os 
 import subprocess
 import logging
-import string
 
 from systemmanagementinterface import SystemManagementInterface
 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/raritanpdu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/raritanpdu.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/raritanpdu.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/raritanpdu.py Tue Jun 19 22:05:52 2012
@@ -18,19 +18,19 @@
 #  $Id$
 #
 
-import sys
-import os 
-import string
 import warnings
 import logging
+import string
+import sys
 import time
+
 warnings.filterwarnings("ignore")
 
 from pysnmp.entity.rfc3413.oneliner import cmdgen
 from pysnmp.proto import rfc1902
-from zoni.data.resourcequerysql import *
+from zoni.data.resourcequerysql import ResourceQuerySql
 from zoni.hardware.systemmanagementinterface import SystemManagementInterface
-
+from zoni.agents.dhcpdns import DhcpDns
 
 #class systemmagement():
 	#def __init__(self, proto):
@@ -90,7 +90,7 @@ class raritanDominionPx(SystemManagement
 	'''
 	def getOffset(self):
 		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(0))
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 0), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), thisoid)
 		output = varBinds[0][1]
@@ -102,7 +102,7 @@ class raritanDominionPx(SystemManagement
 
 	def __setPowerStatus(self):
 		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(self.port))
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 0), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), thisoid)
 		output = varBinds[0][1]
@@ -134,7 +134,7 @@ class raritanDominionPx(SystemManagement
 
 	def powerOn(self):
 		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(self.port)) 
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().setCmd( \
+		__errorIndication, __errorStatus, __errorIndex, __varBinds = cmdgen.CommandGenerator().setCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 1), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), \
 		(thisoid, rfc1902.Integer('1')))
@@ -142,7 +142,7 @@ class raritanDominionPx(SystemManagement
 
 	def powerOff(self):
 		thisoid = eval(str(self.oid) + str(self.oid_status) + "," + str(self.port)) 
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().setCmd( \
+		__errorIndication, __errorStatus, __errorIndex, __varBinds = cmdgen.CommandGenerator().setCmd( \
 		cmdgen.CommunityData('my-agent', self.user, 1), \
 		cmdgen.UdpTransportTarget((self.pdu_name, 161)), \
 		(thisoid, rfc1902.Integer('0')))
@@ -181,7 +181,7 @@ class raritanDominionPx(SystemManagement
 
 		a={}
 		oid = eval(str("1,3,6,1,2,1,1,1,0"))
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 
@@ -193,7 +193,7 @@ class raritanDominionPx(SystemManagement
 		a['hw_make'] = str(varBinds[0][1])
 
 		oid = eval("1,3,6,1,4,1,13742,4,1,1,6,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		x = []
@@ -204,7 +204,7 @@ class raritanDominionPx(SystemManagement
 		a['hw_mac'] = ":".join(['%s' % d for d in x])
 
 		oid = eval("1,3,6,1,4,1,13742,4,1,1,2,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		serial = str(varBinds[0][1])
@@ -214,13 +214,13 @@ class raritanDominionPx(SystemManagement
 		a['hw_notes'] = val + "; Serial " + serial
 
 		oid = eval("1,3,6,1,4,1,13742,4,1,1,1,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_version_fw'] = str(varBinds[0][1])
 
 		oid = eval("1,3,6,1,4,1,13742,4,1,1,12,0")
-		errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
+		__errorIndication, __errorStatus, __errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( \
 		cmdgen.CommunityData('my-agent', user, 0), \
 		cmdgen.UdpTransportTarget((host, 161)), oid)
 		a['hw_model'] = str(varBinds[0][1])

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagement.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagement.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagement.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagement.py Tue Jun 19 22:05:52 2012
@@ -19,13 +19,11 @@
 #  $Id$  
 #
 
-import sys
-import os 
 import logging
 import threading
+import time
 
 from systemmanagementinterface import SystemManagementInterface
-from zoni.data.resourcequerysql import *
 
 from tashi.util import instantiateImplementation
 
@@ -41,7 +39,7 @@ class SystemManagement(SystemManagementI
 
 
 	def getInfo(self, nodeName):
-		self.host = self.data.getHostInfo(node)
+		self.host = self.data.getHostInfo(nodeName)
 		
 		
 	def setVerbose(self, verbose):
@@ -65,7 +63,7 @@ class SystemManagement(SystemManagementI
 		#  [2] = hw method password
 		success = 0
 		for i in hw:
-			inst = instantiateImplementation(self.config['hardwareControl'][i[0]]['class'], self.config, nodeName, self.host)
+			__inst = instantiateImplementation(self.config['hardwareControl'][i[0]]['class'], self.config, nodeName, self.host)
 			a = "inst.%s" % mycmd
 			for count in range(retries):
 				doit = eval(a)
@@ -89,7 +87,7 @@ class SystemManagement(SystemManagementI
 	def softPowerConfirm(self, method, nodeName):
 		#  using a sleep for now...
 		time.sleep(30)
-		inst = instantiateImplementation(self.config['hardwareControl'][method]['class'], self.config, nodeName, self.host)
+		__inst = instantiateImplementation(self.config['hardwareControl'][method]['class'], self.config, nodeName, self.host)
 		mycmd = "%s()" % ("powerOff")
 		a = "inst.%s" % mycmd
 		doit = eval(a)

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagementinterface.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagementinterface.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagementinterface.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/hardware/systemmanagementinterface.py Tue Jun 19 22:05:52 2012
@@ -18,9 +18,6 @@
 #  $Id$
 #
 
-import sys
-import os 
-
 
 class SystemManagementInterface(object):
 	"""  Interface description for hardware management controllers 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/install/db/zoniDbSetup.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/install/db/zoniDbSetup.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/install/db/zoniDbSetup.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/install/db/zoniDbSetup.py Tue Jun 19 22:05:52 2012
@@ -20,15 +20,13 @@
 
 import os 
 import sys
-import string
 try:
 	import MySQLdb
-	import traceback
 	import optparse
 	import getpass
 except ImportError, e:
-        print "Module not installed : %s" % e
-        exit()
+	print "Module not installed : %s" % e
+	exit()
 
 
 a = os.path.join("../")
@@ -38,8 +36,8 @@ sys.path.append(a)
 a = os.path.join("../../..")
 sys.path.append(a)
 
-from zoni.version import *
-from zoni.extra.util import *
+from zoni.version import version, revision
+from zoni.extra.util import getConfig
 
 
 def main():
@@ -53,7 +51,7 @@ def main():
 	parser.add_option("-u", "--userName", "--username", dest="userName", help="Mysql username")
 	parser.add_option("-p", "--password", dest="password", help="Admin mysql password")
 	#parser.add_option("-v", "--verbose", dest="verbosity", help="Be verbose", action="store_true", default=False)
-	(options, args) = parser.parse_args()
+	(options, __args) = parser.parse_args()
 
 	if not options.userName:
 		parser.print_help()
@@ -63,7 +61,7 @@ def main():
 	if not options.password:
 		password = getpass.getpass()
 
-	(configs, configFiles) = getConfig()
+	(configs, __configFiles) = getConfig()
 
 	CreateZoniDb(configs, options.userName, password)
 
@@ -174,7 +172,7 @@ def createTables(conn):
 	sys.stdout.write("    Creating sysdomainmembermap...")
 	execQuery(conn, "CREATE TABLE IF NOT EXISTS `sysdomainmembermap` (`sys_id` int(11) unsigned NOT NULL, `domain_id` int(11) NOT NULL)")
 	sys.stdout.write("Success\n")
- 	#  Create allocationinfo
+	#  Create allocationinfo
 	sys.stdout.write("    Creating allocationinfo...")
 	execQuery(conn, "CREATE TABLE IF NOT EXISTS `allocationinfo` ( `allocation_id` int(11) unsigned NOT NULL auto_increment, `sys_id` int(11) unsigned NOT NULL, `reservation_id` int(11) unsigned NOT NULL, `pool_id` int(11) unsigned NULL, `hostname` varchar(64) default NULL, `domain_id` int(11) unsigned NOT NULL, `notes` tinytext, `expire_time` timestamp default 0 NOT NULL, PRIMARY KEY  (`allocation_id`)) ENGINE=INNODB")
 	sys.stdout.write("Success\n")
@@ -224,10 +222,10 @@ def createRegistration(conn, config):
 	if checkVal:
 		sys.stdout.write("    Kernel already exists in DB...\n")
 		#  Get the kernel_id
-		kernelId = str(checkVal[1][0][0])
+		#kernelId = str(checkVal[1][0][0])
 	else:
-		r = execQuery(conn, "INSERT into `kernelinfo` (kernel_name, kernel_release, kernel_arch) values ('linux-2.6.24-19-server', '2.6.24-19-server', 'x86_64' )")
-		kernelId = str(r.lastrowid)
+		__r = execQuery(conn, "INSERT into `kernelinfo` (kernel_name, kernel_release, kernel_arch) values ('linux-2.6.24-19-server', '2.6.24-19-server', 'x86_64' )")
+		#kernelId = str(r.lastrowid)
 		sys.stdout.write("    Success\n")
 
 	#  Initrd
@@ -325,7 +323,7 @@ def addInitialConfig(conn, config):
 	if checkVal:
 		sys.stdout.write("Default Domain (ZoniHome) already linked to vlan " + config['zoniHomeDomain'] + "...\n")
 		#  Get the domainId 
-		valId = str(checkVal[1][0][0])
+		#valId = str(checkVal[1][0][0])
 	else:
 		r = execQuery(conn, "INSERT into `domainmembermap` (domain_id, vlan_id) values (" + domainId + ", " + vlanId + ")")
 		domainId = str(r.lastrowid)
@@ -358,7 +356,7 @@ def addInitialConfig(conn, config):
 	if checkVal:
 		sys.stdout.write("Default pool (ZoniHome) already exists...\n")
 		#  Get the domainId 
-		poolId = str(checkVal[1][0][0])
+		#poolId = str(checkVal[1][0][0])
 	else:
 		r = execQuery(conn, "INSERT into `poolmap` (pool_id, vlan_id) values (" + zoniPoolId + ", " + vlanId + ")")
 		domainId = str(r.lastrowid)
@@ -370,7 +368,7 @@ def addInitialConfig(conn, config):
 		sys.stdout.write("Default pool (ZoniHome) already exists...\n")
 		#  XXX probably should delete first then add, do it later
 		#  Get the domainId 
-		poolId = str(checkVal[1][0][0])
+		#poolId = str(checkVal[1][0][0])
 	else:
 		r = execQuery(conn, "INSERT into `poolmap` (pool_id, vlan_id) values (" + zoniIpmiId + ", " + vlanId + ")")
 		domainId = str(r.lastrowid)
@@ -406,7 +404,7 @@ def execQuery(conn, query):
 
 def entryExists(conn, table, col, checkVal):
 	query = "select * from " + table + " where " + col + " = '" + checkVal + "'"
- 	r = execQuery(conn, query)
+	r = execQuery(conn, query)
 	res = r.fetchall()
 	if len(res) > 0:
 		return (1, res)
@@ -415,5 +413,5 @@ def entryExists(conn, table, col, checkV
 
 
 if __name__ == "__main__":
-    main()
+	main()
 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/install/dnsdhcp/zoniDnsDhcpSetup.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/install/dnsdhcp/zoniDnsDhcpSetup.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/install/dnsdhcp/zoniDnsDhcpSetup.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/install/dnsdhcp/zoniDnsDhcpSetup.py Tue Jun 19 22:05:52 2012
@@ -21,10 +21,7 @@
 
 import os 
 import sys
-import string
-import traceback
 import optparse
-import getpass
 
 a = os.path.join("../")
 sys.path.append(a)
@@ -33,8 +30,8 @@ sys.path.append(a)
 a = os.path.join("../../..")
 sys.path.append(a)
 
-from zoni.version import *
-from zoni.extra.util import *
+from zoni.version import version, revision
+from zoni.extra.util import createKey
 
 
 def main():
@@ -47,13 +44,13 @@ def main():
 	parser = optparse.OptionParser(usage="%prog -k keyname", version="%prog " + ver + " " + rev)
 	parser.add_option("-k", "--keyName", "--keyname", dest="keyName", help="Key name")
 	#parser.add_option("-v", "--verbose", dest="verbosity", help="Be verbose", action="store_true", default=False)
-	(options, args) = parser.parse_args()
+	(options, __args) = parser.parse_args()
 
 	if not options.keyName:
 		parser.print_help()
 		exit(1)
 
-	(configs, configFiles) = getConfig()
+	#(configs, configFiles) = getConfig()
 
 
 	key = createKey(options.keyName)
@@ -79,5 +76,5 @@ def main():
 
 
 if __name__ == "__main__":
-    main()
+	main()
 

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/install/pxe/zoniPxeSetup.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/install/pxe/zoniPxeSetup.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/install/pxe/zoniPxeSetup.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/install/pxe/zoniPxeSetup.py Tue Jun 19 22:05:52 2012
@@ -21,9 +21,6 @@
 
 import os 
 import sys
-import string
-import traceback
-import optparse
 import shutil
 import urllib
 import tarfile
@@ -38,21 +35,21 @@ sys.path.append(a)
 a = os.path.join("../../..")
 sys.path.append(a)
 
-from zoni.extra.util import *
-from zoni.version import *
+from zoni.extra.util import getConfig, checkSuper, createDir
+#from zoni.version import version, revision
 from zoni.bootstrap.pxe import Pxe
 
 
 def main():
 	''' This file sets up PXE for Zoni '''
 
-	ver = version.split(" ")[0]
-	rev = revision
+	#ver = version.split(" ")[0]
+	#rev = revision
 
-	parser = optparse.OptionParser(usage="%prog ", version="%prog " + ver + " " + rev)
-	(options, args) = parser.parse_args()
+	#parser = optparse.OptionParser(usage="%prog ", version="%prog " + ver + " " + rev)
+	#(options, args) = parser.parse_args()
 
-	(configs, configFile) = getConfig()
+	(configs, __configFile) = getConfig()
 
 	ZoniPxeSetup(configs)
 	ZoniGetSyslinux(configs)
@@ -62,11 +59,11 @@ def ZoniPxeSetup(config):
 	tftpRootDir = config['tftpRootDir']
 	tftpImageDir = config['tftpImageDir']
 	tftpBootOptionsDir = config['tftpBootOptionsDir']
-	tftpUpdateFile =  config['tftpUpdateFile'] 
+	#tftpUpdateFile =  config['tftpUpdateFile'] 
 	tftpBaseFile = config['tftpBaseFile'] 
 	tftpBaseMenuFile = config['tftpBaseMenuFile'] 
 	installBaseDir = config['installBaseDir']
-	registrationBaseDir = config['registrationBaseDir']
+	#registrationBaseDir = config['registrationBaseDir']
 	
 
 	#  Create the directory structure

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/install/www/zoniWebSetup.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/install/www/zoniWebSetup.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/install/www/zoniWebSetup.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/install/www/zoniWebSetup.py Tue Jun 19 22:05:52 2012
@@ -22,12 +22,8 @@
 import os 
 import sys
 import time
-import string
-import traceback
-import optparse
+#import optparse
 import shutil
-import urllib
-import tarfile
 
 a = os.path.join("../")
 sys.path.append(a)
@@ -36,21 +32,20 @@ sys.path.append(a)
 a = os.path.join("../../..")
 sys.path.append(a)
 
-from zoni.extra.util import *
-from zoni.version import *
-from zoni.bootstrap.pxe import Pxe
+from zoni.extra.util import getConfig, checkSuper, createDir
+#from zoni.version import version, revision
 
 
 def main():
 	''' This file sets up the web files for Zoni '''
 
-	ver = version.split(" ")[0]
-	rev = revision
+	#ver = version.split(" ")[0]
+	#rev = revision
 
-	parser = optparse.OptionParser(usage="%prog ", version="%prog " + ver + " " + rev)
-	(options, args) = parser.parse_args()
+	#parser = optparse.OptionParser(usage="%prog ", version="%prog " + ver + " " + rev)
+	#(options, args) = parser.parse_args()
 
-	(configs, configFiles) = getConfig()
+	(configs, __configFiles) = getConfig()
 
 	ZoniWebSetup(configs)
 	ZoniCreateWebConfigFile(configs)

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/services/pcvciservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/services/pcvciservice.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/services/pcvciservice.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/services/pcvciservice.py Tue Jun 19 22:05:52 2012
@@ -19,7 +19,6 @@
 #  $Id$
 #
 
-import threading
 import logging
 
 from tashi.util import instantiateImplementation
@@ -49,10 +48,11 @@ class pcmService(object):
 			
 	def requestResources(self, key, specs, quantity):
 		vcm = self.__key2vcm(key)
-		node = specs
+		#node = specs
 		'''  Check for keys later  '''
 		self.log.info("VCM_REQUEST_RESOURCE: VCM %s RESOURCE %s(%s)" % (vcm, specs, quantity))
-		# go to scheduler val = self.agent.requestResource(specs)
+		# go to scheduler
+		val = self.agent.requestResource(specs)
 		if val:
 			return 1
 		return 0

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/services/zonimanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/services/zonimanager.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/services/zonimanager.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/services/zonimanager.py Tue Jun 19 22:05:52 2012
@@ -20,18 +20,11 @@
 #
 
 import os
-import sys
-import threading
-import signal
 import logging.config
-import signal
 
-from tashi.util import instantiateImplementation, signalHandler
+from tashi.util import instantiateImplementation
 
-from zoni.extra.util import loadConfigFile, getConfig, debugConsole
-from zoni.version import *
-from zoni.services.hardwareservice import HardwareService
-from zoni.services.pcvciservice import pcmService
+from zoni.extra.util import getConfig, debugConsole
 from zoni.services.rpycservices import ManagerService
 
 from rpyc.utils.server import ThreadedServer

Modified: incubator/tashi/branches/luke-zoni-staging/src/zoni/version.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/luke-zoni-staging/src/zoni/version.py?rev=1351880&r1=1351879&r2=1351880&view=diff
==============================================================================
--- incubator/tashi/branches/luke-zoni-staging/src/zoni/version.py (original)
+++ incubator/tashi/branches/luke-zoni-staging/src/zoni/version.py Tue Jun 19 22:05:52 2012
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.    
 
-id = "$Id: version.py 964467 2010-07-15 15:31:02Z rgass $"
+_id = "$Id: version.py 964467 2010-07-15 15:31:02Z rgass $"
 lastChangeDate = "$LastChangedDate$"
 lastChangeRevision = "$Rev: 964467 $"
 revision = lastChangeRevision



Mime
View raw message