NagAconda
NagAconda copied to clipboard
Can't set range
If you run this code, you will have an error.
#!/usr/bin/python
from NagAconda import Plugin
plugin = Plugin('The plugin', '0.1')
plugin.add_option('p', 'parameter', 'The parameter.')
plugin.enable_status('warning')
plugin.enable_status('critical')
plugin.start()
#have to huck the code due to a bug. It sets defaults for warning and critical to None and then try to get its len :(
# plugin._Plugin__warning = []
# plugin._Plugin__critical = []
#end of huck
plugin.set_range('warning', 1)
plugin.set_range('critical', 2, 1)
plugin.set_status_message('the message')
plugin.set_value('state', 1)
plugin.finish()
Traceback (most recent call last):
File "nagaconda_bug.py", line 16, in <module>
plugin.set_range('warning', 1)
File "/Library/Python/2.6/site-packages/NagAconda/Plugin.py", line 353, in set_range
if range_num > len(my_range):
TypeError: object of type 'NoneType' has no len()
Due to info here you can set range after start. Uncomment "huck" code it make it run.