mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
The call to pathname2url was broken in Python 2. Fix it by importing from module_utils.six instead of importing urllib and calling it from there.
This commit is contained in:
parent
dab16b8783
commit
281549cadc
1 changed files with 5 additions and 3 deletions
|
@ -286,7 +286,9 @@ EXAMPLES = """
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import urllib
|
|
||||||
|
from ansible.module_utils.six.moves.urllib.request import pathname2url
|
||||||
|
|
||||||
from ansible.module_utils._text import to_text, to_bytes
|
from ansible.module_utils._text import to_text, to_bytes
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
@ -401,10 +403,10 @@ def fetch(restbase, user, passwd, params):
|
||||||
|
|
||||||
|
|
||||||
def search(restbase, user, passwd, params):
|
def search(restbase, user, passwd, params):
|
||||||
url = restbase + '/search?jql=' + urllib.request.pathname2url(params['jql'])
|
url = restbase + '/search?jql=' + pathname2url(params['jql'])
|
||||||
if params['fields']:
|
if params['fields']:
|
||||||
fields = params['fields'].keys()
|
fields = params['fields'].keys()
|
||||||
url = url + '&fields=' + '&fields='.join([urllib.request.pathname2url(f) for f in fields])
|
url = url + '&fields=' + '&fields='.join([pathname2url(f) for f in fields])
|
||||||
if params['maxresults']:
|
if params['maxresults']:
|
||||||
url = url + '&maxResults=' + str(params['maxresults'])
|
url = url + '&maxResults=' + str(params['maxresults'])
|
||||||
ret = get(url, user, passwd, params['timeout'])
|
ret = get(url, user, passwd, params['timeout'])
|
||||||
|
|
Loading…
Reference in a new issue