forked from pool/python-pyvmomi
This is the official vSphere python binding OBS-URL: https://build.opensuse.org/request/show/281463 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyvmomi?expand=0&rev=1
255 lines
11 KiB
Diff
255 lines
11 KiB
Diff
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/DynamicTypeManagerHelper.py pyvmomi/pyVmomi/DynamicTypeManagerHelper.py
|
|
--- pyvmomi-5.5.0.2014.1.1/pyVmomi/DynamicTypeManagerHelper.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/pyVmomi/DynamicTypeManagerHelper.py 2014-11-04 18:50:31.720052092 +0100
|
|
@@ -1,5 +1,3 @@
|
|
-#!/usr/bin/env python
|
|
-
|
|
# VMware vSphere Python SDK
|
|
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
|
#
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/Iso8601.py pyvmomi/pyVmomi/Iso8601.py
|
|
--- pyvmomi-5.5.0.2014.1.1/pyVmomi/Iso8601.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/pyVmomi/Iso8601.py 2014-11-04 18:50:31.720052092 +0100
|
|
@@ -1,5 +1,3 @@
|
|
-#!/usr/bin/env python
|
|
-
|
|
# VMware vSphere Python SDK
|
|
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
|
#
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/ManagedMethodExecutorHelper.py pyvmomi/pyVmomi/ManagedMethodExecutorHelper.py
|
|
--- pyvmomi-5.5.0.2014.1.1/pyVmomi/ManagedMethodExecutorHelper.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/pyVmomi/ManagedMethodExecutorHelper.py 2014-11-04 18:50:31.724052132 +0100
|
|
@@ -1,5 +1,3 @@
|
|
-#!/usr/bin/env python
|
|
-
|
|
# VMware vSphere Python SDK
|
|
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
|
#
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/pyVmomi/SoapAdapter.py pyvmomi/pyVmomi/SoapAdapter.py
|
|
--- pyvmomi-5.5.0.2014.1.1/pyVmomi/SoapAdapter.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/pyVmomi/SoapAdapter.py 2014-11-04 18:50:31.756052461 +0100
|
|
@@ -453,20 +453,20 @@ def ReadDocument(parser, data):
|
|
# a refactoring that rolls up some repeated code blocks into a method so
|
|
# that we can refactor XML parsing behavior in a single place.
|
|
if not isinstance(data, str):
|
|
- data = data.read()
|
|
+ data = data.read()
|
|
try:
|
|
parser.Parse(data)
|
|
except Exception:
|
|
- # wrap all parser faults with additional information for later
|
|
- # bug reporting on the XML parser code itself.
|
|
- (ec, ev, tb) = sys.exc_info()
|
|
- line = parser.CurrentLineNumber
|
|
- col = parser.CurrentColumnNumber
|
|
- pe = ParserError("xml document: "
|
|
- "{0} parse error at: "
|
|
- "line:{1}, col:{2}".format(data, line, col))
|
|
- # use six.reraise for python 2.x and 3.x compatability
|
|
- reraise(ParserError, pe, tb)
|
|
+ # wrap all parser faults with additional information for later
|
|
+ # bug reporting on the XML parser code itself.
|
|
+ (ec, ev, tb) = sys.exc_info()
|
|
+ line = parser.CurrentLineNumber
|
|
+ col = parser.CurrentColumnNumber
|
|
+ pe = ParserError("xml document: "
|
|
+ "{0} parse error at: "
|
|
+ "line:{1}, col:{2}".format(data, line, col))
|
|
+ # use six.reraise for python 2.x and 3.x compatability
|
|
+ reraise(ParserError, pe, tb)
|
|
|
|
## Deserialize an object from a file or string
|
|
#
|
|
@@ -1035,11 +1035,10 @@ class SSLTunnelConnection(object):
|
|
tunnel = http_client.HTTPConnection(path, **kwargs)
|
|
tunnel.request('CONNECT', self.proxyPath)
|
|
resp = tunnel.getresponse()
|
|
- tunnelSocket = resp.fp
|
|
if resp.status != 200:
|
|
- raise httplib.HTTPException("{0} {1}".format(resp.status, resp.reason))
|
|
+ raise http_client.HTTPException("{0} {1}".format(resp.status, resp.reason))
|
|
retval = http_client.HTTPSConnection(path)
|
|
- retval.sock = _SocketWrapper(tunnelSocket,
|
|
+ retval.sock = _SocketWrapper(tunnel.sock,
|
|
keyfile=key_file, certfile=cert_file)
|
|
return retval
|
|
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/README.rst pyvmomi/README.rst
|
|
--- pyvmomi-5.5.0.2014.1.1/README.rst 2014-09-22 17:39:34.000000000 +0200
|
|
+++ pyvmomi/README.rst 2014-11-04 18:50:25.899992512 +0100
|
|
@@ -24,7 +24,7 @@ Installing
|
|
The master is code that is in development, official releases are tagged and
|
|
posted to `pypi <https://pypi.python.org/pypi/pyvmomi/>`_
|
|
|
|
-* The official release is availabe using pip, just run
|
|
+* The official release is available using pip, just run
|
|
``pip install --upgrade pyvmomi``.
|
|
* To install the version in `github <https://github.com/vmware/pyvmomi>`_ use
|
|
``python setup.py develop`` for development install or
|
|
@@ -32,7 +32,7 @@ posted to `pypi <https://pypi.python.org
|
|
|
|
Testing
|
|
=======
|
|
-Unit tests can be invoked by using the ``tox`` command. You may have to
|
|
+Unit tests can be invoked by using the `tox <https://testrun.org/tox/>`_ command. You may have to
|
|
configure multiple python interpreters so that you can test in all the
|
|
environments listed in ``tox.ini`` or you will have to run ``tox`` with the
|
|
``-e`` flag to run only in your version of python. For example, if you only
|
|
@@ -52,17 +52,17 @@ For general language neutral documentati
|
|
|
|
Python Support
|
|
==============
|
|
-* pyVmomi 5.5.0.2014.1 and later support Python 2.6, 2.7, 3.3 and 3.4
|
|
+* pyVmomi 5.5.0-2014.1 and later support Python 2.6, 2.7, 3.3 and 3.4
|
|
* pyVmomi 5.5.0 and below support Python 2.6 and 2.7
|
|
|
|
Compatibility Policy
|
|
====================
|
|
-pyVmomi versions are marked vSphere_version.release . Pyvmomi maintains minimum
|
|
+pyVmomi versions are marked vSphere_version-release . Pyvmomi maintains minimum
|
|
backward compatibility with the previous _four_ releases of *vSphere* and it's
|
|
own previous four releases. Compatibility with much older versions may continue
|
|
to work but will not be actively supported.
|
|
|
|
-For example, version v5.5.0.2014.1 is most compatible with vSphere 5.5, 5.1,
|
|
+For example, version v5.5.0-2014.1 is most compatible with vSphere 5.5, 5.1,
|
|
5.0, and 4.1 and was the first release in 2014. Initial releases compatible with
|
|
a version of vSphere will bare a naked version number of v5.5.0 indicating that
|
|
version of pyVmomi was released simultaneously with the *GA* version of vSphere
|
|
@@ -70,10 +70,10 @@ with the same version number.
|
|
|
|
Releases
|
|
========
|
|
-* `5.5.0.2014.1.1 <https://github.com/vmware/pyvmomi/tree/v5.5.0.2014.1.1>`_
|
|
- release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0.2014.1.1
|
|
-* `5.5.0.2014.1 <https://github.com/vmware/pyvmomi/tree/v5.5.0.2014.1>`_
|
|
- release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0.2014.1
|
|
+* `5.5.0-2014.1.1 <https://github.com/vmware/pyvmomi/tree/v5.5.0-2014.1.1>`_
|
|
+ release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0-2014.1.1
|
|
+* `5.5.0-2014.1 <https://github.com/vmware/pyvmomi/tree/v5.5.0-2014.1>`_
|
|
+ release notes https://github.com/vmware/pyvmomi/releases/tag/v5.5.0-2014.1
|
|
* `5.5.0 <https://github.com/vmware/pyvmomi/tree/v5.5.0>`_
|
|
* `5.1.0 <https://github.com/vmware/pyvmomi/tree/v5.1.0>`_
|
|
release notes https://github.com/vmware/pyvmomi/releases/tag/v5.1.0
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/sample/getallvms.py pyvmomi/sample/getallvms.py
|
|
--- pyvmomi-5.5.0.2014.1.1/sample/getallvms.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/sample/getallvms.py 2014-11-04 18:50:31.772052624 +0100
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/python
|
|
+#!/usr/bin/env python
|
|
# VMware vSphere Python SDK
|
|
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
|
|
#
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/sample/poweronvm.py pyvmomi/sample/poweronvm.py
|
|
--- pyvmomi-5.5.0.2014.1.1/sample/poweronvm.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/sample/poweronvm.py 2014-11-04 18:50:31.776052665 +0100
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/python
|
|
+#!/usr/bin/env python
|
|
#
|
|
# VMware vSphere Python SDK
|
|
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel_http_failure.yaml pyvmomi/tests/fixtures/ssl_tunnel_http_failure.yaml
|
|
--- pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel_http_failure.yaml 1970-01-01 01:00:00.000000000 +0100
|
|
+++ pyvmomi/tests/fixtures/ssl_tunnel_http_failure.yaml 2014-11-04 18:50:31.804052951 +0100
|
|
@@ -0,0 +1,15 @@
|
|
+interactions:
|
|
+- request:
|
|
+ body: null
|
|
+ headers: {}
|
|
+ method: CONNECT
|
|
+ uri: http://vcsavcsa:80
|
|
+ response:
|
|
+ body: {string: !!python/unicode '<HTML><BODY><H1>404 Not Found</H1></BODY></HTML>'}
|
|
+ headers:
|
|
+ connection: [close]
|
|
+ content-length: ['48']
|
|
+ content-type: [text/html]
|
|
+ date: ['Thu, 11 Sep 2014 07:57:56 GMT']
|
|
+ status: {code: 404, message: Not Found}
|
|
+version: 1
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel.yaml pyvmomi/tests/fixtures/ssl_tunnel.yaml
|
|
--- pyvmomi-5.5.0.2014.1.1/tests/fixtures/ssl_tunnel.yaml 1970-01-01 01:00:00.000000000 +0100
|
|
+++ pyvmomi/tests/fixtures/ssl_tunnel.yaml 2014-11-04 18:50:31.800052911 +0100
|
|
@@ -0,0 +1,14 @@
|
|
+interactions:
|
|
+- request:
|
|
+ body: null
|
|
+ headers: {}
|
|
+ method: CONNECT
|
|
+ uri: http://vcsasdkTunnel:8089
|
|
+ response:
|
|
+ body: {string: !!python/unicode ''}
|
|
+ headers:
|
|
+ content-length: ['0']
|
|
+ content-type: [text/html]
|
|
+ date: ['Thu, 11 Sep 2014 08:23:36 GMT']
|
|
+ status: {code: 200, message: OK}
|
|
+version: 1
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/__init__.py pyvmomi/tests/__init__.py
|
|
--- pyvmomi-5.5.0.2014.1.1/tests/__init__.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/tests/__init__.py 2014-11-04 18:50:31.784052747 +0100
|
|
@@ -16,6 +16,7 @@ import logging
|
|
import os
|
|
import unittest
|
|
import vcr
|
|
+import socket
|
|
|
|
|
|
def tests_resource_path(local_path=''):
|
|
@@ -29,7 +30,7 @@ fixtures_path = tests_resource_path('fix
|
|
def monkey_patch_vcrpy():
|
|
# TODO (hartsock): This should be unnecessary. Remove after vcrpy updates.
|
|
vcr.stubs.VCRHTTPSConnection.is_verified = True
|
|
-
|
|
+ vcr.stubs.VCRFakeSocket = socket.socket
|
|
|
|
class VCRTestBase(unittest.TestCase):
|
|
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/tests/test_connect.py pyvmomi/tests/test_connect.py
|
|
--- pyvmomi-5.5.0.2014.1.1/tests/test_connect.py 2014-09-22 17:37:16.000000000 +0200
|
|
+++ pyvmomi/tests/test_connect.py 2014-11-04 18:50:31.816053075 +0100
|
|
@@ -68,5 +68,20 @@ class ConnectionTests(tests.VCRTestBase)
|
|
def test_disconnect_on_no_connection(self):
|
|
connect.Disconnect(None)
|
|
|
|
+ @vcr.use_cassette('ssl_tunnel.yaml',
|
|
+ cassette_library_dir=tests.fixtures_path,
|
|
+ record_mode='none')
|
|
+ def test_ssl_tunnel(self):
|
|
+ connect.SoapStubAdapter('sdkTunnel', 8089, httpProxyHost='vcsa').GetConnection()
|
|
+
|
|
+ @vcr.use_cassette('ssl_tunnel_http_failure.yaml',
|
|
+ cassette_library_dir=tests.fixtures_path,
|
|
+ record_mode='none')
|
|
+ def test_ssl_tunnel_http_failure(self):
|
|
+ from six.moves import http_client
|
|
+ def should_fail():
|
|
+ connect.SoapStubAdapter('vcsa', 80, httpProxyHost='vcsa').GetConnection()
|
|
+ self.assertRaises(http_client.HTTPException, should_fail)
|
|
+
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
\ No newline at end of file
|
|
diff -up -rNx '.git*' pyvmomi-5.5.0.2014.1.1/.travis.yml pyvmomi/.travis.yml
|
|
--- pyvmomi-5.5.0.2014.1.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100
|
|
+++ pyvmomi/.travis.yml 2014-11-04 18:50:25.891992430 +0100
|
|
@@ -0,0 +1,17 @@
|
|
+language: python
|
|
+python:
|
|
+ - "2.6"
|
|
+ - "2.7"
|
|
+ - "pypy"
|
|
+ - "3.3"
|
|
+ - "3.4"
|
|
+
|
|
+before_install:
|
|
+ - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi
|
|
+ - pip install -r requirements.txt
|
|
+ - pip install -r test-requirements.txt
|
|
+
|
|
+install:
|
|
+ - python setup.py install
|
|
+
|
|
+script: python setup.py test
|