@_docker_client
def _client_wrapper(attr, *args, **kwargs):
 catch_api_errors = kwargs.pop('catch_api_errors', True)
 if ('docker.client' not in __context__):
  raise CommandExecutionError('Docker service not running or not installed?')
 func = getattr(__context__['docker.client'], attr)
 if (func is None):
  raise SaltInvocationError("Invalid client action '{0}'".format(attr))
 err = ''
 try:
  return func(*args, **kwargs)
 except docker.errors.APIError as exc:
  if catch_api_errors:
   raise CommandExecutionError('Error {0}: {1}'.format(exc.response.status_code, exc.explanation))
  else:
   raise
 except Exception as exc:
  err = '{0}'.format(exc)
 msg = 'Unable to perform {0}'.format(attr)
 if err:
  msg += ': {0}'.format(err)
 raise CommandExecutionError(msg)

@ _docker_client def _client_wrapper ( attr , * args , ** kwargs ) : catch_api_errors = kwargs . pop ( 'catch_api_errors' , True ) if ( 'docker.client' not in __context__ ) : raise CommandExecutionError ( 'Docker service not running or not installed?' ) func = getattr ( __context__ [ 'docker.client' ] , attr ) if ( func is None ) : raise SaltInvocationError ( "Invalid client action '{0}'" . format ( attr ) ) err = '' try : return func ( * args , ** kwargs ) except docker . errors . APIError as exc : if catch_api_errors : raise CommandExecutionError ( 'Error {0}: {1}' . format ( exc . response . status_code , exc . explanation ) ) else : raise except Exception as exc : err = '{0}' . format ( exc ) msg = 'Unable to perform {0}' . format ( attr ) if err : msg += ': {0}' . format ( err ) raise CommandExecutionError ( msg )
common functionality for getting information from a container .