@ -1,20 +1,7 @@
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015, 2017 Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2015, 2017 Toshio Kuratomi <tkuratomi@ansible.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import ( absolute_import , division , print_function )
from __future__ import ( absolute_import , division , print_function )
__metaclass__ = type
__metaclass__ = type
@ -78,6 +65,10 @@ class Connection(ConnectionBase):
executable = C . DEFAULT_EXECUTABLE . split ( ) [ 0 ] if C . DEFAULT_EXECUTABLE else None
executable = C . DEFAULT_EXECUTABLE . split ( ) [ 0 ] if C . DEFAULT_EXECUTABLE else None
if not os . path . exists ( to_bytes ( executable , errors = ' surrogate_or_strict ' ) ) :
raise AnsibleError ( " failed to find the executable specified %s . "
" Please verify if the executable exists and re-try. " % executable )
display . vvv ( u " EXEC {0} " . format ( to_text ( cmd ) ) , host = self . _play_context . remote_addr )
display . vvv ( u " EXEC {0} " . format ( to_text ( cmd ) ) , host = self . _play_context . remote_addr )
display . debug ( " opening command with Popen() " )
display . debug ( " opening command with Popen() " )
@ -152,7 +143,7 @@ class Connection(ConnectionBase):
raise AnsibleError ( " failed to transfer file to {0} : {1} " . format ( to_native ( out_path ) , to_native ( e ) ) )
raise AnsibleError ( " failed to transfer file to {0} : {1} " . format ( to_native ( out_path ) , to_native ( e ) ) )
def fetch_file ( self , in_path , out_path ) :
def fetch_file ( self , in_path , out_path ) :
''' fetch a file from local to local -- for co patibility '''
''' fetch a file from local to local -- for co m patibility '''
super ( Connection , self ) . fetch_file ( in_path , out_path )
super ( Connection , self ) . fetch_file ( in_path , out_path )