Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds feature to allow connection to set action plugin #18762

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/ansible/executor/task_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,8 @@ def _get_action_handler(self, connection, templar):
raise AnsibleError("async mode is not supported with the %s module" % self._task.action)
handler_name = self._task.action
elif self._task.async == 0:
handler_name = 'normal'
pc_conn = self._shared_loader_obj.connection_loader.get(self._play_context.connection, class_only=True)
handler_name = getattr(pc_conn, 'action_handler', 'normal')
else:
handler_name = 'async'

Expand Down
8 changes: 8 additions & 0 deletions lib/ansible/plugins/connection/network_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@
from ansible.plugins.connection import ensure_connect
from ansible.plugins.connection.paramiko_ssh import Connection as _Connection

try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()


class Connection(_Connection):
''' CLI (shell) SSH connections on Paramiko '''

transport = 'network_cli'
has_pipelining = False
action_handler = 'network'

def __init__(self, play_context, new_stdin, *args, **kwargs):
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
Expand Down Expand Up @@ -97,6 +104,7 @@ def open_shell(self):
self._terminal.on_authorize(passwd=auth_pass)

def close(self):
display.vvv('closing connection', host=self._play_context.remote_addr)
self.close_shell()
super(Connection, self).close()

Expand Down