No subject


Fri Nov 9 03:22:17 UTC 2012


#!/usr/bin/perl

use strict;
use warnings;
use XMLRPC::Lite;
use Data::Dumper;
use diagnostics;

my $username =3D 'api-user';
my $password =3D 'api-user';
my $proto =3D 'http://';
my $servername =3D 'spacewalk';
my $api =3D '/cobbler_api';
my $url =3D $proto . $servername . $api;
my $name =3D 'vacsld01test';


my $conn =3D XMLRPC::Lite->proxy('https://vacslp01spacewalk.cucbc.com/cobbl=
er_api');
my $token =3D $conn->login($username, $password)->result();
my $object =3D $conn->new_system($token)->result();
print "new system id is $object\n";

my $ret;
$ret =3D $conn->modify_system($object, 'name', $name, $token)->result();
print "modify name:" . $ret . "\n";
$ret =3D $conn->modify_system($object, 'hostname', $name, $token)->result()=
;
print "modify hostname: " . $ret . "\n";
$ret =3D $conn->save_system($object, $token);
print "save system: " . $ret . "\n";
$ret =3D $conn->sync($token)->result();
print "sync:" . $ret . "\n";

From: cobbler-bounces at lists.fedorahosted.org [mailto:cobbler-bounces at lists.=
fedorahosted.org] On Behalf Of James Clendenan
Sent: Thursday, November 08, 2012 5:32 PM
To: cobbler mailing list
Subject: Re: [cobbler] Problems with writing systems through the XMLRPC API=
 using perl XML::RPC or XMLRPC::Lite

I'm not going to be much help on this, but one thought I would have is that=
 you're not checking the return of the result call, which could be trying t=
o tell you something about an error.  I do recall when trying to do a pytho=
n interface to do similar, it was usually that I was missing one of the req=
uired host fields.

You should also take a look at the test cases for the webui as it also uses=
 the xmlrpc interface for it's work.

James
On Thu, Nov 8, 2012 at 4:10 PM, Jason Barlow <jbarlow at central1.com<mailto:j=
barlow at central1.com>> wrote:
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 p=
erl 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 suc=
ceeding, but the host never shows up in a:
#[root at 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, w=
here 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 =3D 'api-user';
my $password =3D 'sapi-user';
my $proto =3D 'http://';
my $servername =3D 'spacewak';
my $api =3D '/cobbler_api';
my $url =3D $proto . $servername . $api;
my $name =3D 'vacsld01test';


my $conn =3D XMLRPC::Lite->proxy('https://vacslp01spacewalk.cucbc.com/cobbl=
er_api');
my $token =3D $conn->login($username, $password)->result();
my $object =3D $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', No=
ne, None, True]
Thu Nov  8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: Tr=
ue; user(?)
Thu Nov  8 16:03:46 2012 - INFO | REMOTE modify_item(system); user(api-user=
); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ=3D=3D); at=
tribute(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: Tr=
ue; user(?)
Thu Nov  8 16:03:46 2012 - INFO | REMOTE modify_item(system); user(api-user=
); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ=3D=3D); at=
tribute(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: Tr=
ue; user(?)
Thu Nov  8 16:03:46 2012 - INFO | REMOTE save_item(system); user(api-user);=
 object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ=3D=3D)
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: Tr=
ue; 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, No=
ne, True]
Thu Nov  8 16:03:46 2012 - DEBUG | REMOTE api-user authorization result: Tr=
ue; 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

_______________________________________________
cobbler mailing list
cobbler at lists.fedorahosted.org<mailto:cobbler at lists.fedorahosted.org>
https://lists.fedorahosted.org/mailman/listinfo/cobbler


--_000_4470426D5F017A46BE3A83292FD5D2B54AB6887DE8EVS1csadcentr_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"><head><meta http-equiv=3DContent-Type content=
=3D"text/html; charset=3Dus-ascii"><meta name=3DGenerator content=3D"Micros=
oft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
span.EmailStyle17
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
span.EmailStyle20
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue vli=
nk=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal><span style=3D'f=
ont-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Solved:<o=
:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;fo=
nt-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p=
><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri"=
,"sans-serif";color:#1F497D'>The problem was that I wasn&#8217;t calling en=
ough methods before calling save_system.<o:p></o:p></span></p><p class=3DMs=
oNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";=
color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=
=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The =
same code saves the system if I add a modify_system &#8216;network&#8217; o=
r a modify_system &#8216;profile&#8217; after modifying the hostname.<o:p><=
/o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-f=
amily:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sa=
ns-serif";color:#1F497D'>Thx!<o:p></o:p></span></p><p class=3DMsoNormal><sp=
an style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F49=
7D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'font-si=
ze:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:=
p></span></p><div><div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;=
padding:3.0pt 0in 0in 0in'><p class=3DMsoNormal><b><span style=3D'font-size=
:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style=3D'f=
ont-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jason Barlow <br><b>Sen=
t:</b> Friday, November 09, 2012 9:30 AM<br><b>To:</b> cobbler mailing list=
<br><b>Subject:</b> RE: [cobbler] Problems with writing systems through the=
 XMLRPC API using perl XML::RPC or XMLRPC::Lite<o:p></o:p></span></p></div>=
</div><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'=
>Thanks for the suggestion.<o:p></o:p></span></p><p class=3DMsoNormal><span=
 style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D=
'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'font-size=
:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I&#8217;m now che=
cking the return values, and I&#8217;ve removed a failing &#8216;modify_sys=
tem call&#8217;.&nbsp; Everything checks out ok according to the return val=
ues, and I&#8217;m able to read stuff just fine, but the writes just are no=
t taking.<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-siz=
e:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p=
></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-famil=
y:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p clas=
s=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-s=
erif";color:#1F497D'>Output:<o:p></o:p></span></p><p class=3DMsoNormal><spa=
n style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'font-siz=
e:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>new system id is=
 ___NEW___system::G2EjtpYQF6V3eb+WvYbocQcEFSqEOEBoCg=3D=3D<o:p></o:p></span=
></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Cali=
bri","sans-serif";color:#1F497D'>modify name:1<o:p></o:p></span></p><p clas=
s=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-s=
erif";color:#1F497D'>modify hostname: 1<o:p></o:p></span></p><p class=3DMso=
Normal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";c=
olor:#1F497D'>save system: 1<o:p></o:p></span></p><p class=3DMsoNormal><spa=
n style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>sync:1<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-siz=
e:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p=
></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-famil=
y:"Calibri","sans-serif";color:#1F497D'>[root at spacewalk cobbler]# cobbler s=
ystem list | grep vacsld01test<o:p></o:p></span></p><p class=3DMsoNormal><s=
pan style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F4=
97D'>[root at vspacewalk cobbler]#<o:p></o:p></span></p><p class=3DMsoNormal><=
span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F=
497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span style=3D'font-=
size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>From the foll=
owing code:<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-s=
ize:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o=
:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-fam=
ily:"Calibri","sans-serif";color:#1F497D'>#!/usr/bin/perl<o:p></o:p></span>=
</p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calib=
ri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoN=
ormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";co=
lor:#1F497D'>use strict;<o:p></o:p></span></p><p class=3DMsoNormal><span st=
yle=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>u=
se warnings;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-=
size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>use XMLRPC::L=
ite;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.=
0pt;font-family:"Calibri","sans-serif";color:#1F497D'>use Data::Dumper;<o:p=
></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font=
-family:"Calibri","sans-serif";color:#1F497D'>use diagnostics;<o:p></o:p></=
span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"=
Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=
=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-se=
rif";color:#1F497D'>my $username =3D 'api-user';<o:p></o:p></span></p><p cl=
ass=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans=
-serif";color:#1F497D'>my $password =3D 'api-user';<o:p></o:p></span></p><p=
 class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","s=
ans-serif";color:#1F497D'>my $proto =3D 'http://';<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sa=
ns-serif";color:#1F497D'>my $servername =3D 'spacewalk';<o:p></o:p></span><=
/p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibr=
i","sans-serif";color:#1F497D'>my $api =3D '/cobbler_api';<o:p></o:p></span=
></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Cali=
bri","sans-serif";color:#1F497D'>my $url =3D $proto . $servername . $api;<o=
:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;fo=
nt-family:"Calibri","sans-serif";color:#1F497D'>my $name =3D 'vacsld01test'=
;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt=
;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span>=
</p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calib=
ri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoN=
ormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";co=
lor:#1F497D'>my $conn =3D XMLRPC::Lite-&gt;proxy('https://vacslp01spacewalk=
.cucbc.com/cobbler_api');<o:p></o:p></span></p><p class=3DMsoNormal><span s=
tyle=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>=
my $token =3D $conn-&gt;login($username, $password)-&gt;result();<o:p></o:p=
></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-famil=
y:"Calibri","sans-serif";color:#1F497D'>my $object =3D $conn-&gt;new_system=
($token)-&gt;result();<o:p></o:p></span></p><p class=3DMsoNormal><span styl=
e=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>pri=
nt &quot;new system id is $object\n&quot;;<o:p></o:p></span></p><p class=3D=
MsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif=
";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span sty=
le=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>my=
 $ret;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:1=
1.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$ret =3D $conn-&gt;=
modify_system($object, 'name', $name, $token)-&gt;result();<o:p></o:p></spa=
n></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Cal=
ibri","sans-serif";color:#1F497D'>print &quot;modify name:&quot; . $ret . &=
quot;\n&quot;;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'fon=
t-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$ret =3D $c=
onn-&gt;modify_system($object, 'hostname', $name, $token)-&gt;result();<o:p=
></o:p></span></p><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font=
-family:"Calibri","sans-serif";color:#1F497D'>print &quot;modify hostname: =
&quot; . $ret . &quot;\n&quot;;<o:p></o:p></span></p><p class=3DMsoNormal><=
span style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F=
497D'>$ret =3D $conn-&gt;save_system($object, $token);<o:p></o:p></span></p=
><p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri"=
,"sans-serif";color:#1F497D'>print &quot;save system: &quot; . $ret . &quot=
;\n&quot;;<o:p></o:p></span></p><p class=3DMsoNormal><span style=3D'font-si=
ze:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$ret =3D $conn-=
&gt;sync($token)-&gt;result();<o:p></o:p></span></p><p class=3DMsoNormal><s=
pan style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F4=
97D'>print &quot;sync:&quot; . $ret . &quot;\n&quot;;<o:p></o:p></span></p>=
<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNorma=
l><b><span style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Fro=
m:</span></b><span style=3D'font-size:10.0pt;font-family:"Tahoma","sans-ser=
if"'> cobbler-bounces at lists.fedorahosted.org [mailto:cobbler-bounces at lists.=
fedorahosted.org] <b>On Behalf Of </b>James Clendenan<br><b>Sent:</b> Thurs=
day, November 08, 2012 5:32 PM<br><b>To:</b> cobbler mailing list<br><b>Sub=
ject:</b> Re: [cobbler] Problems with writing systems through the XMLRPC AP=
I using perl XML::RPC or XMLRPC::Lite<o:p></o:p></span></p><p class=3DMsoNo=
rmal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal style=3D'margin-bottom:12.0p=
t'>I'm not going to be much help on this, but one thought I would have is t=
hat you're not checking the return of the result call, which could be tryin=
g to tell you something about an error.&nbsp; I do recall when trying to do=
 a python interface to do similar, it was usually that I was missing one of=
 the required host fields.<br><br>You should also take a look at the test c=
ases for the webui as it also uses the xmlrpc interface for it's work.<br><=
br>James<o:p></o:p></p><div><p class=3DMsoNormal>On Thu, Nov 8, 2012 at 4:1=
0 PM, Jason Barlow &lt;<a href=3D"mailto:jbarlow at central1.com" target=3D"_b=
lank">jbarlow at central1.com</a>&gt; wrote:<o:p></o:p></p><div><div><p class=
=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I=
&#8217;m trying to create a new system profile using perl through the XMLRP=
C API.<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;=
mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=
=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Things work great u=
sing python, but when I try to use either of the above perl interfaces, I&#=
8217;m not able to actually write any of the new objects I&#8217;ve created=
:<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-m=
argin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'm=
so-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Reading items works a ch=
arm, and it looks like the calls themselves are succeeding, but the host ne=
ver shows up in a:<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-t=
op-alt:auto;mso-margin-bottom-alt:auto'>#[root at spacewalk cobbler]# cobbler =
system list | grep test<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-mar=
gin-top-alt:auto;mso-margin-bottom-alt:auto'>#<o:p></o:p></p><p class=3DMso=
Normal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<=
o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-mar=
gin-bottom-alt:auto'>I&#8217;m wondering what&#8217;s going wrong here; am =
I not authenticating properly?<o:p></o:p></p><p class=3DMsoNormal style=3D'=
mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p=
 class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:a=
uto'>I&#8217;ve tried using both XML::RPC and XMLRPC::Lite, and get similar=
 results, where reads work fine, but nothing actually &#8216;sticks&#8217;<=
o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-mar=
gin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso=
-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Here&#8217;s the script th=
at I&#8217;m using for XMLRPC::Lite<o:p></o:p></p><p class=3DMsoNormal styl=
e=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p><=
/p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-=
alt:auto'>#!/usr/bin/perl<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-m=
argin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p clas=
s=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>=
use strict;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:=
auto;mso-margin-bottom-alt:auto'>use warnings;<o:p></o:p></p><p class=3DMso=
Normal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>use XML=
RPC::Lite;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:a=
uto;mso-margin-bottom-alt:auto'>use Data::Dumper;<o:p></o:p></p><p class=3D=
MsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbs=
p;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-=
margin-bottom-alt:auto'>my $username =3D 'api-user';<o:p></o:p></p><p class=
=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>m=
y $password =3D 'sapi-user';<o:p></o:p></p><p class=3DMsoNormal style=3D'ms=
o-margin-top-alt:auto;mso-margin-bottom-alt:auto'>my $proto =3D 'http://';<=
o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-mar=
gin-bottom-alt:auto'>my $servername =3D 'spacewak';<o:p></o:p></p><p class=
=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>m=
y $api =3D '/cobbler_api';<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-=
margin-top-alt:auto;mso-margin-bottom-alt:auto'>my $url =3D $proto . $serve=
rname . $api;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-al=
t:auto;mso-margin-bottom-alt:auto'>my $name =3D 'vacsld01test';<o:p></o:p><=
/p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-=
alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top=
-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNo=
rmal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>my $conn =
=3D XMLRPC::Lite-&gt;proxy('<a href=3D"https://vacslp01spacewalk.cucbc.com/=
cobbler_api'" target=3D"_blank">https://vacslp01spacewalk.cucbc.com/cobbler=
_api'</a>);<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:=
auto;mso-margin-bottom-alt:auto'>my $token =3D $conn-&gt;login($username, $=
password)-&gt;result();<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-mar=
gin-top-alt:auto;mso-margin-bottom-alt:auto'>my $object =3D $conn-&gt;new_s=
ystem($token)-&gt;result();<o:p></o:p></p><p class=3DMsoNormal style=3D'mso=
-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p cl=
ass=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
'>$conn-&gt;modify_system($object, 'name', $name, $token)-&gt;result();<o:p=
></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin=
-bottom-alt:auto'>$conn-&gt;modify_system($object, 'hostname', $name, $toke=
n)-&gt;result();<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top=
-alt:auto;mso-margin-bottom-alt:auto'>$conn-&gt;save_system($object, $token=
)-&gt;result();<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-=
alt:auto;mso-margin-bottom-alt:auto'>$conn-&gt;sync($token)-&gt;result();<o=
:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-marg=
in-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-=
margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p cla=
ss=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'=
>/var/log/cobbler/cobbler.log has:<o:p></o:p></p><p class=3DMsoNormal style=
=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></=
p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | authenticate; ['api-user', =
True]<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;m=
so-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | REMOTE ne=
w_item(system); user(api-user)<o:p></o:p></p><p class=3DMsoNormal style=3D'=
mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:4=
6 2012 - DEBUG | authorize; ['api-user', 'new_system', None, None, True]<o:=
p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margi=
n-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - DEBUG | REMOTE api-user =
authorization result: True; user(?)<o:p></o:p></p><p class=3DMsoNormal styl=
e=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16=
:03:46 2012 - INFO | REMOTE modify_item(system); user(api-user); object_id(=
___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ=3D=3D); attribute(name)=
<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-ma=
rgin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - DEBUG | authorize; ['=
api-user', 'modify_system', &lt;cobbler.item_system.System instance at 0x14=
350560&gt;, 'name', True]<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-m=
argin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 201=
2 - DEBUG | REMOTE api-user authorization result: True; user(?)<o:p></o:p><=
/p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-=
alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | REMOTE modify_item(system)=
; user(api-user); object_id(___NEW___system::o0X5NLQrLsh9rXGhtvbuts56aTY6zb=
4JfQ=3D=3D); attribute(hostname)<o:p></o:p></p><p class=3DMsoNormal style=
=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:=
03:46 2012 - DEBUG | authorize; ['api-user', 'modify_system', &lt;cobbler.i=
tem_system.System instance at 0x14350560&gt;, 'hostname', True]<o:p></o:p><=
/p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-=
alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - DEBUG | REMOTE api-user authoriza=
tion result: True; user(?)<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-=
margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 20=
12 - INFO | REMOTE save_item(system); user(api-user); object_id(___NEW___sy=
stem::o0X5NLQrLsh9rXGhtvbuts56aTY6zb4JfQ=3D=3D)<o:p></o:p></p><p class=3DMs=
oNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu No=
v&nbsp; 8 16:03:46 2012 - DEBUG | authorize; ['api-user', 'save_system', &l=
t;cobbler.item_system.System instance at 0x14350560&gt;, None, True]<o:p></=
o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bo=
ttom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - DEBUG | REMOTE api-user auth=
orization result: True; user(?)<o:p></o:p></p><p class=3DMsoNormal style=3D=
'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:=
46 2012 - INFO | add_item(system); ['vacsld01test']<o:p></o:p></p><p class=
=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>T=
hu Nov&nbsp; 8 16:03:46 2012 - DEBUG | get_items; ['system']<o:p></o:p></p>=
<p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt=
:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | REMOTE sync; user(api-user)<o=
:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-marg=
in-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - DEBUG | authorize; ['ap=
i-user', 'sync', None, None, True]<o:p></o:p></p><p class=3DMsoNormal style=
=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thu Nov&nbsp; 8 16:=
03:46 2012 - DEBUG | REMOTE api-user authorization result: True; user(?)<o:=
p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margi=
n-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | sync<o:p></o:p></=
p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | running pre-sync triggers<o=
:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-marg=
in-bottom-alt:auto'>Thu Nov&nbsp; 8 16:03:46 2012 - INFO | cleaning trees<o=
:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-marg=
in-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-=
margin-top-alt:auto;mso-margin-bottom-alt:auto'>I&#8217;m using:<o:p></o:p>=
</p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom=
-alt:auto'>&nbsp;<o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-to=
p-alt:auto;mso-margin-bottom-alt:auto'>cobbler2-2.0.11-4.el5 ( CentOS 5.8)<=
o:p></o:p></p><p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-mar=
gin-bottom-alt:auto'>perl v5.10.1<o:p></o:p></p><p class=3DMsoNormal style=
=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>XMLRPC::Lite 0.715<=
o:p></o:p></p></div></div><p class=3DMsoNormal style=3D'margin-bottom:12.0p=
t'><br>_______________________________________________<br>cobbler mailing l=
ist<br><a href=3D"mailto:cobbler at lists.fedorahosted.org">cobbler at lists.fedo=
rahosted.org</a><br><a href=3D"https://lists.fedorahosted.org/mailman/listi=
nfo/cobbler" target=3D"_blank">https://lists.fedorahosted.org/mailman/listi=
nfo/cobbler</a><o:p></o:p></p></div><p class=3DMsoNormal><o:p>&nbsp;</o:p><=
/p></div></body></html>=

--_000_4470426D5F017A46BE3A83292FD5D2B54AB6887DE8EVS1csadcentr_--


More information about the cobbler mailing list