I'm trying to create a new system profile using perl through the XMLRPC API.
Things work great using python, but when I try to use either of the above perl interfaces, I'm not able to actually write any of the new objects I've created:
Reading items works a charm, and it looks like the calls themselves are succeeding, but the host never shows up in a: #[root@spacewalk cobbler]# cobbler system list | grep test #
I'm wondering what's going wrong here; am I not authenticating properly?
I've tried using both XML::RPC and XMLRPC::Lite, and get similar results, where reads work fine, but nothing actually 'sticks'
Here's the script that I'm using for XMLRPC::Lite
#!/usr/bin/perl
use strict; use warnings; use XMLRPC::Lite; use Data::Dumper;
my $username = 'api-user'; my $password = 'sapi-user'; my $proto = 'http://'; my $servername = 'spacewak'; my $api = '/cobbler_api'; my $url = $proto . $servername . $api; my $name = 'vacsld01test';
my $conn = XMLRPC::Lite->proxy('https://vacslp01spacewalk.cucbc.com/cobbler_api'); my $token = $conn->login($username, $password)->result(); my $object = $conn->new_system($token)->result();
$conn->modify_system($object, 'name', $name, $token)->result(); $conn->modify_system($object, 'hostname', $name, $token)->result(); $conn->save_system($object, $token)->result(); $conn->sync($token)->result();
/var/log/cobbler/cobbler.log has:
Thu Nov 8 16:03:46 2012 - INFO | authenticate; ['api-user', True] Thu Nov 8 16:03:46 2012 - INFO | REMOTE new_item(system); user(api-user) Thu Nov 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'new_system', None, None, True] Thu Nov 8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?) Thu Nov 8 16:03:46 2012 - INFO | REMOTE modify_item(system); user(api-user); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ==); attribute(name) Thu Nov 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'modify_system', <cobbler.item_system.System instance at 0x14350560>, 'name', True] Thu Nov 8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?) Thu Nov 8 16:03:46 2012 - INFO | REMOTE modify_item(system); user(api-user); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ==); attribute(hostname) Thu Nov 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'modify_system', <cobbler.item_system.System instance at 0x14350560>, 'hostname', True] Thu Nov 8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?) Thu Nov 8 16:03:46 2012 - INFO | REMOTE save_item(system); user(api-user); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ==) Thu Nov 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'save_system', <cobbler.item_system.System instance at 0x14350560>, None, True] Thu Nov 8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?) Thu Nov 8 16:03:46 2012 - INFO | add_item(system); ['vacsld01test'] Thu Nov 8 16:03:46 2012 - DEBUG | get_items; ['system'] Thu Nov 8 16:03:46 2012 - INFO | REMOTE sync; user(api-user) Thu Nov 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'sync', None, None, True] Thu Nov 8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?) Thu Nov 8 16:03:46 2012 - INFO | sync Thu Nov 8 16:03:46 2012 - INFO | running pre-sync triggers Thu Nov 8 16:03:46 2012 - INFO | cleaning trees
I'm using:
cobbler2-2.0.11-4.el5 ( CentOS 5.8) perl v5.10.1 XMLRPC::Lite 0.715