Be sure to import urllib.parse from somewhere

This commit is contained in:
Toshio Kuratomi 2016-06-04 08:48:28 -07:00 committed by Matt Clay
parent fc486824b8
commit 8ba0af5df3

View file

@ -30,6 +30,9 @@ try:
except ImportError:
import simplejson as json
import ansible.module_utils.six
DOCUMENTATION = '''
---
module: uri
@ -265,7 +268,7 @@ def write_file(module, url, dest, content):
def url_filename(url):
fn = os.path.basename(urlparse.urlsplit(url)[2])
fn = os.path.basename(six.moves.urllib.parse.urlsplit(url)[2])
if fn == '':
return 'index.html'
return fn
@ -280,7 +283,7 @@ def absolute_location(url, location):
return location
elif location.startswith('/'):
parts = urlparse.urlsplit(url)
parts = six.moves.urllib.parse.urlsplit(url)
base = url.replace(parts[2], '')
return '%s%s' % (base, location)