1
0
mirror of https://github.com/vmware/vsphere-automation-sdk-python.git synced 2024-11-23 01:49:59 -05:00

update readme and fix a bug in print_service.py

This commit is contained in:
Tianhao He 2017-01-24 16:50:27 -08:00
parent aa5291b8e2
commit 0281721bbc
2 changed files with 18 additions and 4 deletions

View File

@ -1,9 +1,14 @@
This directory contains samples for Platform Service Controller, SSO and Lookup Service APIs: This directory contains samples for Platform Service Controller, SSO and Lookup Service APIs:
The vSphere Automation SDK for Python samples use the vSphere Automation Lookup Service
to obtain the URLs for other vSphere Automation services (SSO, vAPI, VIM, SPBM, etc.).
The SDK contains the Lookup Service WSDL files. The samples use the python SUDS client
for accessing the lookup service. The Lookup Service WSDL files are located in wsdl/ directory.
Running the samples Running the samples
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin * $ cd /path/to/vsphere-automation-sdk-python-samples/bin
* $ ./run_sample.sh ../samples/vsphere/tagging/tagging_workflow.py --server <vCenter Server IP> --username <username> --password <password> --clustername <clustername> --categoryname <categoryname> --categorydesc <categorydesc> --tagname <tagname> -tagdesc <tagdesc> -v * $ ./run_sample.sh ../samples/vsphere/sso/print_services.py --lswsdlurl file:///path/to/vsphere-automation-sdk-python-samples/samples/vsphere/sso/wsdl/lookupservice.wsdl --lssoapurl https://<sso_server>/lookupservice/sdk -v
* Testbed Requirement: * Testbed Requirement:
- 1 vCenter Server - 1 vCenter Server

View File

@ -32,8 +32,13 @@ class PrintServices(object):
def options(self): def options(self):
self.argparser = argparse.ArgumentParser(description=self.__doc__) self.argparser = argparse.ArgumentParser(description=self.__doc__)
# setup the argument parser # setup the argument parser
self.argparser.add_argument('-lswsdlurl', '--lswsdlurl', help='Lookup service WSDL URL') self.argparser.add_argument('-w', '--lswsdlurl',
self.argparser.add_argument('-lssoapurl', '--lssoapurl', help='Lookup service SOAP URL') help='Lookup service WSDL URL')
self.argparser.add_argument('-s', '--lssoapurl',
help='Lookup service SOAP URL')
self.argparser.add_argument('-v', '--skipverification',
action='store_true',
help='Do not verify server certificate')
self.args = self.argparser.parse_args() # parse all the sample arguments when they are all set self.args = self.argparser.parse_args() # parse all the sample arguments when they are all set
def setup(self): def setup(self):
@ -45,9 +50,13 @@ class PrintServices(object):
assert self.lssoapurl is not None assert self.lssoapurl is not None
print('lssoapurl: {0}'.format(self.lssoapurl)) print('lssoapurl: {0}'.format(self.lssoapurl))
self.skip_verification = self.args.skipverification
def execute(self): def execute(self):
print('Connecting to lookup service url: {0}'.format(self.lssoapurl)) print('Connecting to lookup service url: {0}'.format(self.lssoapurl))
lookupservicehelper = LookupServiceHelper(wsdl_url=self.lswsdlurl, soap_url=self.lssoapurl) lookupservicehelper = LookupServiceHelper(wsdl_url=self.lswsdlurl,
soap_url=self.lssoapurl,
skip_verification=self.skip_verification)
lookupservicehelper.connect() lookupservicehelper.connect()
# print the PSC nodes and SSO service endpoint URLs # print the PSC nodes and SSO service endpoint URLs