Skip to content

Remove run_sample.sh and add a password arg for main.py #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ Please have the details of these available but do not have any configuration pre
### Running the SDK Sample Setup Script
Before executing the samples we'll need to setup the vSphere test environment using one of the sample scripts. Before we run the script we'll need to edit one of the files and provide IP addresses for the various machine instances.

First, from the command line change to the SDK ./bin folder.
First, set PYTHONPATH to use SDK helper methods

```cmd
$ cd /path/to/vsphere-automation-sdk-python-samples/bin
```
* Linux/Mac:

export PYTHONPATH=${PWD}:$PYTHONPATH

* Windows:

set PYTHONPATH=%cd%;%PYTHONPATH%

Next, using a text editor open ../samples/vsphere/vcenter/setup/testbed.py and edit the following settings replace everything in < > brackets with your environment information. Leave the rest of the settings in this file at their default values.

Expand Down Expand Up @@ -114,13 +118,13 @@ This script will perform the following:
**To view the available command-line options:**

```cmd
$ ./run_sample.sh ../samples/vsphere/vcenter/setup/main.py -h
$ python ../samples/vsphere/vcenter/setup/main.py -h
```

**To run the setup script:**

```cmd
$ ./run_sample.sh ../samples/vsphere/vcenter/setup/main.py -sv
$ python ../samples/vsphere/vcenter/setup/main.py -sv
```

After completion you will see from the output and also the vSphere Webclient that the environment has now been fully setup and is ready to easily run further samples.
Expand All @@ -131,7 +135,7 @@ This SDK includes a sample script which can be used to perform a number of actio
**Run the vAPI vCenter sample suite:**

```cmd
$ ./run_sample.sh ../samples/vsphere/vcenter/setup/main.py -riv
$ python ../samples/vsphere/vcenter/setup/main.py -riv
```

## API Documentation
Expand Down
11 changes: 0 additions & 11 deletions bin/run_sample.bat

This file was deleted.

13 changes: 0 additions & 13 deletions bin/run_sample.sh

This file was deleted.

3 changes: 1 addition & 2 deletions samples/vsphere/contentlibrary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ This directory contains samples for Content Library APIs:

Running the samples

$ cd /path/to/vsphere-automation-sdk-python-samples/bin
$ ./run_sample.sh ../samples/vsphere/contentlibrary/<sample-dir>/<sample>.py --server <vCenter Server IP> --username <username> --password <password> <additional-sample-parameters>
$ python <sample-dir>/<sample>.py --server <vCenter Server IP> --username <username> --password <password> <additional-sample-parameters>

The additional sample parameters are as follows (all parameters can be displayed for any sample using option --help)

Expand Down
3 changes: 1 addition & 2 deletions samples/vsphere/sso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ for accessing the lookup service. The Lookup Service WSDL files are located in w

Running the samples
```cmd
$ cd /path/to/vsphere-automation-sdk-python-samples/bin
$ ./run_sample.sh ../samples/vsphere/sso/external_psc_sso_workflow.py --lsurl https://<server>/lookupservice/sdk -u '[email protected]' -p 'Admin!23' -v
$ python external_psc_sso_workflow.py --lsurl https://<server>/lookupservice/sdk -u '[email protected]' -p 'Admin!23' -v
```
* Testbed Requirement:
- 1 vCenter Server
3 changes: 1 addition & 2 deletions samples/vsphere/tagging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ This directory contains samples for Tagging APIs:

Running the samples

$ 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
$ python tagging_workflow.py --server <vCenter Server IP> --username <username> --password <password> --clustername <clustername> --categoryname <categoryname> --categorydesc <categorydesc> --tagname <tagname> -tagdesc <tagdesc> -v

* Testbed Requirement:
- 1 vCenter Server
Expand Down
4 changes: 2 additions & 2 deletions samples/vsphere/vcenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This directory contains samples for the vSphere infrastructure and virtual machi

* with the testbed settings specified in testbed.py in a Linux machine:

$ ./run_sample.sh ../samples/vsphere/vcenter/vm/create/create_default_vm.py -v
$ python samples/vsphere/vcenter/vm/create/create_default_vm.py -v

* Or specify the credentials using command line parameters:

$ ./run_sample.sh ../samples/vsphere/vcenter/vm/create/create_default_vm.py -s \<server> -u \<username> -p \<password> -v
$ python samples/vsphere/vcenter/vm/create/create_default_vm.py -s <server> -u <username> -p <password> -v
2 changes: 2 additions & 0 deletions samples/vsphere/vcenter/setup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
# then override testbed.py values
if (args.vcenterserver):
_testbed.config['SERVER'] = args.vcenterserver
if (args.vcenterpassword):
_testbed.config['PASSWORD'] = args.vcenterpassword
if (args.esxhost1):
_testbed.config['ESX_HOST1'] = args.esxhost1
if (args.esxhost2):
Expand Down
6 changes: 6 additions & 0 deletions samples/vsphere/vcenter/setup/setup_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def build_arg_parser():
-l, --samples_cleanup
-v, --skipverification
-server, --vcenterserver
-p, --vcenterpassword
-e1, --esxhost1
-e2, --esxhost2
-epass, --esxpassword
Expand Down Expand Up @@ -91,6 +92,11 @@ def build_arg_parser():
help='Vcenter server IP to prepare the testbed to run the samples.'
'If not passed as argument, update testbed.py file')

parser.add_argument('-p', '--vcenterpassword',
action='store',
help='Vcenter server password'
'If not passed as argument, update testbed.py file')

parser.add_argument('-e1', '--esxhost1',
action='store',
help='ESX HOST 1 IP to prepare the testbed to run the samples.'
Expand Down