better error handling on pycontrol auth errors?

One thing I’ve noticed when working with the pycontrol v2 libraries is that if you don’t set up your BIGIP object with correct username/password credentials, two things happen:

1. There is a timeout of almost three and a half minutes before any response is registered.

2. The returned error is not the documented Common::AccessDenied exception. Consider the following code:

---

import pycontrol.pycontrol as pc

user = ‘cwoodfield’

passwd = ‘incorrect_passwd’

lb = ‘lb_hostname’

b = pc.BIGIP(hostname = lb, username = user, password = passwd,

fromurl = True, wsdls = [‘LocalLB.Pool’])

try:

list = b.LocalLB.Pool.get_list()

print list

except Exception, e:

print e

---

When I run this with “time” I get:

$ time python2.6 test_failed_login.py

maximum recursion depth exceeded while calling a Python object

real3m28.308s

user0m1.002s

sys0m0.074s

---

Is this a known issue? Are there any additional parameters I can set to reduce the timeout here? Thanks!

Hi Chris,

1) This looks similar to a known python bug: “Using an invalid username or password while attempting to authenticate against HTTPS via the urllib2 module resulted in infinite recursion. This behavior has been patched, and urllib2 now attempts authentication a maximum of five times before authentication is considered failed.”

(Please see https://bugzilla.redhat.com/show\_bug.cgi?id=649274)

2) This lightweight iControl python lib is easy to use, troubleshoot and allows you to specify a timeout: bit.ly/PAisxi

Hope this helps,

Marc