ZenDMD Tip - Check and Repair Device Objects with Missing DeviceClass

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

su zenoss, zendmd

def checkDeviceClass(d):
    print "Checking Device Class linkage for %s" % d.titleOrId()
    if d.deviceClass == None:
        dc = d.getPrimaryParent().getPrimaryParent()
        d.deviceClass._add(dc)

Usage:

d=dmd.Devices.findDevice('yourDevice')
checkDeviceClass(d)