22 Commits

Author SHA1 Message Date
tianhao he
0f4a4e5895 Try to query wsdl type/method from vim25 namespace first when namespace is unknown.
Some type, in this case 'Task' is not defined in the specified namespace(urn:nfc). In such case, the deserializer will have to guess the namespace by interate namesapce in the _wsdlTypeMapNSs. 'Task' exists in multiple namespaces. In python2, the order in the map is fixed and vim25 is always tried first, but in python3 the order of the set is random. If wrong namespace is returned, the xml parser will fail later on.
2016-06-06 08:56:11 -07:00
tianhao he
f3245a6c33 Fix issue #182 by creating an uncallable managed method
VC is returning some internal managed method in 6.0. Looks like this issue
will be resolved in 6.5 server types as it will be public in 6.5. To tempoarily
workaound this issue, returning a dummy method and dummy obj instead of throwing
exception when client side can't understand the returned managed method.
2016-06-03 12:37:47 -07:00
Arnon Yaari
f5bfaccce5 Use urn map for attribute resolution from top-level names
pyvmomi objects can be resolved by the vmodl name, e.g. "vim.vm.RelocateSpec"
or by the wsdl name, e.g. "vim.VirtualMachineRelocateSpec".
The wsdl name resolution uses "vim" as a hard-coded name, and doesn't
resolve more wsdl namespaces like "sms" and "pbm"
2016-05-02 15:33:53 +03:00
tianhao he
3fa1beb1bc Fix serialization issue for long type in python3
Python3 doesn't have long type, creating a custom long type to workaround that.
2016-04-20 10:45:17 -07:00
tianhao he
bdbe035d76 Fix GetServiceVersions for Python 3 2016-04-20 10:41:09 -07:00
tianhao he
1b5733ff19 A couple of python3 changes for VmomiSupport 2016-04-20 10:40:28 -07:00
Tianhao He
7927002ff7 Python3 fixes for SoapAdapter serializer.
1. Remove the encode() helper method since it doesn't provide encoding in python3 at all.
2. In order to workaround the leading 'b' literal after encoding in python3,
   we delay the encoding step and will encode the whole soap message instead of individual values.
3. Added separate cases to handle Enum, integer and float to make the serializtion process more clear.
2016-03-18 09:52:56 -07:00
Tianhao He
863168c0c4 Add support to pyVmomi for versions for sub-namespaces
The Add method for _BuildVersions will get only
the first component of the namespace and use that as
a key for the dictionary. However that's a problem for
a namespace like hbr which has 3 sub-namespaces:
hbr.agent, hbr.cascadeAgent and hbr.replica because
newestVersions will only save hbr.replica.version.version5
as HbrReplicaTypes is the first one that's imported
in pyVmomi/__init__.py.
This change adds the following behavior: if you add a
version 'x.y.z.version.version1', it will try
to add it as 'x' (for backwards compatibility) and 'x.y.z'.
2015-11-19 23:06:54 -08:00
Tianhao He
b16ab957ec Implement __ne__ for MangedObject
As per python docs, "There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining __eq__(), one should also define __ne__() so that the operators will behave as expected"
  Hence, implementing __ne__ to enable '!='
2015-11-19 23:06:54 -08:00
Tianhao He
b812a1d8f6 Support for build-time versions in pyVmomi
Since introduction of meta-versions and related
generated versions, we need facility, allowing
code to specify those versions during run-time.

(Note that although version classes are well-
defined, the particular versions that correspond
to a class change from build to build, depending
on meta-version state.)
2015-10-19 12:42:00 -07:00
Tianhao He
45a40c496d Support for build-time versions in pyVmomi
Since introduction of meta-versions and related
generated versions, we need facility, allowing
code to specify those versions during run-time.

(Note that although version classes are well-
defined, the particular versions that correspond
to a class change from build to build, depending
on meta-version state.)
2015-10-13 10:27:17 -07:00
Tianhao He
2ab965007c Bug 1158932: Clobbering branch //depot/bora/vsphere-2015/... from //depot/bora/prod-2015/...@2511606 2015-09-30 20:04:46 -07:00
Michael Rice
0f0c96bf61 Updated copyright from 2008-2014 to 2008-2015 2015-01-10 18:49:03 -06:00
Shawn Hartsock
40e5501a92 python3: fix Iso8601 import statement
The import statement for Iso8601 was not properly
updated. This fix changes the import statement so
it works properly after python3 support changes.

fixes https://github.com/vmware/pyvmomi/issues/112
2014-08-22 12:01:44 -04:00
Shawn Hartsock
6d237ba3df Malformed Faults fail in non-informative ways
* Malformed Faults: introduces test for fault handler
* introduces ParserError which includes the malformed XML
* testing demonstrates ParserError includes malformed XML

closes: https://github.com/vmware/pyvmomi/issues/72
2014-08-12 13:55:39 -04:00
Shawn Hartsock
c84a6a9afb python3: KeyError to use format
Changes KeyError signatures to use `format` instead of `%`

partial: https://github.com/vmware/pyvmomi/issues/55
2014-07-30 16:38:26 -04:00
Kevin McCarthy
66e515b6eb python3: fix some syntax errors
partial: https://github.com/vmware/pyvmomi/issues/55
2014-07-28 13:48:28 -04:00
Shawn Hartsock
de17170440 python3: version neutral API
Using the six library we make version neutral API calls to
dictionary methods and to unicode methods.

partial: https://github.com/vmware/pyvmomi/issues/55
2014-07-28 13:36:39 -04:00
Shawn Hartsock
05552044f6 python3: unicode - minimalist change set
A minimal change set to deal with unicode modules and methods between
python2 and python3. A deeper reworking of the unicode components
is very likely called for, however, this change should get the library
working on python3.

partial: https://github.com/vmware/pyvmomi/issues/55
2014-07-28 11:17:27 -04:00
Shawn Hartsock
8ee385a46e python3: absolute import
Use absolute import from the __future__ module to prepare
the library for use in python 3

partial: https://github.com/vmware/pyvmomi/issues/55
2014-07-28 11:17:18 -04:00
Michael Mattioli
3254adfa26 Updated Copyright Years
Updated copyright years to 2014 where applicable
2014-07-13 03:02:00 -04:00
Joshua Kwan
26649465c6 Initial source drop
This is the initial version of pyVmomi which represents vSphere API 5.1.
Going forward, expect only the 'Objects' and 'Types' generated source
files to need updating via official OSS drops.
2013-12-14 13:36:09 -05:00