Example #1
0
    def __init__(self, play_context, new_stdin, *args, **kwargs):
        super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)

        self._network_os = self._play_context.network_os or 'default'
        display.display('network_os is set to %s' % self._network_os, log_only=True)

        self._netconf = None
        self._manager = None
        self._connected = False

        self._local = LocalConnection(play_context, new_stdin, *args, **kwargs)
Example #2
0
    def turn_on(self):
        host_connection = LocalConnection(play_context=self._play_context, new_stdin='/dev/null')

        self._task.become = False
        self._task.become_flags = None
        self._task.become_method = None
        self._task.become_user = None
        self._task.delegate_to = 'localhost'

        self._play_context.become = False
        self._play_context.become_flags = None
        self._play_context.become_method = None
        self._play_context.become_user = None
        self._play_context.connection = 'local'
        self._play_context.remote_addr = 'localhost'
        self._play_context.remote_user = getpass.getuser()

        self._action_module._connection = host_connection
Example #3
0
    def __init__(self, play_context, new_stdin, *args, **kwargs):
        super(Connection, self).__init__(play_context, new_stdin, *args,
                                         **kwargs)

        self.ssh = None
        self._ssh_shell = None

        self._matched_prompt = None
        self._matched_pattern = None
        self._last_response = None
        self._history = list()

        self._local = LocalConnection(play_context, new_stdin, *args, **kwargs)

        self._terminal = None
        self._cliconf = None

        if self._play_context.verbosity > 3:
            logging.getLogger('paramiko').setLevel(logging.DEBUG)

        # reconstruct the socket_path and set instance values accordingly
        self._update_connection_state()
Example #4
0
 def test_local_connection_module(self):
     self.assertIsInstance(
         LocalConnection(self.play_context, self.in_stream),
         LocalConnection)