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