On 09/24/2009 08:03 PM, Derek Yarnell wrote:
On Sep 24, 2009, at 5:08 PM, Derek Yarnell wrote:
use XMLRPC::Lite;

# Build the connection
my $xmlrpc = XMLRPC::Lite->proxy($uri);
# Login to cobbler xmlrpm and get session token back.
my $token = $xmlrpc->login($user, $password)->result();
# Create new system object
my $object = $cobbler->new_system($token)->result();
$cobbler->modify_system($object, "name", $hostname, $token)->result();
$cobbler->modify_system($object, "hostname", $hostname, $token)-
result();
$cobbler->modify_system($object, "profile", $profile, $token)->result
();
$cobbler->modify_system($object, "gateway", $gateway, $token)->result
();
###
my %eth0 = (
       "macaddress-eth0" =>  $mac,
       "ipaddress-eth0" =>  $ip,
       "static-eth0" =>  1,
       "subnet-eth0" =>  $netmask,
);

$cobbler->modify_system($object, "modify-interface", \%eth0, $token)-
result();
# Commit the system object
my $result = $cobbler->save_system($object, $token)->result();

Answering my own questions!  This changed between 1.6.x and 2.x
instead of modify-interface in the XMLRPC call it should be
modify_interface now in 2.x.  Sigh dunno why this had to change but my
friend remote.py has all the answers :)


Good deal.

The answer is consistency with field names. Before we tolerated mixed usage of "-" foo and "_" but the fields are all named with "_". This made it hard when folks would get back items from methods and wonder why they didn't contain "-" instead of "_". Since we're now pushing folks to use only XMLRPC (and not the internal Python API) because of the way cobblerd works now, this was the right time to make that change.

You may also like the new xapi_ methods which are new (for CLI usage) that allow edits without multiple calls to "modify". You can see this in use in the new command line (though not yet in CobblerWeb).

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to