Fix issues with ironware modules (#33068)

- authorize was not working as expected
 - use end command to get to exec context instead of exit
 - error due to mishandling of global variable _DEVICE_CONFIG
This commit is contained in:
paulquack 2017-11-21 16:11:06 +11:00 committed by Ganesh Nalawade
parent d372cea2f8
commit 47eaf662a7
3 changed files with 6 additions and 3 deletions

View file

@ -60,6 +60,8 @@ class ActionModule(_ActionModule):
pc.private_key_file = provider['ssh_keyfile'] or self._play_context.private_key_file
pc.timeout = int(provider['timeout'] or C.PERSISTENT_COMMAND_TIMEOUT)
pc.become = provider['authorize'] or False
if pc.become:
pc.become_method = 'enable'
pc.become_pass = provider['auth_pass']
display.vvv('using connection plugin %s' % pc.connection, pc.remote_addr)
@ -78,8 +80,8 @@ class ActionModule(_ActionModule):
conn = Connection(socket_path)
out = conn.get_prompt()
if to_text(out, errors='surrogate_then_replace').strip().endswith(')#'):
display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
conn.send_command('exit')
display.vvvv('wrong context, sending end to device', self._play_context.remote_addr)
conn.send_command('end')
task_vars['ansible_socket'] = socket_path