mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fix bytes-object required error in python 3
this fixes the following error for http.query ``` An exception occurred in this state: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/salt/state.py", line 1843, in call **cdata['kwargs']) File "/usr/local/lib/python3.6/site-packages/salt/loader.py", line 1795, in wrapper return f(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/salt/states/http.py", line 95, in query if match in data.get('text', ''): TypeError: a bytes-like object is required, not 'str' ```
This commit is contained in:
parent
cf411f8984
commit
14aba24111
1 changed files with 2 additions and 0 deletions
|
@ -531,6 +531,8 @@ def query(url,
|
|||
'charset' in res_params and \
|
||||
not isinstance(result_text, six.text_type):
|
||||
result_text = result_text.decode(res_params['charset'])
|
||||
if isinstance(result_text, bytes):
|
||||
result_text = result_text.decode('utf-8')
|
||||
ret['body'] = result_text
|
||||
if 'Set-Cookie' in result_headers.keys() and cookies is not None:
|
||||
result_cookies = parse_cookie_header(result_headers['Set-Cookie'])
|
||||
|
|
Loading…
Add table
Reference in a new issue