Merge pull request #15364 from gregsidelinger/galaxy-ingore-certs-fix
Fix issue with ansible-galaxy and --ignore-certs
This commit is contained in:
commit
432bfe5a4f
1 changed files with 9 additions and 1 deletions
|
@ -30,6 +30,7 @@ import yaml
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
|
import ansible.constants as C
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
from ansible.playbook.role.requirement import RoleRequirement
|
from ansible.playbook.role.requirement import RoleRequirement
|
||||||
|
@ -54,6 +55,13 @@ class GalaxyRole(object):
|
||||||
self._metadata = None
|
self._metadata = None
|
||||||
self._install_info = None
|
self._install_info = None
|
||||||
|
|
||||||
|
self._validate_certs = not C.GALAXY_IGNORE_CERTS
|
||||||
|
|
||||||
|
# set validate_certs
|
||||||
|
if galaxy.options.ignore_certs:
|
||||||
|
self._validate_certs = False
|
||||||
|
display.vvv('Validate TLS certificates: %s' % self._validate_certs)
|
||||||
|
|
||||||
self.options = galaxy.options
|
self.options = galaxy.options
|
||||||
self.galaxy = galaxy
|
self.galaxy = galaxy
|
||||||
|
|
||||||
|
@ -168,7 +176,7 @@ class GalaxyRole(object):
|
||||||
display.display("- downloading role from %s" % archive_url)
|
display.display("- downloading role from %s" % archive_url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url_file = open_url(archive_url)
|
url_file = open_url(archive_url, validate_certs=self._validate_certs)
|
||||||
temp_file = tempfile.NamedTemporaryFile(delete=False)
|
temp_file = tempfile.NamedTemporaryFile(delete=False)
|
||||||
data = url_file.read()
|
data = url_file.read()
|
||||||
while data:
|
while data:
|
||||||
|
|
Loading…
Reference in a new issue