Use proposed docker-py reload_config() func

See https://github.com/docker/docker-py/pull/1586

This allows an existing client instance to disregard its cached auth
config and use the most up-to-date login info from the config.json.
This commit is contained in:
Erik Johnson 2017-05-02 13:40:07 -05:00
parent 19894f68ca
commit b8d1dcc307

View File

@ -818,8 +818,14 @@ def _client_wrapper(attr, *args, **kwargs):
'''
catch_api_errors = kwargs.pop('catch_api_errors', True)
func = getattr(__context__['docker.client'], attr, None)
if func is None:
if func is None or not hasattr(func, '__call__'):
raise SaltInvocationError('Invalid client action \'{0}\''.format(attr))
if attr in ('push', 'pull'):
try:
# Refresh auth config from config.json
__context__['docker.client'].reload_config()
except AttributeError:
pass
err = ''
try:
log.debug(