|
|
@ -64,6 +64,7 @@ class ActionModule(_ActionModule):
|
|
|
|
pc.become = provider['authorize'] or False
|
|
|
|
pc.become = provider['authorize'] or False
|
|
|
|
pc.become_pass = provider['auth_pass']
|
|
|
|
pc.become_pass = provider['auth_pass']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display.vvv('using connection plugin %s' % pc.connection, pc.remote_addr)
|
|
|
|
connection = self._shared_loader_obj.connection_loader.get('persistent', pc, sys.stdin)
|
|
|
|
connection = self._shared_loader_obj.connection_loader.get('persistent', pc, sys.stdin)
|
|
|
|
|
|
|
|
|
|
|
|
socket_path = self._get_socket_path(pc)
|
|
|
|
socket_path = self._get_socket_path(pc)
|
|
|
@ -72,6 +73,7 @@ class ActionModule(_ActionModule):
|
|
|
|
if not os.path.exists(socket_path):
|
|
|
|
if not os.path.exists(socket_path):
|
|
|
|
# start the connection if it isn't started
|
|
|
|
# start the connection if it isn't started
|
|
|
|
rc, out, err = connection.exec_command('open_shell()')
|
|
|
|
rc, out, err = connection.exec_command('open_shell()')
|
|
|
|
|
|
|
|
display.vvvv('open_shell() returned %s %s %s' % (rc, out, err))
|
|
|
|
if not rc == 0:
|
|
|
|
if not rc == 0:
|
|
|
|
return {'failed': True,
|
|
|
|
return {'failed': True,
|
|
|
|
'msg': 'unable to open shell. Please see: ' +
|
|
|
|
'msg': 'unable to open shell. Please see: ' +
|
|
|
@ -82,7 +84,7 @@ class ActionModule(_ActionModule):
|
|
|
|
# enable mode and not config module
|
|
|
|
# enable mode and not config module
|
|
|
|
rc, out, err = connection.exec_command('prompt()')
|
|
|
|
rc, out, err = connection.exec_command('prompt()')
|
|
|
|
while str(out).strip().endswith(')#'):
|
|
|
|
while str(out).strip().endswith(')#'):
|
|
|
|
display.debug('wrong context, sending exit to device')
|
|
|
|
display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
|
|
|
|
connection.exec_command('exit')
|
|
|
|
connection.exec_command('exit')
|
|
|
|
rc, out, err = connection.exec_command('prompt()')
|
|
|
|
rc, out, err = connection.exec_command('prompt()')
|
|
|
|
|
|
|
|
|
|
|
|