Fix SessionOrientedStub and StubAdapterAccessor
This commit is contained in:
@@ -1441,10 +1441,10 @@ class SessionOrientedStub(StubAdapterBase):
|
||||
'''
|
||||
assert callable(loginMethod)
|
||||
assert retryCount >= 0
|
||||
StubAdapterBase.__init__(self, version=soapStub.version)
|
||||
|
||||
self.lock = threading.Lock()
|
||||
self.soapStub = soapStub
|
||||
self.version = soapStub.version
|
||||
self.state = self.STATE_UNAUTHENTICATED
|
||||
|
||||
self.loginMethod = loginMethod
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# VMware vSphere Python SDK
|
||||
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -38,4 +38,11 @@ class StubAdapterAccessorMixin:
|
||||
if not self._pc:
|
||||
si = self._siType("ServiceInstance", self)
|
||||
self._pc = si.RetrieveContent().propertyCollector
|
||||
return self._pc.RetrieveContents([filterSpec])[0].propSet[0].val
|
||||
result = self._pc.RetrievePropertiesEx(specSet=[filterSpec],
|
||||
options=self._pcType.RetrieveOptions(maxObjects=1))
|
||||
objectContent = result.objects[0]
|
||||
if len(objectContent.propSet) > 0:
|
||||
return objectContent.propSet[0].val
|
||||
if len(objectContent.missingSet) > 0 and objectContent.missingSet[0].fault:
|
||||
raise objectContent.missingSet[0].fault
|
||||
return None
|
||||
|
Reference in New Issue
Block a user