xml: force return of unicode string

With Python 3.8, the xml.etree.ElementTree.ElementTree function now
preserves the attribute order specified by the user.

This change broke the winrm enable functionality, throwing the erorr:

```
TypeError: Objects of type 'bytes' can not be converted to Unicode.
```

The fix was to set the correct parameter to return an unicode string and
not bytes.

Change-Id: I10f7fa357267f36dfed03ccb708694f6fc1cdd97
This commit is contained in:
Adrian Vladu 2022-11-21 19:29:53 +02:00
parent e192f67f71
commit 072bee9c5d

View File

@ -191,5 +191,5 @@ class WinRMConfig(object):
new_value = self._get_xml_bool(value)
if node.text.lower() != new_value:
node.text = new_value
data_xml = ElementTree.tostring(tree)
data_xml = ElementTree.tostring(tree, encoding="unicode")
session.Put(self._SERVICE_AUTH_URI, data_xml)