Discussion:
zendmd - problem with getTitleOrId
panoptician
2012-10-11 23:36:23 UTC
Permalink
panoptician [http://community.zenoss.org/people/panoptician] created the discussion

"zendmd - problem with getTitleOrId"

To view the discussion, visit: http://community.zenoss.org/message/69043#69043

--------------------------------------------------------------
I'm trying to automate the deletion of devices, some of which have a title and some only have an ID. This can successfully match and delete based off ID:

import re
p = re.compile('^string', re.IGNORECASE)
for d in dmd.Devices.getSubDevices():
    if p.match(d.getDeviceName()):
        d.deleteDevice()

But I'm trying to match based off the title, so I tried using getTitleOrId instead. This just gives me an attribute error, but I can do a "print d.titleOrId()" and get exactly what I expect. What's preventing me from using getTitleOrId in this instance?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69043#69043]

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]
jcurry
2012-10-12 08:43:58 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: zendmd - problem with getTitleOrId"

To view the discussion, visit: http://community.zenoss.org/message/69052#69052

--------------------------------------------------------------
The function you want is just titleOrId - no get.  Is this what you want??  Obviously you change my print statement to your delete.
Post by panoptician
import re
p = re.compile('^group', re.IGNORECASE)
...   if p.match(d.titleOrId()):
...     print d.id
...
group-100-r3.class.example.org
group-100-serv1.class.example.org
group-100-r2.class.example.org
group-100-s2.class.example.org
group-100-r1.class.example.org
group-100-c3.class.example.org
group-100-c2.class.example.org
group-100-c1.class.example.org
group-100-b2.class.example.org
group-100-b1.class.example.org
group-100-s1.class.example.org
Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69052#69052]

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]
panoptician
2012-10-12 17:23:10 UTC
Permalink
panoptician [http://community.zenoss.org/people/panoptician] created the discussion

"Re: zendmd - problem with getTitleOrId"

To view the discussion, visit: http://community.zenoss.org/message/69119#69119

--------------------------------------------------------------
Wow, that was rather obvious. I found references to getTitleOrId online and thought that I should be using different function in this context.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69119#69119]

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]
Ryan Matte
2012-10-12 08:59:31 UTC
Permalink
Ryan Matte [http://community.zenoss.org/people/rmatte] created the discussion

"Re: zendmd - problem with getTitleOrId"

To view the discussion, visit: http://community.zenoss.org/message/69072#69072

--------------------------------------------------------------
Jane is correct, the function is just titleOrid().  That's the correct one to use.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69072#69072]

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]
panoptician
2012-10-12 16:54:16 UTC
Permalink
panoptician [http://community.zenoss.org/people/panoptician] created the discussion

"Re: zendmd - problem with getTitleOrId"

To view the discussion, visit: http://community.zenoss.org/message/69118#69118

--------------------------------------------------------------
I thought I had to use a different function in this context. Thanks!
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69118#69118]

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]
Loading...