-
-
Save tcuthbert/75aeec597c0302ca2b9fa2f5cb6341b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/trigger/netdevices/__init__.py b/trigger/netdevices/__init__.py | |
index 6bb2e4b..2a656f1 100644 | |
--- a/trigger/netdevices/__init__.py | |
+++ b/trigger/netdevices/__init__.py | |
@@ -42,10 +42,8 @@ from twisted.internet import defer | |
from trigger.conf import settings | |
from trigger.utils import network, parse_node_port | |
from trigger.utils.url import parse_url | |
-from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect | |
from trigger import changemgmt, exceptions, rancid | |
from UserDict import DictMixin | |
-from crochet import setup, run_in_reactor, wait_for | |
import xml.etree.cElementTree as ET | |
from . import loader | |
try: | |
@@ -510,6 +508,7 @@ class NetDevice(object): | |
return None | |
def _get_endpoint(self, *args): | |
+ from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect | |
endpoint = generate_endpoint(self).wait() | |
factory = TriggerEndpointClientFactory() | |
@@ -525,6 +524,7 @@ class NetDevice(object): | |
return proto | |
def open(self): | |
+ from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect | |
def inject_net_device_into_protocol(proto): | |
"""Now we're only injecting connection for use later.""" | |
self._conn = proto.transport.conn | |
@@ -543,6 +543,7 @@ class NetDevice(object): | |
return self._connected | |
def close(self): | |
+ from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect | |
def disconnect(proto): | |
proto.transport.loseConnection() | |
return proto | |
@@ -571,7 +572,7 @@ class NetDevice(object): | |
return self._results | |
def run_channeled_commands(self, commands, on_error=None): | |
- from trigger.twister2 import TriggerSSHShellClientEndpointBase | |
+ from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect, TriggerSSHShellClientEndpointBase | |
if on_error is None: | |
on_error = lambda x: x | |
@@ -600,7 +601,7 @@ class NetDevice(object): | |
return d | |
def run_commands(self, commands, on_error=None): | |
- from trigger.twister2 import TriggerSSHShellClientEndpointBase | |
+ from trigger.twister2 import generate_endpoint, TriggerEndpointClientFactory, IoslikeSendExpect, TriggerSSHShellClientEndpointBase | |
if on_error is None: | |
on_error = lambda x: x | |
diff --git a/trigger/twister.py b/trigger/twister.py | |
index 65fd5a7..6ba7910 100644 | |
--- a/trigger/twister.py | |
+++ b/trigger/twister.py | |
@@ -15,6 +15,7 @@ import socket | |
import struct | |
import sys | |
import tty | |
+from crochet import run_in_reactor | |
from twisted.conch.client.default import SSHUserAuthClient | |
from twisted.conch.ssh import channel, common, session, transport | |
from twisted.conch.ssh.connection import SSHConnection | |
diff --git a/trigger/twister2.py b/trigger/twister2.py | |
index 7f93071..0be6a2a 100644 | |
--- a/trigger/twister2.py | |
+++ b/trigger/twister2.py | |
@@ -15,6 +15,10 @@ import sys | |
import tty | |
from copy import copy | |
from collections import deque | |
+ | |
+from crochet import wait_for, run_in_reactor, setup, EventLoop | |
+setup() | |
+ | |
from twisted.conch.ssh import session, common | |
from twisted.conch.ssh.channel import SSHChannel | |
from twisted.conch.endpoints import (SSHCommandClientEndpoint, | |
@@ -34,8 +38,6 @@ from trigger import tacacsrc, exceptions | |
from trigger.twister import is_awaiting_confirmation, has_ioslike_error, TriggerSSHUserAuth | |
from trigger import tacacsrc | |
from twisted.internet import reactor | |
-from crochet import wait_for, run_in_reactor, setup, EventLoop | |
-setup() | |
@run_in_reactor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment