Ticket #1843 (closed defect: fixed)
zendisc doesn't work on networks with children
| Reported by: | cluther | Owned by: | cluther |
|---|---|---|---|
| Priority: | 1 - Blocker | Milestone: | zenoss-2.1 |
| Component: | DataCollector | Version: | 2.0.2 |
| Severity: | low | Keywords: | zendisc network not found |
| Cc: | Documentation: | Not required | |
| Installer: | Reviewed: | yes |
Description
zendisc fails to find the requested --net= network when the network specified has children, but no child that contains the IP specified.
An example network structure:
- 10.0.0.0/8
- 10.1.0.0/16
- 10.1.2.0/24
- 10.1.2.4/30
- 10.1.2.0/24
- 10.1.0.0/16
zendisc run --net=10.1.2.0 will fail because 10.1.2.0 has children, but no child that contains 10.1.2.0.
Proposed fix:
Index: DataCollector/zendisc.py
===================================================================
--- DataCollector/zendisc.py (revision 5999)
+++ DataCollector/zendisc.py (working copy)
@@ -195,8 +195,7 @@
if self.options.net:
for net in self.options.net:
try:
- #netobj = self.dmd.Networks._getNet(net)
- netobj = self.dmd.Networks.getSubNetwork(net)
+ netobj = self.dmd.Networks._getNet(net)
if not netobj:
raise SystemExit("network %s not found in dmd" % net)
for ip in self.discoverIps((netobj,)):
Index: ZenModel/IpNetwork.py
===================================================================
--- ZenModel/IpNetwork.py (revision 5999)
+++ ZenModel/IpNetwork.py (working copy)
@@ -173,7 +173,11 @@
for net in self.children():
if net.hasIp(ip):
if len(net.children()):
- return net._getNet(ip)
+ subnet = net._getNet(ip)
+ if subnet:
+ return subnet
+ else:
+ return net
else:
return net
Change History
Note: See
TracTickets for help on using
tickets.