module was failing on python 2.7 after last update (#2459)
This commit is contained in:
parent
4bbbad6378
commit
feb08d9a84
1 changed files with 8 additions and 5 deletions
|
@ -26,6 +26,7 @@ import os
|
||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
import posixpath
|
import posixpath
|
||||||
|
import urlparse
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
from ansible.module_utils.urls import *
|
from ansible.module_utils.urls import *
|
||||||
try:
|
try:
|
||||||
|
@ -231,9 +232,9 @@ class MavenDownloader:
|
||||||
|
|
||||||
def _request(self, url, failmsg, f):
|
def _request(self, url, failmsg, f):
|
||||||
url_to_use = url
|
url_to_use = url
|
||||||
parsed_url = urlparse.urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
if parsed_url.scheme=='s3':
|
if parsed_url.scheme=='s3':
|
||||||
parsed_url = urlparse.urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
bucket_name = parsed_url.netloc[:parsed_url.netloc.find('.')]
|
bucket_name = parsed_url.netloc[:parsed_url.netloc.find('.')]
|
||||||
key_name = parsed_url.path[1:]
|
key_name = parsed_url.path[1:]
|
||||||
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
||||||
|
@ -332,8 +333,10 @@ def main():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
parsed_url = urlparse.urlparse(module.params["repository_url"])
|
parsed_url = urlparse(module.params["repository_url"])
|
||||||
|
except AttributeError as e:
|
||||||
|
module.fail_json(msg='url parsing went wrong %s' % e)
|
||||||
|
|
||||||
if parsed_url.scheme=='s3' and not HAS_BOTO:
|
if parsed_url.scheme=='s3' and not HAS_BOTO:
|
||||||
module.fail_json(msg='boto3 required for this module, when using s3:// repository URLs')
|
module.fail_json(msg='boto3 required for this module, when using s3:// repository URLs')
|
||||||
|
@ -384,4 +387,4 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
Loading…
Reference in a new issue