summaryrefslogtreecommitdiff
path: root/bin/ansible-galaxy
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ansible-galaxy')
-rwxr-xr-xbin/ansible-galaxy25
1 files changed, 14 insertions, 11 deletions
diff --git a/bin/ansible-galaxy b/bin/ansible-galaxy
index f4148d92..3cb7fe2c 100755
--- a/bin/ansible-galaxy
+++ b/bin/ansible-galaxy
@@ -79,15 +79,11 @@ SERVER_DEF = [
# config definition fields
SERVER_ADDITIONAL = {
'v3': {'default': 'False'},
- 'validate_certs': {'default': True, 'cli': [{'name': 'validate_certs'}]},
+ 'validate_certs': {'cli': [{'name': 'validate_certs'}]},
'timeout': {'default': '60', 'cli': [{'name': 'timeout'}]},
'token': {'default': None},
}
-# override default if the generic is set
-if C.GALAXY_IGNORE_CERTS is not None:
- SERVER_ADDITIONAL['validate_certs'].update({'default': not C.GALAXY_IGNORE_CERTS})
-
def with_collection_artifacts_manager(wrapped_method):
"""Inject an artifacts manager if not passed explicitly.
@@ -100,7 +96,8 @@ def with_collection_artifacts_manager(wrapped_method):
if 'artifacts_manager' in kwargs:
return wrapped_method(*args, **kwargs)
- artifacts_manager_kwargs = {'validate_certs': context.CLIARGS['validate_certs']}
+ # FIXME: use validate_certs context from Galaxy servers when downloading collections
+ artifacts_manager_kwargs = {'validate_certs': context.CLIARGS['resolved_validate_certs']}
keyring = context.CLIARGS.get('keyring', None)
if keyring is not None:
@@ -197,7 +194,11 @@ class RoleDistributionServer:
class GalaxyCLI(CLI):
- '''command to manage Ansible roles in shared repositories, the default of which is Ansible Galaxy *https://galaxy.ansible.com*.'''
+ '''Command to manage Ansible roles and collections.
+
+ None of the CLI tools are designed to run concurrently with themselves.
+ Use an external scheduler and/or locking to ensure there are no clashing operations.
+ '''
name = 'ansible-galaxy'
@@ -584,6 +585,8 @@ class GalaxyCLI(CLI):
# ensure we have 'usable' cli option
setattr(options, 'validate_certs', (None if options.ignore_certs is None else not options.ignore_certs))
+ # the default if validate_certs is None
+ setattr(options, 'resolved_validate_certs', (options.validate_certs if options.validate_certs is not None else not C.GALAXY_IGNORE_CERTS))
display.verbosity = options.verbosity
return options
@@ -641,6 +644,8 @@ class GalaxyCLI(CLI):
token_val = server_options['token'] or NoTokenSentinel
username = server_options['username']
v3 = server_options.pop('v3')
+ if server_options['validate_certs'] is None:
+ server_options['validate_certs'] = context.CLIARGS['resolved_validate_certs']
validate_certs = server_options['validate_certs']
if v3:
@@ -676,9 +681,7 @@ class GalaxyCLI(CLI):
cmd_server = context.CLIARGS['api_server']
cmd_token = GalaxyToken(token=context.CLIARGS['api_key'])
- # resolve validate_certs
- v_config_default = True if C.GALAXY_IGNORE_CERTS is None else not C.GALAXY_IGNORE_CERTS
- validate_certs = v_config_default if context.CLIARGS['validate_certs'] is None else context.CLIARGS['validate_certs']
+ validate_certs = context.CLIARGS['resolved_validate_certs']
if cmd_server:
# Cmd args take precedence over the config entry but fist check if the arg was a name and use that config
# entry, otherwise create a new API entry for the server specified.
@@ -844,7 +847,7 @@ class GalaxyCLI(CLI):
name=coll_req['name'],
),
coll_req['source'],
- validate_certs=not context.CLIARGS['ignore_certs'],
+ validate_certs=context.CLIARGS['resolved_validate_certs'],
),
)