From: <sv...@ze...> - 2008-05-19 19:36:20
|
Author: ian Date: 2008-05-19 15:36:27 -0400 (Mon, 19 May 2008) New Revision: 9308 Modified: sandboxen/jplouis/Products-remoteStuff/DataCollector/zendisc.py sandboxen/jplouis/Products-remoteStuff/ZenModel/PerformanceConf.py sandboxen/jplouis/Products-remoteStuff/ZenModel/ZDeviceLoader.py sandboxen/jplouis/Products-remoteStuff/ZenUtils/Utils.py Log: * Post-code-review typos, wrapping, etc. Modified: sandboxen/jplouis/Products-remoteStuff/DataCollector/zendisc.py =================================================================== --- sandboxen/jplouis/Products-remoteStuff/DataCollector/zendisc.py 2008-05-19 19:05:30 UTC (rev 9307) +++ sandboxen/jplouis/Products-remoteStuff/DataCollector/zendisc.py 2008-05-19 19:36:27 UTC (rev 9308) @@ -11,7 +11,6 @@ # ########################################################################### -import sys import socket import Globals @@ -247,7 +246,8 @@ if self.options.zSnmpVer: kw.update(dict(zSnmpVer=self.options.zSnmpVer)) if self.options.zSnmpCommunity: - kw.update(dict(zSnmpCommunitY = self.options.zSnmpCommunity)) + kw.update(dict(zSnmpCommunity= + self.options.zSnmpCommunity)) if useDeviceName: kw.update(dict(deviceName=name)) else: Modified: sandboxen/jplouis/Products-remoteStuff/ZenModel/PerformanceConf.py =================================================================== --- sandboxen/jplouis/Products-remoteStuff/ZenModel/PerformanceConf.py 2008-05-19 19:05:30 UTC (rev 9307) +++ sandboxen/jplouis/Products-remoteStuff/ZenModel/PerformanceConf.py 2008-05-19 19:36:27 UTC (rev 9308) @@ -412,35 +412,34 @@ locationPath, groupPaths, systemPaths, performanceMonitor, discoverProto) else: - try: - device = self._createDevice(deviceName, devicePath, productionState, - performanceMonitor, discoverProto, zSnmpPort, zSnmpCommunity, REQUEST) - - if device: - kw = dict(tag=tag, - serialNumber=serialNumber, - rackSlot=rackSlot, - productionState=productionState, - comments=comments, - hwManufacturer=hwManufacturer, - hwProductName = hwProductName, - osManufacturer = osManufacturer, - osProductName = osProductName, - locationPath = locationPath, - groupPaths = groupPaths, - systemPaths = systemPaths, - performanceMonitor = performanceMonitor, - priority = priority) - device.manage_editDevice(**kw) - else: - log.info("no device returned") - - except Exception: raise + device = self._createDevice(deviceName, devicePath, productionState, + performanceMonitor, discoverProto, zSnmpPort, + zSnmpCommunity, REQUEST) +#need to call zendisc and interpret exit codes? Then update properties. + + if device: + device.manage_editDevice(tag=tag, + serialNumber=serialNumber, + rackSlot=rackSlot, + productionState=productionState, + comments=comments, + hwManufacturer=hwManufacturer, + hwProductName = hwProductName, + osManufacturer = osManufacturer, + osProductName = osProductName, + locationPath = locationPath, + groupPaths = groupPaths, + systemPaths = systemPaths, + performanceMonitor = performanceMonitor, + priority = priority) + else: + log.info("no device returned") return device def _createDevice(self, deviceName, devicePath= "/Discovered", productionState=1000, performanceMonitor="localhost", - discoverProto="snmp", zSnmpPort=161,zSnmpCommunity="", REQUEST=None): + discoverProto="snmp", zSnmpPort=161,zSnmpCommunity="", + REQUEST=None): """ Actual implementation for creating/adding a device to the system. """ @@ -467,12 +466,13 @@ def _executeZenDiscCommand(self, zendiscCmd, REQUEST=None): """ - execute a the given zendisc command and return reslut + execute a the given zendisc command and return result """ result = executeCommand(zendiscCmd, REQUEST) return result - def collectDevice(self, device=None, setlog=True, REQUEST=None, generateEvents=False): + def collectDevice(self, device=None, setlog=True, REQUEST=None, + generateEvents=False): """ Collect the configuration of this device AKA Model Device Modified: sandboxen/jplouis/Products-remoteStuff/ZenModel/ZDeviceLoader.py =================================================================== --- sandboxen/jplouis/Products-remoteStuff/ZenModel/ZDeviceLoader.py 2008-05-19 19:05:30 UTC (rev 9307) +++ sandboxen/jplouis/Products-remoteStuff/ZenModel/ZDeviceLoader.py 2008-05-19 19:36:27 UTC (rev 9308) @@ -85,7 +85,7 @@ osManufacturer="", osProductName="", locationPath="", groupPaths=[], systemPaths=[], performanceMonitor="localhost", - discoverProto="snmp",priority=3,REQUEST = None): + discoverProto="snmp",priority=3,REQUEST=None): """ Load a device into the database connecting its major relations and collecting its configuration. Modified: sandboxen/jplouis/Products-remoteStuff/ZenUtils/Utils.py =================================================================== --- sandboxen/jplouis/Products-remoteStuff/ZenUtils/Utils.py 2008-05-19 19:05:30 UTC (rev 9307) +++ sandboxen/jplouis/Products-remoteStuff/ZenUtils/Utils.py 2008-05-19 19:36:27 UTC (rev 9308) @@ -590,7 +590,6 @@ def executeCommand(cmd, REQUEST): -# import pydevd;pydevd.settrace() xmlrpc = isXmlRpc(REQUEST) result = 0 try: |