Network Analyst who plays around with many things open source when he is not feeding his MMORPG addiction.
The Internet needed another source of rants and uninvited uninformed opinions.
The following lines of code when used within Zenoss's zendmd environment will take a list of IP addresses from a text file and spit out a list of those IP addresses that do not yet have a corresponding object in Zenoss.
import string
print [devip for devip in map(string.strip, open("iplist.txt", "r").readlines())
if not [True for device in dmd.Devices.getSubDevices() if device.manageIp == devip]]
This is useful for those cases where you are sure Zenoss discovery missed a few network switches due to a network administrator screwup and find that it's too time consuming to find the handful among hundreds the manual way.
As for the code quality I beg forgiveness from the Pythonic gods for thinking a list comprehension within a list comprehension with a map thrown in was a good idea. But then again I'm sure there are some Ruby fanatics out there that think that looks like Hello World. ;)
Update on May 13th: A kind poster pointed out the presence of find() in zendmd and thus dmd.Devices.findDevice(). That means one can just do this instead:
import string
print [devip for devip in map(string.strip, open("iplist.txt", "r").readlines())
if not dmd.Devices.findDevice(devip)]
Not only is it shorter its also a magnitude of order faster which shouldn't be too surprising considering the evil in the original version. Thanks Erik!