Hi again,
We're trying to get Capistrano to talk to cobbler for automated
deployment based on puppet classes (Cobbler is the "source of truth"
on our network).
I'm basically trying to replicate:
import xmlrpclib
remote = xmlrpclib.Server("http://cobbler/cobbler_api")
mgmt_class = raw_input("Please choose a puppet class: ")
for system_name in remote.find_system({'mgmt_classes':mgmt_class}):
fqdn =
remote.get_system_for_koan(system_name)['interfaces']['eth0']['hostname']
first_part = fqdn.split('.')[:1]
if first_part[0].split('-')[:1][0] != "ci":
print fqdn
however I can't seem to get the call to the API correct in Ruby (the
above python works fine).
I can get as far as the following before it fails:
require 'rubygems'
require 'xmlrpc/client'
server = XMLRPC::Client.new2("http://192.168.0.13/cobbler_api")
servers = server.call2('find_system',"{'mgmt_classes':'default'}")
puts servers
and then it errors with the following error in cobbler.log:
Tue Jun 28 15:39:17 2011 - INFO | REMOTE find_items(system);
criteria(mgmt_classes); sort(None); user(?)
Tue Jun 28 15:39:17 2011 - INFO | find_items; ['system']
Tue Jun 28 15:39:17 2011 - INFO | Exception occured: exceptions.TypeError
Tue Jun 28 15:39:17 2011 - INFO | Exception value: find() argument
after ** must be a dictionary
Tue Jun 28 15:39:17 2011 - INFO | Exception Info:
File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line
1759, in _dispatch
return method_handle(*params)
File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line
586, in find_system
return self.find_items("system",criteria,expand=expand)
File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line
573, in find_items
items = self.api.find_items(what,criteria=criteria)
File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 426,
in find_items
res=items.find(return_list=True, no_errors=False, **criteria)
Using the Cobbler Gem doesn't appear to work either (I can't find the
correct method to use to search based on "mgmt_classes").
Can anyone help?
Thanks,
Matt
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler