From: cnm m. <cnn...@gm...> - 2016-04-07 19:52:10
|
Hi, Does anyone know what cause the following code fails and how to make it work. It seems input param "no_verification=True" in WBEMConnection() is not working. Here are the infomration: platform: Windows 7 64 bits. python version: 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48). pywbem version: pywbem-0.9.0.dev0 OR version: pywbem-0.8.2. python: === using 'https' and fails, even no_verification=True is set ========= c:\test\pywbem-0.9.0.dev0>python >>> import pywbem >>> conn=pywbem.WBEMConnection('https://usenABCx2l', ... ('admin','#1Password'),'root/xyz',no_verification=True) >>> ein=conn.EnumerateInstanceNames('CIM_ComputerSystem','root/xyz') Traceback (most recent call last): File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_http.py", line 606, in wbem_request client.endheaders() File "C:\Program Files (x86)\Python35-32\lib\http\client.py", line 1079, in en dheaders self._send_output(message_body) File "C:\Program Files (x86)\Python35-32\lib\http\client.py", line 911, in _se nd_output self.send(msg) File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_http.py", line 356, in send self.connect() File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_http.py", line 431, in connect self.sock = ctx.wrap_socket(self.sock) File "C:\Program Files (x86)\Python35-32\lib\ssl.py", line 376, in wrap_socket _context=self) File "C:\Program Files (x86)\Python35-32\lib\ssl.py", line 705, in __init__ raise ValueError("check_hostname requires server_hostname") ValueError: check_hostname requires server_hostname During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_operations.py", line 1087, in Enume rateInstanceNames **extra) File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_operations.py", line 651, in imetho dcall timeout=self.timeout) File "c:\test\pywbem-0.9.0.dev0\pywbem\cim_http.py", line 611, in wbem_request raise ConnectionError("Socket error: %s" % exc) pywbem.cim_http.ConnectionError: Socket error: check_hostname requires server_ho stname >>> ========= using 'http' it works ======= >>> conn=pywbem.WBEMConnection('http://usenABCx2l', ... ('admin','#1Password')) >>> ein=conn.EnumerateInstanceNames('CIM_ComputerSystem','root/xyz') >>> print(ein) [CIMInstanceName(classname='XYZ_StorageProcessorSystem', keybindings=NocaseDict({'CreationClassName': 'XYZ_StorageProcessorSystem', 'Name': '39705a23579f4b0fb69413b96aeb7f54'}), namespace='root/xyz', host=None), CIMInstanceName(classname='XYZ_StorageProcessorSystem', keybindings=NocaseDict({'CreationClassName': 'XYZ_StorageProcessorSystem', 'Name': 'd09a81aead6e4419a598236ccafc917b'}), namespace='root/xyz', host=None), CIMInstanceName(classname='XYZ_StorageSystem', keybindings=NocaseDict({'CreationClassName': 'XYZ_StorageSystem', 'Name': 'f6316d9631b6443a9606db13393009c6'}), namespace='root/xyz', host=None)] >>> Thanks, cnm |