Mailing List Archive

Getting Error with bric_soap & cron
Hi all,

I have a cron job that calls:

bric_soap --search desk_id=1036 story list_ids

This runs ok usually but between 00:00 and 03:00 I often get an error:

Can't call method "fault" on an undefined value at
/usr/local/bricolage/bin/bric_soap line 436

Which points to this:

430 # login
431 if (!$use_cookie) {
432 print STDERR "$module $command: Authenticating to Bricolage...\n"
433 if $verbose;
434 my $response = $soap->login(name(username => $username),
435 name(password => $password));
436 die "Login failed.\n" if $response->fault; # <<<--- ERROR HERE
437 print STDERR "$module $command: Login success.\n" if $verbose;
438 } else {
439 print STDERR "$module $command: Attempting to use cookie file
$use_cookie\n"
440 if $verbose;
441 }

So, Im guessing that this should probably re-written as:

my $response = $soap->login(name(username => $username),
name(password => $password))
|| die "Login failed: $!\n";

And remove the line that checks for "$response->fault", since at the
time $response would not be defined if the previous call to
"$soap->login()" fails.

I haven't tested this yet as it seems to be working for the moment. So,
does this look like a good fix for the error I'm getting or is there a
better way?

Adeola.

--

Creative Developer - Digital Craftsmen Ltd
Exmouth House, 3 Pine Street
London, EC1R 0JH
t: +44 20 7183 1410
f: +44 20 7099 5140
m: +44 75 9527 7886
w: http://www.digitalcraftsmen.net/
Re: Getting Error with bric_soap & cron [ In reply to ]
Forgot to mention that I'm running Bric 1.11.2 on Linux.

+A

On 23/4/09 10:04, Adeola Awoyemi wrote:
> Hi all,
>
> I have a cron job that calls:
>
> bric_soap --search desk_id=1036 story list_ids
>
> This runs ok usually but between 00:00 and 03:00 I often get an error:
>
> Can't call method "fault" on an undefined value at
> /usr/local/bricolage/bin/bric_soap line 436
>
> Which points to this:
>
> 430 # login
> 431 if (!$use_cookie) {
> 432 print STDERR "$module $command: Authenticating to Bricolage...\n"
> 433 if $verbose;
> 434 my $response = $soap->login(name(username => $username),
> 435 name(password => $password));
> 436 die "Login failed.\n" if $response->fault; # <<<--- ERROR HERE
> 437 print STDERR "$module $command: Login success.\n" if $verbose;
> 438 } else {
> 439 print STDERR "$module $command: Attempting to use cookie file
> $use_cookie\n"
> 440 if $verbose;
> 441 }
>
> So, Im guessing that this should probably re-written as:
>
> my $response = $soap->login(name(username => $username),
> name(password => $password))
> || die "Login failed: $!\n";
>
> And remove the line that checks for "$response->fault", since at the
> time $response would not be defined if the previous call to
> "$soap->login()" fails.
>
> I haven't tested this yet as it seems to be working for the moment.
> So, does this look like a good fix for the error I'm getting or is
> there a better way?
>
> Adeola.
>


--
Creative Developer - Digital Craftsmen Ltd
Exmouth House, 3 Pine Street
London, EC1R 0JH
t: +44 20 7183 1410
f: +44 20 7099 5140
m: +44 75 9527 7886
w: http://www.digitalcraftsmen.net/
Re: Getting Error with bric_soap & cron [ In reply to ]
On 23/4/09 10:08, Adeola Awoyemi wrote:
> Forgot to mention that I'm running Bric 1.11.2 on Linux.
>
> On 23/4/09 10:04, Adeola Awoyemi wrote:
>> Hi all,
>>
>> I have a cron job that calls:
>>
>> bric_soap --search desk_id=1036 story list_ids
>>
>> This runs ok usually but between 00:00 and 03:00 I often get an error:
>>
>> Can't call method "fault" on an undefined value at
>> /usr/local/bricolage/bin/bric_soap line 436
>>
>> Which points to this:
>>
>> 430 # login
>> 431 if (!$use_cookie) {
>> 432 print STDERR "$module $command: Authenticating to
>> Bricolage...\n"
>> 433 if $verbose;
>> 434 my $response = $soap->login(name(username => $username),
>> 435 name(password => $password));
>> 436 die "Login failed.\n" if $response->fault; # <<<--- ERROR HERE
>> 437 print STDERR "$module $command: Login success.\n" if $verbose;
>> 438 } else {
>> 439 print STDERR "$module $command: Attempting to use cookie
>> file $use_cookie\n"
>> 440 if $verbose;
>> 441 }
>>
>> So, Im guessing that this should probably re-written as:
>>
>> my $response = $soap->login(name(username => $username),
>> name(password => $password))
>> || die "Login failed: $!\n";
>>
>> And remove the line that checks for "$response->fault", since at the
>> time $response would not be defined if the previous call to
>> "$soap->login()" fails.
>>
>> I haven't tested this yet as it seems to be working for the moment.
>> So, does this look like a good fix for the error I'm getting or is
>> there a better way?
>>
Also, there is no check to see if $soap is defined as the problem could
also be from that. So this is also a possible fix (diff):

--- /usr/local/bricolage/bin/bric_soap.original 2009-04-23
11:23:40.000000000 +0100
+++ /usr/local/bricolage/bin/bric_soap 2009-04-23 11:24:21.000000000
+0100
@@ -411,6 +411,8 @@
my $soap = new SOAP::Lite
uri => 'http://bricolage.sourceforge.net/Bric/SOAP/Auth',
readable => $verbose > 2 || 0;
+die "Couldn't create SOAP::Lite object: $!\n" unless $soap;
+
$server = "http://$server" unless $server =~ m!^https?://!;
my $cookie_string;


+A

--
Creative Developer - Digital Craftsmen Ltd
Exmouth House, 3 Pine Street
London, EC1R 0JH
t: +44 20 7183 1410
f: +44 20 7099 5140
m: +44 75 9527 7886
w: http://www.digitalcraftsmen.net/
Re: Getting Error with bric_soap & cron [ In reply to ]
On 23/4/09 11:28, Adeola Awoyemi wrote:
>
>>>
>>> So, Im guessing that this should probably re-written as:
>>>
>>> my $response = $soap->login(name(username => $username),
>>> name(password => $password))
>>> || die "Login failed: $!\n";
>>>
>
OK. I started getting the error again and it fails at the line above with:

"Login failed: Bad file descriptor"

Huh??? I don't know what that means!? Anyone got any ideas?


+A

--
Creative Developer - Digital Craftsmen Ltd
Exmouth House, 3 Pine Street
London, EC1R 0JH
t: +44 20 7183 1410
f: +44 20 7099 5140
m: +44 75 9527 7886
w: http://www.digitalcraftsmen.net/
Re: Getting Error with bric_soap & cron [ In reply to ]
On Apr 23, 2009, at 6:10 AM, Adeola Awoyemi wrote:

> OK. I started getting the error again and it fails at the line above
> with:
>
> "Login failed: Bad file descriptor"
>
> Huh??? I don't know what that means!? Anyone got any ideas?

Love SOAP::Lite.

http://www.google.com/search?hl=en&safe=off&q=SOAP%3A%3ALite+%22Bad+file+descriptor%22&btnG=Search

Best,

David