#NEWLINE# def _setup_vagrant_environment( ) : #NEWLINE# #INDENT# 'Use vagrant commands to get connection information.\n    https://gist.github.com/1d4f7c3e98efdf860b7e\n    ' #NEWLINE# env . logger . info ( 'Get vagrant environment' ) #NEWLINE# raw_ssh_config = subprocess . Popen ( [ 'vagrant' , 'ssh-config' ] , stdout = subprocess . PIPE ) . communicate ( ) [ 0 ] #NEWLINE# env . logger . info ( raw_ssh_config ) #NEWLINE# ssh_config = dict ( [ l . strip ( ) . split ( ) for l in raw_ssh_config . split ( '\n' ) if l ] ) #NEWLINE# env . user = ssh_config [ 'User' ] #NEWLINE# env . hosts = [ ssh_config [ 'HostName' ] ] #NEWLINE# env . port = ssh_config [ 'Port' ] #NEWLINE# env . host_string = ( '%s@%s:%s' % ( env . user , env . hosts [ 0 ] , env . port ) ) #NEWLINE# env . key_filename = ssh_config [ 'IdentityFile' ] . replace ( '"' , '' ) #NEWLINE# env . logger . debug ( ( 'ssh %s' % env . host_string ) )