Commit 3961c2e
committed
Enable HTTP Proxies for iControlRESTTokenAuth
Issues:
Fixes #172
Problem:
The `proxies` attribute is available on the `iControlRESTSession` object,
however it does not get passed to the `iControlRESTTokenAuth` object.
As a result, if all communication with a BigIP device needs to take place
via a Proxy, authentication will fail and timeout.
Analysis:
I added `proxies` as a Kwarg on the `iControlRESTTokenAuth` object.
I then passed that argument in from the `iControlRESTSession` object
instantiations of the `iControlRESTTokenAuth` object.
I then added `proxies=self.proxies` to the two instances of
`requests.<verb>` in the `iControlRESTTokenAuth` object.
Tests:
I am unable to run the tests as listed in the documentation as even in 1.0 branch,
`py.test --cov ./ --cov-report=html` returns:
`argparse.ArgumentError: argument --bigip: conflicting option string: --bigip`
I did successfully test with and without proxies, by installing my fork/branch
and testing against a live BigIP
With Proxies:
In [1]: paste
from f5.bigip import ManagementRoot
from getpass import getpass
password = getpass()
user = "test_user"
host = "test_f5.local"
mah_f5 = ManagementRoot(hostname=host, username=user, password=password, proxies={"https": "socks5://127.0.0.1:8000"}, auth_provider="tmos")
mah_f5.tmos_version
## -- End pasted text --
Password:
Out[1]: '14.1.2.3'
Without Proxies:
In [1]: paste
from f5.bigip import ManagementRoot
from getpass import getpass
password = getpass()
user = "test_user"
host = "localhost"
port = 30002
mah_f5 = ManagementRoot(hostname=host, port=port, username=user, password=password, auth_provider="tmos")
mah_f5.tmos_version
## -- End pasted text --
Password:
Out[1]: '14.1.2.3'1 parent cd1ab32 commit 3961c2e
2 files changed
Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
150 | | - | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | | - | |
| 441 | + | |
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
0 commit comments