def _get_client(timeout=None):
 if ('docker.client' not in __context__):
  client_kwargs = {}
  for (key, val) in (('base_url', 'docker.url'), ('version', 'docker.version')):
   param = __salt__['config.get'](val, NOTSET)
   if (param is not NOTSET):
    client_kwargs[key] = param
  if (('base_url' not in client_kwargs) and ('DOCKER_HOST' in os.environ)):
   client_kwargs['base_url'] = os.environ.get('DOCKER_HOST')
  if ('version' not in client_kwargs):
   client_kwargs['version'] = 'auto'
  docker_machine = __salt__['config.get']('docker.machine', NOTSET)
  if (docker_machine is not NOTSET):
   docker_machine_json = __salt__['cmd.run'](('docker-machine inspect ' + docker_machine))
   try:
    docker_machine_json = json.loads(docker_machine_json)
    docker_machine_tls = docker_machine_json['HostOptions']['AuthOptions']
    docker_machine_ip = docker_machine_json['Driver']['IPAddress']
    client_kwargs['base_url'] = (('https://' + docker_machine_ip) + ':2376')
    client_kwargs['tls'] = docker.tls.TLSConfig(client_cert=(docker_machine_tls['ClientCertPath'], docker_machine_tls['ClientKeyPath']), ca_cert=docker_machine_tls['CaCertPath'], assert_hostname=False, verify=True)
   except Exception as exc:
    raise CommandExecutionError('Docker machine {0} failed: {1}'.format(docker_machine, exc))
  try:
   __context__['docker.client'] = docker.Client(**client_kwargs)
  except docker.errors.DockerException:
   log.error('Could not initialize Docker client')
   return False
 if ((timeout is not None) and (__context__['docker.client'].timeout != timeout)):
  __context__['docker.client'].timeout = timeout

def _get_client ( timeout = None ) : if ( 'docker.client' not in __context__ ) : client_kwargs = { } for ( key , val ) in ( ( 'base_url' , 'docker.url' ) , ( 'version' , 'docker.version' ) ) : param = __salt__ [ 'config.get' ] ( val , NOTSET ) if ( param is not NOTSET ) : client_kwargs [ key ] = param if ( ( 'base_url' not in client_kwargs ) and ( 'DOCKER_HOST' in os . environ ) ) : client_kwargs [ 'base_url' ] = os . environ . get ( 'DOCKER_HOST' ) if ( 'version' not in client_kwargs ) : client_kwargs [ 'version' ] = 'auto' docker_machine = __salt__ [ 'config.get' ] ( 'docker.machine' , NOTSET ) if ( docker_machine is not NOTSET ) : docker_machine_json = __salt__ [ 'cmd.run' ] ( ( 'docker-machine inspect ' + docker_machine ) ) try : docker_machine_json = json . loads ( docker_machine_json ) docker_machine_tls = docker_machine_json [ 'HostOptions' ] [ 'AuthOptions' ] docker_machine_ip = docker_machine_json [ 'Driver' ] [ 'IPAddress' ] client_kwargs [ 'base_url' ] = ( ( 'https://' + docker_machine_ip ) + ':2376' ) client_kwargs [ 'tls' ] = docker . tls . TLSConfig ( client_cert = ( docker_machine_tls [ 'ClientCertPath' ] , docker_machine_tls [ 'ClientKeyPath' ] ) , ca_cert = docker_machine_tls [ 'CaCertPath' ] , assert_hostname = False , verify = True ) except Exception as exc : raise CommandExecutionError ( 'Docker machine {0} failed: {1}' . format ( docker_machine , exc ) ) try : __context__ [ 'docker.client' ] = docker . Client ( ** client_kwargs ) except docker . errors . DockerException : log . error ( 'Could not initialize Docker client' ) return False if ( ( timeout is not None ) and ( __context__ [ 'docker.client' ] . timeout != timeout ) ) : __context__ [ 'docker.client' ] . timeout = timeout
get a boto connection to data pipeline .