Add interface to system through XMLRPC

Stuart Sears stuart at sjsears.com
Fri Jul 22 19:26:16 UTC 2011


On 22/07/11 17:30, Paul van der Mark wrote:
> Dear list,
> 
> We are moving our existing cluster (rocks, centos 5.4 based) to RHEL 6
> this summer and I'm pretty new with regards to cobbler. I'm trying to
> add hosts to cobbler on our satellite server using XMLRPC from a remove
> machine. I can add hosts, but I can't seem to find the right rpc call to
> add an interface; I found some old webpages mentioning
> "modify_interface" but it looks like all X_interface calls are gone? I
> have read the cobbler wiki, but the CobblerXmlrpc page doesn't mention
> anything about interfaces.

> Is anyone on the list using cobbler's RPC facility to create/modify
> hosts and if so, what would be a good source of information?
> 
> Cobbler: cobbler-2.0.7-11.el5sat
> Perl and the Frontier package for RPC.

well, I've not done this with the rhn satellite integrated version of
cobbler, but this works for me with python and xmlrpclib... you should
be able to translate it into perl easily enough.

Assuming you have a system handle ('sysid' here, you can get that from
the xmlrpc 'get_system_handle' call) and 'tok' is a valid xmlrpc session
token from the cobbler server:

The call you seem to need is the 'modify_interface' call, part of
modify_system (I recall it taking me some time to figure this out, too)

self.session.modify_system(sysid,
   'modify_interface',
   {
   "%s-%s" %(param, iface) : value,
   }, tok )

where param is something like 'ipaddress' and iface is (e.g.) 'eth0'
so you get a dict (or hash if you like) similar to
{
'ip_address-eth0' : '192.168.1.45',
'subnet-eth0' : '255.255.255.0',
'mac_address-eth0' : '00:11:22:33:44:55',
...
}

modifying a non-existent interface seems to add it.

regards,

Stuart


More information about the cobbler mailing list