Fix urlparse import for Python3 (#31240)

* Fix urlparse import for Python3 in

* contrib/inventory/consul_io.py
* contrib/inventory/rudder.py
* contrib/inventory/windows_azure.py
* lib/ansible/module_utils/known_hosts.py
* lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py
* lib/ansible/modules/cloud/docker/_docker.py
* lib/ansible/modules/cloud/ovirt/ovirt_disk.py
* lib/ansible/plugins/action/ce_template.py
This commit is contained in:
François Scala 2017-10-10 05:18:09 +02:00 committed by Toshio Kuratomi
commit aade5234a9
9 changed files with 13 additions and 31 deletions

View file

@ -30,10 +30,7 @@ import os
import hmac
import re
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
from ansible.module_utils.six.moves.urllib.parse import urlparse
try:
from hashlib import sha1
@ -75,7 +72,7 @@ def get_fqdn_and_port(repo_url):
fqdn = repo_url.split("/")[0]
elif "://" in repo_url:
# this should be something we can parse with urlparse
parts = urlparse.urlparse(repo_url)
parts = urlparse(repo_url)
# parts[1] will be empty on python2.4 on ssh:// or git:// urls, so
# ensure we actually have a parts[1] before continuing.
if parts[1] != '':