The key is named "mgmt_classes" not "mgmtclass".

Looks like you've kind of re-implemented /usr/bin/cobbler-register, but more 
with the point of modifying the system if it changes.

Be careful putting the cobbler password out on all of your nodes, as it will 
allow modification of the database.


On Monday, January 30, 2012 at 9:07 AM, li...@truthisfreedom.org.uk wrote:

> Hi all,
> 
> I'm writing a ruby script that needs to manipulate the mgmtclass 
> assigned to a system via the XMLRPC api.
> 
> At the moment I have the code below, however although everything else 
> works the mgmtclass remains blank - can anyone help with this?
> 
> I've tried looking at the django web interface as suggested on the 
> wiki to see how this done, however it appears to be driven by the 
> "generic template" section of the code and I can't work out what's 
> going on there!
> 
> I'm happy to contribute to the docs once I've got this working if 
> required, code is as follows (all system information is taken from 
> puppetlabs' facter):
> 
> ===========================
> 
> require 'xmlrpc/client'
> require 'facter'
> 
> server = XMLRPC::Client.new3(:host => "cobbler",:path => "/cobbler_api")
> 
> token = server.call("login","cobbler","password")
> 
> system_id = server.call("new_system","#{token}")
> 
> server.call("modify_system","#{system_id}","name",Facter.value('fqdn'),"#{token}")
> server.call("modify_system","#{system_id}","hostname",Facter.value('fqdn'),"#{token}")
> server.call("modify_system","#{system_id}","modify_interface",Hash[
> "macaddress-eth0" => Facter.value('macaddress_eth0'),
> "ipaddress-eth0" => Facter.value('ipaddress_eth0'),
> "dnsname-eth0" => Facter.value('fqdn')
> ], "#{token}")
> 
> ###### THIS IS THE ISSUE LINE #####
> 
> server.call("modify_system","#{system_id}","mgmtclass",["base"],"#{token}")
> 
> ##################
> 
> server.call("save_system","#{system_id}","#{token}")
> server.call("sync", "#{token}")
> 
> =========================================================
> 
> Thanks in advance,
> 
> Matt
> _______________________________________________
> cobbler mailing list
> cobbler@lists.fedorahosted.org (mailto:cobbler@lists.fedorahosted.org)
> https://fedorahosted.org/mailman/listinfo/cobbler
> 
> 


_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to