MAASClient.get() is reported to take a string, but raises an AssertionError
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
When writing up a response to http://
print client.
because it raises an AssertionError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
url, headers = self._formulate
File "/usr/lib/
url = self._make_
File "/usr/lib/
assert not isinstance(path, bytes)
AssertionError
Forcing the caller to wrap the string in a unicode() seems silly. Note that the docstring for make_url says that strings are allowed:
def _make_url(self, path):
"""Compose an absolute URL to `path`.
:param path: Either a string giving a path to the desired resource,
or a sequence of items that make up the path.
:return: An absolute URL leading to `path`.
"""
Changed in maas: | |
importance: | Undecided → Wishlist |
status: | New → Triaged |
In MAAS we've been fairly strict with what we consider to be a string, getting ready for Python 3. Implicit encoding and decoding can also introduce failures and/or corruption. Try instead:
client. get(u"nodes/ ", "list").read()
or put:
from __future__ import unicode_literals
at the top of the module.