CiscoUcs / ucsmsdk

Python SDK for Cisco UCSM
Other
81 stars 60 forks source link

codec: removed str-specific method-call that breaks python3 use #170

Closed hypokondrickard closed 6 years ago

hypokondrickard commented 6 years ago

This replace() will break ciscos ucs_vlans Ansible module when ansible is using a python 3 interpreter:

The full traceback is: File "/tmp/ansible_m46512rk/ansible_modlib.zip/ansible/module_utils/remote_management/ucs.py", line 80, in login handle.login() File "/home/rickard/virtualenv/lib/python3.6/site-packages/ucsmsdk/ucshandle.py", line 135, in login return self._login(auto_refresh, force, timeout=timeout) File "/home/rickard/virtualenv/lib/python3.6/site-packages/ucsmsdk/ucssession.py", line 599, in _login response = self.post_elem(elem, timeout=timeout) File "/home/rickard/virtualenv/lib/python3.6/site-packages/ucsmsdk/ucssession.py", line 312, in post_elem xml_str = xc.to_xml_str(elem) File "/home/rickard/virtualenv/lib/python3.6/site-packages/ucsmsdk/ucsxmlcodec.py", line 40, in to_xml_str return ET.tostring(elem).replace(" ", "\n")

I guess this means that ET.tostring() is going to return a bytes like object rather than a string when run by python3? If that's the case, you should probably convert that char somewhere else. If it's not, kindly let me know how I should solve my problem ;)

this change is covered by tests

Thank you

parag-may4 commented 6 years ago

This should be fixed by https://github.com/CiscoUcs/ucsmsdk/pull/169#pullrequestreview-119373550 , will merge it

hypokondrickard commented 6 years ago

excellent! when will the next realease be?