1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

jira: Fix incompatible pathname2url import (#204) (#205)

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:
Simon Baird 2020-04-20 07:05:57 -04:00 committed by GitHub
parent dab16b8783
commit 281549cadc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,7 +286,9 @@ EXAMPLES = """
import base64
import json
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.basic import AnsibleModule
@ -401,10 +403,10 @@ def fetch(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']:
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']:
url = url + '&maxResults=' + str(params['maxresults'])
ret = get(url, user, passwd, params['timeout'])