@ -71,10 +71,11 @@ class ConnectionProcess(object):
The connection process wraps around a Connection object that manages
the connection to a remote device that persists over the playbook
'''
def __init__ ( self , fd , play_context , socket_path , original_path , ansible_playbook_pid= None ) :
def __init__ ( self , fd , play_context , socket_path , original_path , task_uuid= None , ansible_playbook_pid= None ) :
self . play_context = play_context
self . socket_path = socket_path
self . original_path = original_path
self . _task_uuid = task_uuid
self . fd = fd
self . exception = None
@ -98,7 +99,7 @@ class ConnectionProcess(object):
if self . play_context . private_key_file and self . play_context . private_key_file [ 0 ] not in ' ~/ ' :
self . play_context . private_key_file = os . path . join ( self . original_path , self . play_context . private_key_file )
self . connection = connection_loader . get ( self . play_context . connection , self . play_context , ' /dev/null ' ,
ansible_playbook_pid= self . _ansible_playbook_pid )
task_uuid= self . _task_uuid , ansible_playbook_pid= self . _ansible_playbook_pid )
self . connection . set_options ( var_options = variables )
self . connection . _socket_path = self . socket_path
@ -257,8 +258,8 @@ def main():
if rc == 0 :
ssh = connection_loader . get ( ' ssh ' , class_only = True )
ansible_playbook_pid = sys . argv [ 1 ]
task_uuid = sys . argv [ 2 ]
cp = ssh . _create_control_path ( play_context . remote_addr , play_context . port , play_context . remote_user , play_context . connection , ansible_playbook_pid )
# create the persistent connection dir if need be and create the paths
# which we will be using later
tmp_path = unfrackpath ( C . PERSISTENT_CONTROL_PATH_DIR )
@ -278,7 +279,7 @@ def main():
try :
os . close ( r )
wfd = os . fdopen ( w , ' w ' )
process = ConnectionProcess ( wfd , play_context , socket_path , original_path , ansible_playbook_pid)
process = ConnectionProcess ( wfd , play_context , socket_path , original_path , task_uuid, ansible_playbook_pid)
process . start ( variables )
except Exception :
messages . append ( ( ' error ' , traceback . format_exc ( ) ) )
@ -305,7 +306,7 @@ def main():
pc_data = to_text ( init_data )
try :
conn . update_play_context ( pc_data )
conn . set_cli_prompt_context( )
conn . update_cli_prompt_context( task_uuid )
except Exception as exc :
# Only network_cli has update_play context and set_cli_prompt_context, so missing this is
# not fatal e.g. netconf