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
This commit is contained in:
@@ -23,7 +23,7 @@ from six import itervalues
|
||||
from six import text_type
|
||||
from six import PY3
|
||||
from datetime import datetime
|
||||
import pyVmomi.Iso8601
|
||||
from pyVmomi import Iso8601
|
||||
import base64
|
||||
import threading
|
||||
|
||||
|
347
tests/fixtures/iso8601_set_datetime.yaml
vendored
Normal file
347
tests/fixtures/iso8601_set_datetime.yaml
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept: ['*/*']
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
User-Agent: [python-requests/2.3.0 CPython/3.4.1 Darwin/13.3.0]
|
||||
method: GET
|
||||
uri: https://vcsa:443//sdk/vimServiceVersions.xml
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n Copyright
|
||||
2008-2012 VMware, Inc. All rights reserved.\n-->\n<namespaces version=\"1.0\">\n
|
||||
\ <namespace>\n <name>urn:vim25</name>\n <version>5.5</version>\n <priorVersions>\n
|
||||
\ <version>5.1</version>\n <version>5.0</version>\n <version>4.1</version>\n
|
||||
\ <version>4.0</version>\n <version>2.5u2</version>\n <version>2.5</version>\n
|
||||
\ </priorVersions>\n </namespace>\n <namespace>\n <name>urn:vim2</name>\n
|
||||
\ <version>2.0</version>\n </namespace>\n</namespaces>\n"}
|
||||
headers:
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['530']
|
||||
Content-Type: [text/xml]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:33 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><RetrieveServiceContent xmlns="urn:vim25"><_this type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrieveServiceContentResponse
|
||||
xmlns=\"urn:vim25\"><returnval><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1623101</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1623101</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>7FE5EAEC-D956-4BF1-BC24-28D6242EA017</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></returnval></RetrieveServiceContentResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3599']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:33 GMT']
|
||||
Set-Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><Login xmlns="urn:vim25"><_this type="SessionManager">SessionManager</_this><userName>my_user</userName><password>my_password</password></Login></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<LoginResponse
|
||||
xmlns=\"urn:vim25\"><returnval><key>52d559c8-dbac-f233-5751-dc3a755bfb76</key><userName>my_user</userName><fullName>my_user
|
||||
</fullName><loginTime>2014-08-19T08:29:34.017448Z</loginTime><lastActiveTime>2014-08-19T08:29:34.017448Z</lastActiveTime><locale>en</locale><messageLocale>en</messageLocale><extensionSession>false</extensionSession><ipAddress>192.168.2.100</ipAddress><userAgent></userAgent><callCount>0</callCount></returnval></LoginResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['790']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:34 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><RetrieveServiceContent xmlns="urn:vim25"><_this type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrieveServiceContentResponse
|
||||
xmlns=\"urn:vim25\"><returnval><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1623101</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1623101</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>7FE5EAEC-D956-4BF1-BC24-28D6242EA017</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></returnval></RetrieveServiceContentResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3599']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:34 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><RetrievePropertiesEx xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>ServiceInstance</type><all>false</all><pathSet>content</pathSet></propSet><objectSet><obj
|
||||
type="ServiceInstance">ServiceInstance</obj><skip>false</skip></objectSet></specSet><options><maxObjects>1</maxObjects></options></RetrievePropertiesEx></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrievePropertiesExResponse
|
||||
xmlns=\"urn:vim25\"><returnval><objects><obj type=\"ServiceInstance\">ServiceInstance</obj><propSet><name>content</name><val
|
||||
xsi:type=\"ServiceContent\"><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1623101</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1623101</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>7FE5EAEC-D956-4BF1-BC24-28D6242EA017</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></val></propSet></objects></returnval></RetrievePropertiesExResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3739']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:34 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><FindByUuid xmlns="urn:vim25"><_this type="SearchIndex">SearchIndex</_this><uuid>4c4c4544-0043-4d10-8056-b1c04f4c5331</uuid><vmSearch>false</vmSearch></FindByUuid></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<FindByUuidResponse
|
||||
xmlns=\"urn:vim25\"><returnval type=\"HostSystem\">host-14</returnval></FindByUuidResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['434']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:34 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><RetrievePropertiesEx xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostSystem</type><all>false</all><pathSet>configManager</pathSet></propSet><objectSet><obj
|
||||
type="HostSystem">host-14</obj><skip>false</skip></objectSet></specSet><options><maxObjects>1</maxObjects></options></RetrievePropertiesEx></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrievePropertiesExResponse
|
||||
xmlns=\"urn:vim25\"><returnval><objects><obj type=\"HostSystem\">host-14</obj><propSet><name>configManager</name><val
|
||||
xsi:type=\"HostConfigManager\"><cpuScheduler type=\"HostCpuSchedulerSystem\">cpuScheduler-14</cpuScheduler><datastoreSystem
|
||||
type=\"HostDatastoreSystem\">datastoreSystem-14</datastoreSystem><memoryManager
|
||||
type=\"HostMemorySystem\">memorySystem-14</memoryManager><storageSystem type=\"HostStorageSystem\">storageSystem-14</storageSystem><networkSystem
|
||||
type=\"HostNetworkSystem\">networkSystem-14</networkSystem><vmotionSystem
|
||||
type=\"HostVMotionSystem\">vmotionSystem-14</vmotionSystem><virtualNicManager
|
||||
type=\"HostVirtualNicManager\">virtualNicManager-14</virtualNicManager><serviceSystem
|
||||
type=\"HostServiceSystem\">serviceSystem-14</serviceSystem><firewallSystem
|
||||
type=\"HostFirewallSystem\">firewallSystem-14</firewallSystem><advancedOption
|
||||
type=\"OptionManager\">EsxHostAdvSettings-14</advancedOption><diagnosticSystem
|
||||
type=\"HostDiagnosticSystem\">diagnosticSystem-14</diagnosticSystem><autoStartManager
|
||||
type=\"HostAutoStartManager\">autoStartManager-14</autoStartManager><dateTimeSystem
|
||||
type=\"HostDateTimeSystem\">dateTimeSystem-14</dateTimeSystem><patchManager
|
||||
type=\"HostPatchManager\">patchManager-14</patchManager><imageConfigManager
|
||||
type=\"HostImageConfigManager\">imageConfigManager-14</imageConfigManager><bootDeviceSystem
|
||||
type=\"HostBootDeviceSystem\">bootDeviceSystem-14</bootDeviceSystem><firmwareSystem
|
||||
type=\"HostFirmwareSystem\">firmwareSystem-14</firmwareSystem><healthStatusSystem
|
||||
type=\"HostHealthStatusSystem\">healthStatusSystem-14</healthStatusSystem><pciPassthruSystem
|
||||
type=\"HostPciPassthruSystem\">pciPassthruSystem-14</pciPassthruSystem><kernelModuleSystem
|
||||
type=\"HostKernelModuleSystem\">kernelModuleSystem-14</kernelModuleSystem><authenticationManager
|
||||
type=\"HostAuthenticationManager\">authenticationManager-14</authenticationManager><powerSystem
|
||||
type=\"HostPowerSystem\">powerSystem-14</powerSystem><cacheConfigurationManager
|
||||
type=\"HostCacheConfigurationManager\">cacheConfigManager-14</cacheConfigurationManager><esxAgentHostManager
|
||||
type=\"HostEsxAgentHostManager\">esxAgentHostManager-14</esxAgentHostManager><iscsiManager
|
||||
type=\"IscsiManager\">iscsiManager-14</iscsiManager></val></propSet></objects></returnval></RetrievePropertiesExResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['2597']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:34 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
|
||||
<soapenv:Body><UpdateDateTime xmlns="urn:vim25"><_this type="HostDateTimeSystem">dateTimeSystem-14</_this><dateTime>2014-08-19T04:29:36.070918-04:00</dateTime></UpdateDateTime></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52bd6093-90c7-3253-75e3-e43a480ce8cf"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<UpdateDateTimeResponse
|
||||
xmlns=\"urn:vim25\"></UpdateDateTimeResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['394']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Tue, 19 Aug 2014 08:29:35 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
version: 1
|
@@ -14,12 +14,15 @@
|
||||
# limitations under the License.
|
||||
import atexit
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
|
||||
from tests import fixtures_path
|
||||
import unittest
|
||||
import vcr
|
||||
|
||||
from pyVim import connect
|
||||
from pyVmomi.Iso8601 import TZManager
|
||||
|
||||
|
||||
class Iso8601Tests(unittest.TestCase):
|
||||
|
||||
@@ -42,3 +45,58 @@ class Iso8601Tests(unittest.TestCase):
|
||||
expected_time = datetime(2014, 8, 5, 17, 50, 20, 594958,
|
||||
boot_time.tzinfo)
|
||||
self.assertEqual(expected_time, boot_time)
|
||||
|
||||
def test_iso8601_set_datetime(self):
|
||||
|
||||
# NOTE (hartsock): This test is an example of how to register
|
||||
# a fixture based test to compare the XML document that pyVmomi
|
||||
# is transmitting. We needed to invent a set of tools to effectively
|
||||
# compare logical XML documents to each other. In this case we are
|
||||
# only interested in the 'soapenv:Body' tag and its children.
|
||||
|
||||
now_string = "2014-08-19T04:29:36.070918-04:00"
|
||||
# NOTE (hartsock): the strptime formatter has a bug in python 2.x
|
||||
# http://bugs.python.org/issue6641 so we're building the date time
|
||||
# using the constructor arguments instead of parsing it.
|
||||
now = datetime(2014, 8, 19, 4, 29, 36, 70918,
|
||||
TZManager.GetTZInfo(
|
||||
tzname='EDT',
|
||||
utcOffset=timedelta(hours=-4, minutes=0)))
|
||||
|
||||
def has_tag(doc):
|
||||
if doc is None:
|
||||
return False
|
||||
return '<dateTime>' in doc
|
||||
|
||||
def correct_time_string(doc):
|
||||
return '<dateTime>{0}</dateTime>'.format(now_string) in doc
|
||||
|
||||
def check_date_time_value(r1, r2):
|
||||
for r in [r1, r2]:
|
||||
if has_tag(r.body):
|
||||
if not correct_time_string(r.body):
|
||||
return False
|
||||
return True
|
||||
|
||||
my_vcr = vcr.VCR()
|
||||
my_vcr.register_matcher('document', check_date_time_value)
|
||||
|
||||
# NOTE (hartsock): the `match_on` option is altered to use the
|
||||
# look at the XML body sent to the server
|
||||
with my_vcr.use_cassette('iso8601_set_datetime.yaml',
|
||||
cassette_library_dir=fixtures_path,
|
||||
record_mode='once',
|
||||
match_on=['method', 'scheme', 'host', 'port',
|
||||
'path', 'query', 'document']):
|
||||
|
||||
si = connect.SmartConnect(host='vcsa',
|
||||
user='my_user',
|
||||
pwd='my_password')
|
||||
atexit.register(connect.Disconnect, si)
|
||||
|
||||
search_index = si.content.searchIndex
|
||||
uuid = "4c4c4544-0043-4d10-8056-b1c04f4c5331"
|
||||
host = search_index.FindByUuid(None, uuid, False)
|
||||
date_time_system = host.configManager.dateTimeSystem
|
||||
# NOTE (hartsock): sending the date time 'now' to host.
|
||||
date_time_system.UpdateDateTime(now)
|
||||
|
Reference in New Issue
Block a user