Changed text mechanism to userpass, also changed error message
This commit is contained in:
@@ -179,7 +179,7 @@ class VimSessionOrientedStub(SessionOrientedStub):
|
||||
|
||||
def Connect(host='localhost', port=443, user='root', pwd='',
|
||||
service="hostd", adapter="SOAP", namespace=None, path="/sdk",
|
||||
version=None, keyFile=None, certFile=None, b64token=None, mechanism='text'):
|
||||
version=None, keyFile=None, certFile=None, b64token=None, mechanism='userpass'):
|
||||
"""
|
||||
Connect to the specified server, login and return the service
|
||||
instance object.
|
||||
@@ -215,7 +215,7 @@ def Connect(host='localhost', port=443, user='root', pwd='',
|
||||
@type certFile: string
|
||||
@param b64token: base64 encoded token
|
||||
@type b64token: string
|
||||
@param mechanism: authentication mechanism: text or sspi
|
||||
@param mechanism: authentication mechanism: userpass or sspi
|
||||
@type mechanism: string
|
||||
"""
|
||||
try:
|
||||
@@ -236,13 +236,13 @@ def Connect(host='localhost', port=443, user='root', pwd='',
|
||||
version="vim.version.version6"
|
||||
|
||||
si, stub = None, None
|
||||
if mechanism == 'text':
|
||||
if mechanism == 'userpass':
|
||||
si, stub = __Login(host, port, user, pwd, service, adapter, version, path,
|
||||
keyFile, certFile)
|
||||
elif mechanism == 'sspi':
|
||||
si, stub = __LoginBySSPI( host, port, service, adapter, version, path, keyFile, certFile, b64token )
|
||||
else:
|
||||
raise Exception( 'The provided connection mechanism is not available' )
|
||||
raise Exception( 'The provided connection mechanism is not available, the supported mechanisms are userpass or sspi' )
|
||||
|
||||
SetSi(si)
|
||||
|
||||
@@ -612,7 +612,7 @@ def __FindSupportedVersion(protocol, server, port, path, preferredApiVersions):
|
||||
|
||||
def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd='',
|
||||
service="hostd", path="/sdk",
|
||||
preferredApiVersions=None, b64token=None, mechanism='text'):
|
||||
preferredApiVersions=None, b64token=None, mechanism='userpass'):
|
||||
"""
|
||||
Determine the most preferred API version supported by the specified server,
|
||||
then connect to the specified server using that API version, login and return
|
||||
|
||||
Reference in New Issue
Block a user