I am afraid this bug is still an issue using python3-maas-client 2.0.0~alpha3+bzr4809-0ubuntu1~xenial1.
Attempting to create a dnsresource with post:
With post request not specifying an op code:
Traceback (most recent call last):
File "ocf/maas/maas_dns.py", line 149, in <module>
telco_ha_dns()
File "ocf/maas/maas_dns.py", line 131, in telco_ha_dns
dns_obj.create_dnsresource()
File "ocf/maas/maas_dns.py", line 44, in create_dnsresource
self.ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/__init__.py", line 78,
in create_dnsresource
resp = self.driver.create_dnsresource(fqdn, ip_address, address_ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/apidriver.py", line
166, in create_dnsresource
address_ttl=address_ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/apidriver.py", line 89,
in _post
response = self.client.post(path, op, **kwargs)
File "/usr/lib/python3/dist-packages/apiclient/maas_client.py", line 242, in
post
path, kwargs, as_json=as_json)
File "/usr/lib/python3/dist-packages/apiclient/maas_client.py", line 212, in
_formulate_change
url += '?' + urlencode([('op', op)])
File "/usr/lib/python3/dist-packages/apiclient/utils.py", line 42, in
urlencode
for name, value in data)
File "/usr/lib/python3/dist-packages/apiclient/utils.py", line 42, in
<genexpr>
for name, value in data)
File "/usr/lib/python3.5/urllib/parse.py", line 728, in quote_plus
string = quote(string, safe + space, encoding, errors)
File "/usr/lib/python3.5/urllib/parse.py", line 712, in quote
return quote_from_bytes(string, safe)
File "/usr/lib/python3.5/urllib/parse.py", line 737, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
If I explicitly set the op code to op=bytes('update', encoding='utf-8') and
working around LP Bug#1555392 it returns 400 Bad Request:
Traceback (most recent call last):
File "ocf/maas/maas_dns.py", line 149, in <module>
telco_ha_dns()
File "ocf/maas/maas_dns.py", line 131, in telco_ha_dns
dns_obj.create_dnsresource()
File "ocf/maas/maas_dns.py", line 44, in create_dnsresource
self.ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/__init__.py", line 78,
in create_dnsresource
resp = self.driver.create_dnsresource(fqdn, ip_address, address_ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/apidriver.py", line
166, in create_dnsresource
address_ttl=address_ttl)
File "/home/thedac/dev/hacluster/ocf/maas/maasclient/apidriver.py", line 89,
in _post
response = self.client.post(path, op, **kwargs)
File "/usr/lib/python3/dist-packages/apiclient/maas_client.py", line 245, in
post
url, method="POST", headers=headers, data=body)
File "/usr/lib/python3/dist-packages/apiclient/maas_client.py", line 109, in
dispatch_query
res = urllib.request.urlopen(req)
File "/usr/lib/python3.5/urllib/request.py", line 162, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 471, in open
response = meth(req, response)
File "/usr/lib/python3.5/urllib/request.py", line 581, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.5/urllib/request.py", line 509, in error
return self._call_chain(*args)
File "/usr/lib/python3.5/urllib/request.py", line 443, in _call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 589, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: BAD REQUEST
I am afraid this bug is still an issue using python3-maas-client 2.0.0~alpha3+ bzr4809- 0ubuntu1~ xenial1.
Attempting to create a dnsresource with post:
With post request not specifying an op code:
Traceback (most recent call last): maas_dns. py", line 149, in <module> maas_dns. py", line 131, in telco_ha_dns obj.create_ dnsresource( ) maas_dns. py", line 44, in create_dnsresource thedac/ dev/hacluster/ ocf/maas/ maasclient/ __init_ _.py", line 78, create_ dnsresource( fqdn, ip_address, address_ttl) thedac/ dev/hacluster/ ocf/maas/ maasclient/ apidriver. py", line ttl=address_ ttl) thedac/ dev/hacluster/ ocf/maas/ maasclient/ apidriver. py", line 89, post(path, op, **kwargs) python3/ dist-packages/ apiclient/ maas_client. py", line 242, in python3/ dist-packages/ apiclient/ maas_client. py", line 212, in python3/ dist-packages/ apiclient/ utils.py" , line 42, in python3/ dist-packages/ apiclient/ utils.py" , line 42, in python3. 5/urllib/ parse.py" , line 728, in quote_plus python3. 5/urllib/ parse.py" , line 712, in quote bytes(string, safe) python3. 5/urllib/ parse.py" , line 737, in quote_from_bytes "quote_ from_bytes( ) expected bytes")
File "ocf/maas/
telco_ha_dns()
File "ocf/maas/
dns_
File "ocf/maas/
self.ttl)
File "/home/
in create_dnsresource
resp = self.driver.
File "/home/
166, in create_dnsresource
address_
File "/home/
in _post
response = self.client.
File "/usr/lib/
post
path, kwargs, as_json=as_json)
File "/usr/lib/
_formulate_change
url += '?' + urlencode([('op', op)])
File "/usr/lib/
urlencode
for name, value in data)
File "/usr/lib/
<genexpr>
for name, value in data)
File "/usr/lib/
string = quote(string, safe + space, encoding, errors)
File "/usr/lib/
return quote_from_
File "/usr/lib/
raise TypeError(
TypeError: quote_from_bytes() expected bytes
If I explicitly set the op code to op=bytes('update', encoding='utf-8') and
working around LP Bug#1555392 it returns 400 Bad Request:
Traceback (most recent call last): maas_dns. py", line 149, in <module> maas_dns. py", line 131, in telco_ha_dns obj.create_ dnsresource( ) maas_dns. py", line 44, in create_dnsresource thedac/ dev/hacluster/ ocf/maas/ maasclient/ __init_ _.py", line 78, create_ dnsresource( fqdn, ip_address, address_ttl) thedac/ dev/hacluster/ ocf/maas/ maasclient/ apidriver. py", line ttl=address_ ttl) thedac/ dev/hacluster/ ocf/maas/ maasclient/ apidriver. py", line 89, post(path, op, **kwargs) python3/ dist-packages/ apiclient/ maas_client. py", line 245, in python3/ dist-packages/ apiclient/ maas_client. py", line 109, in request. urlopen( req) python3. 5/urllib/ request. py", line 162, in urlopen python3. 5/urllib/ request. py", line 471, in open python3. 5/urllib/ request. py", line 581, in http_response python3. 5/urllib/ request. py", line 509, in error chain(* args) python3. 5/urllib/ request. py", line 443, in _call_chain python3. 5/urllib/ request. py", line 589, in http_error_default req.full_ url, code, msg, hdrs, fp) error.HTTPError : HTTP Error 400: BAD REQUEST
File "ocf/maas/
telco_ha_dns()
File "ocf/maas/
dns_
File "ocf/maas/
self.ttl)
File "/home/
in create_dnsresource
resp = self.driver.
File "/home/
166, in create_dnsresource
address_
File "/home/
in _post
response = self.client.
File "/usr/lib/
post
url, method="POST", headers=headers, data=body)
File "/usr/lib/
dispatch_query
res = urllib.
File "/usr/lib/
return opener.open(url, data, timeout)
File "/usr/lib/
response = meth(req, response)
File "/usr/lib/
'http', request, response, code, msg, hdrs)
File "/usr/lib/
return self._call_
File "/usr/lib/
result = func(*args)
File "/usr/lib/
raise HTTPError(
urllib.
MAAS regiond log: 2016:22: 45:18 +0000] "POST 2.0/dnsresource s/?op=update HTTP/1.1" 400 45 "-" "Python-urllib/3.5"
2016-03-18 22:45:19 [-] 127.0.0.1 - - [18/Mar/
/MAAS/api/