You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Craig L Russell <cr...@oracle.com> on 2015/11/23 22:57:09 UTC

Bug in icla-lint

If the script is unable to contact the LDAP server, this line fails silently:

  ldap = ASF::Person.list.map(&:id)

Maybe it’s supposed to. What does it return if the server is unreachable? An empty array? Doesn’t seem to return an exception.

If it’s empty, every line shows as “not in LDAP’.

I’ll see if I can skip the ldap check if the ldap array has no elements.

Craig

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@oracle.com
P.S. A good JDO? O, Gasp!


Re: Bug in icla-lint

Posted by Sam Ruby <ru...@intertwingly.net>.
On Mon, Nov 23, 2015 at 11:50 PM, Craig L Russell
<cr...@oracle.com> wrote:
> I’m not an expert in ruby or this library, but the result of
>
>  ldap = ASF::Person.list.map(&:id)
>
> is an empty array if LDAP isn’t reachable. Does map work on nil?

Nope:

$ irb
irb(main):001:0> nil.map
NoMethodError: undefined method `map' for nil:NilClass
    from (irb):1
    from /usr/bin/irb:12:in `<main>'

- Sam Ruby

Re: Bug in icla-lint

Posted by Craig L Russell <cr...@oracle.com>.
I’m not an expert in ruby or this library, but the result of 

 ldap = ASF::Person.list.map(&:id)

is an empty array if LDAP isn’t reachable. Does map work on nil?

> On Nov 23, 2015, at 2:32 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> 
> On Mon, Nov 23, 2015 at 4:57 PM, Craig L Russell
> <cr...@oracle.com> wrote:
>> If the script is unable to contact the LDAP server, this line fails silently:
>> 
>>  ldap = ASF::Person.list.map(&:id)
>> 
>> Maybe it’s supposed to. What does it return if the server is unreachable? An empty array? Doesn’t seem to return an exception.
> 
> If the server is unreachable, "ASF.ldap" should be nil, so perhaps
> something like this at the top of the script may be useful:
> 
>  ldap_down = ASF.ldap.nil?

Right. Maybe in addition to ignoring the LDAP checks there should be a warning message at the top of the web page. 
> 
>> If it’s empty, every line shows as “not in LDAP’.
>> 
>> I’ll see if I can skip the ldap check if the ldap array has no elements.
> 
> Might also be worth adding some text to the top or bottom of the
> output so to indicate that there was a problem accessing the LDAP
> server.
> 
>> Craig
>> 
>> Craig L Russell
>> Architect, Oracle
>> http://db.apache.org/jdo
>> 408 276-5638 mailto:Craig.Russell@oracle.com
>> P.S. A good JDO? O, Gasp!
> 
> - Sam Ruby
> 
> P.S.  Do you have some local changes that can be committed?  I see a
> lot of "Your Apache ICLA has gone missing" messages went out…

I’ve committed all of my changes, including the “ignore LDAP checks if ldap is empty.

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@oracle.com
P.S. A good JDO? O, Gasp!


Re: Bug in icla-lint

Posted by Sam Ruby <ru...@intertwingly.net>.
On Mon, Nov 23, 2015 at 4:57 PM, Craig L Russell
<cr...@oracle.com> wrote:
> If the script is unable to contact the LDAP server, this line fails silently:
>
>   ldap = ASF::Person.list.map(&:id)
>
> Maybe it’s supposed to. What does it return if the server is unreachable? An empty array? Doesn’t seem to return an exception.

If the server is unreachable, "ASF.ldap" should be nil, so perhaps
something like this at the top of the script may be useful:

  ldap_down = ASF.ldap.nil?

> If it’s empty, every line shows as “not in LDAP’.
>
> I’ll see if I can skip the ldap check if the ldap array has no elements.

Might also be worth adding some text to the top or bottom of the
output so to indicate that there was a problem accessing the LDAP
server.

> Craig
>
> Craig L Russell
> Architect, Oracle
> http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@oracle.com
> P.S. A good JDO? O, Gasp!

- Sam Ruby

P.S.  Do you have some local changes that can be committed?  I see a
lot of "Your Apache ICLA has gone missing" messages went out...