James Newman
2013-03-06 16:45:09 UTC
James Newman [http://community.zenoss.org/people/JimForTheWin] created the discussion
"getGraphDef() Usage help"
To view the discussion, visit: http://community.zenoss.org/message/72278#72278
--------------------------------------------------------------
The woes of my cursed Multi-Graph script continue:
I know I can use rpt.getGraphDefs() to return all of the GraphDef objects that belong to a given report. However I should be able to use rpt.getGraphDef(graphdef.id) to return a specific graph definition. Except it doesn't work.
Assume all previous variables are created correctly.
...        print gdef.id
...        type(gdef)
...        type(gdef.id)
...
MSF test-xx-test in
<type 'ImplicitAcquirerWrapper'>
<type 'str'>
This is as expected.
It doesn't work as I'm expecting.
...    if rpt.getGraphDef(gdef.id):
...        print "Holy Cow it's worked!"
...
Doesn't result in anything.
I'm super stumped on this one. I've tried working around it using a for in / if loop using getGraphDefs() but this just didn't fit the requirements.
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72278#72278]
Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
"getGraphDef() Usage help"
To view the discussion, visit: http://community.zenoss.org/message/72278#72278
--------------------------------------------------------------
The woes of my cursed Multi-Graph script continue:
I know I can use rpt.getGraphDefs() to return all of the GraphDef objects that belong to a given report. However I should be able to use rpt.getGraphDef(graphdef.id) to return a specific graph definition. Except it doesn't work.
Assume all previous variables are created correctly.
...        print gdef.id
...        type(gdef)
...        type(gdef.id)
...
MSF test-xx-test in
<type 'ImplicitAcquirerWrapper'>
<type 'str'>
This is as expected.
gd = rpt.getGraphDef('MSF test-xx-test in')
type(gd)
<type 'NoneType'>type(gd)
It doesn't work as I'm expecting.
...    if rpt.getGraphDef(gdef.id):
...        print "Holy Cow it's worked!"
...
Doesn't result in anything.
I'm super stumped on this one. I've tried working around it using a for in / if loop using getGraphDefs() but this just didn't fit the requirements.
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72278#72278]
Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]