Forum Discussion
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
real 3m28.308s
user 0m1.002s
sys 0m0.074s
---
Is this a known issue? Are there any additional parameters I can set to reduce the timeout here? Thanks!
1 Reply
- Marc_Chisinevsk
Nimbostratus
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
