Apr 7, 2010 11:22 AM
adding a python script to a zenpack
-
Like (0)
I have a script /zport/dmd/findDeviceByIp I want to add it to the zenpack where would I add it in my init.py
so that when called you can call it under /zport/dmd not under /zport/dmd/devices
Thanks,
Pete
You'd want to monkeypatch it onto the DataRoot class.
Versions 2.4 and later..
from Products.ZenUtils.Utils import monkeypatch
@monkeypatch('Products.ZenModel.DataRoot.DataRoot')
def findDeviceByIp(self, ip=None):
"""
I need to have a method comment to be usable via a REST or XML-RPC call.
"""
pass
Versions earlier than 2.4..
from Products.ZenModel.DataRoot import DataRoot
def DataRoot_findDeviceByIp(self, ip=None):
"""
I need to have a method comment to be usable via a REST or XML-RPC call.
"""
pass
DataRoot.findDeviceByIp = DataRoot_findDeviceByIp
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||