Avoid creating GALAXY_TOKEN_PATH for configured ansible-galaxy server list

changelog
pull/82270/head
s-hertel 6 months ago
parent d664f13b4a
commit aa9cbada69

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy - avoid creating the ``GALAXY_TOKEN_PATH`` as a side effect of configured servers that don't use ``username``/``password`` or ``auth_url`` for authentication.

@ -693,7 +693,7 @@ class GalaxyCLI(CLI):
client_id=client_id)
else:
# The galaxy v1 / github / django / 'Token'
server_options['token'] = GalaxyToken(token=token_val)
server_options['token'] = GalaxyToken(token=token_val, config={})
server_options.update(galaxy_options)
config_servers.append(GalaxyAPI(

@ -102,10 +102,10 @@ class GalaxyToken(object):
token_type = 'Token'
def __init__(self, token=None):
def __init__(self, token=None, config=None):
self.b_file = to_bytes(C.GALAXY_TOKEN_PATH, errors='surrogate_or_strict')
# Done so the config file is only opened when set/get/save is called
self._config = None
self._config = config
self._token = token
@property

Loading…
Cancel
Save