Skip to content

Commit b8b43a3

Browse files
magianxdtianhao64
authored andcommitted
Fix for issue 239 (#546)
* Fix for issue 239 * Add unittest
1 parent 912e365 commit b8b43a3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pyVmomi/SoapAdapter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,8 @@ def InvokeAccessor(self, mo, info):
16421642
if isinstance(e, self.SESSION_EXCEPTIONS):
16431643
# Our session might've timed out, change our state and retry.
16441644
self._SetStateUnauthenticated()
1645+
retriesLeft -= 1
1646+
continue
16451647
else:
16461648
raise e
16471649
return obj
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import tests
2+
3+
from pyVim import connect
4+
5+
6+
class SoapAdapterTests(tests.VCRTestBase):
7+
def test_invoke_method_login_session_exception(self):
8+
def login_fail(*args, **kwargs):
9+
raise vim_session.SESSION_EXCEPTIONS[0]()
10+
11+
stub = connect.SoapStubAdapter()
12+
vim_session = connect.VimSessionOrientedStub(stub, login_fail)
13+
self.assertRaises(SystemError, vim_session.InvokeAccessor, "mo", "info")

0 commit comments

Comments
 (0)