1
0

Accepting request 281463 from home:frispete:python

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
This commit is contained in:
Jan Matejek 2015-01-16 15:00:27 +00:00 committed by Git OBS Bridge
commit 2ea8221626
6 changed files with 369 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

6
python-pyvmomi.changes Normal file
View File

@ -0,0 +1,6 @@
-------------------------------------------------------------------
Tue Nov 4 17:28:19 UTC 2014 - hpj@urpla.net
- version 5.5.0.2014.1.1: initial build
- apply asorted fixes from todays git tree

82
python-pyvmomi.spec Normal file
View File

@ -0,0 +1,82 @@
#
# spec file for package python-pyvmomi
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
Name: python-pyvmomi
Version: 5.5.0.2014.1.1
Release: 0
License: Apache-2.0
Summary: VMware vSphere Python SDK
Url: https://github.com/vmware/pyvmomi
Group: Development/Languages/Python
Source: https://pypi.python.org/packages/source/p/pyvmomi/pyvmomi-%{version}.tar.gz
Patch: pyvmomi-git20141104-new.diff
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-six >= 1.7.3
BuildRequires: python-requests >= 2.3.0
BuildRequires: python-vcrpy
BuildRequires: python-testtools >= 0.9.34
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
pyVmomi is the Python SDK for the VMware vSphere API that allows you to manage
ESX, ESXi, and vCenter.
Getting Started ================ To get started, check out the samples project
at:
* http://vmware.github.io/pyvmomi-community-samples/
* community discussion on IRC freenode.net channels `#pyvmomi and #pyvmomi-dev
* <http://webchat.freenode.net/?channels=#pyvmomi,#pyvmomi-dev>`_
* community email is on `nabble <http://pyvmomi.2338814.n4.nabble.com>`_
For general language neutral documentation of vSphere Management API see:
* `vSphere WS SDK API Docs
* <http://pubs.vmware.com/vsphere-55/topic/com.vmware.wssdk.apiref.doc/right-pane.html>`_
%prep
%setup -q -n pyvmomi-%{version}
%patch -p1
# we don't want to install any of these
sed -i '/ data_files/,+1d' setup.py
# fix line breaks in text files
sed -i 's/\r//' *.txt
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%check
python setup.py test
%files
%defattr(-,root,root,-)
%doc LICENSE.txt NOTICE.txt README.rst
%{python_sitelib}/*
%changelog

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a57bc76a20bc9135b17276ee51564246ca9bf2a3e69eb1040e93ce4719946179
size 198314

View File

@ -0,0 +1,254 @@
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