On Fri, Jul 20, 2012 at 2:57 PM, James Cammarata <[email protected]> wrote:
> On Fri, Jul 20, 2012 at 7:46 AM, Lukas Zuercher > <[email protected]> wrote: > > Hi here, > > > > I would like to check if a particular IP address was already used in > > cobbler. Something like api.cobbler.find_system(ip="192.168.0.1"). > > Unfortunately I was not able to figure out how this would work. > > The find_items() call is what you want: > > a = api.BootAPI() > a.find_items("system",{'ip':'192.168.1.xxx'}) > [<cobbler.item_system.System instance at 0x1cb9560>] > Great, thanks a lot, it is working, but I got strange results. if ip: if cobblerhandle.find_items('system',{'ip':ip}): print "duplicate" else: print "Ok" This code is actually working, when called as cgi it outputs Thu Jul 26 10:16:23 2012 - INFO | find_items; ['system'] Ok When called from CLI it correctly prints Ok or duplicate. Any clues? Thanks, Luke
_______________________________________________ cobbler mailing list [email protected] https://fedorahosted.org/mailman/listinfo/cobbler
