|
@@ -1,3 +1,4 @@
|
|
|
+import types
|
|
|
import errno
|
|
|
import sys
|
|
|
import telnetlib
|
|
@@ -192,18 +193,23 @@ class ObjectTelnet(ObjectConnection):
|
|
|
"""
|
|
|
iteration = 0
|
|
|
position = -1
|
|
|
+ if isinstance(expected, types.StringType):
|
|
|
+ expected = [expected]
|
|
|
while iteration < 6:
|
|
|
- (i, obj, all_data) = self.tn.expect(expected, 10)
|
|
|
- nc = 1
|
|
|
- for ch in expected:
|
|
|
- if ch in all_data:
|
|
|
- position = nc
|
|
|
- break
|
|
|
- nc += 1
|
|
|
- if position == -1:
|
|
|
- iteration += 1
|
|
|
- else:
|
|
|
+ try:
|
|
|
+ (i, obj, all_data) = self.tn.expect(expected, 10)
|
|
|
+ nc = 1
|
|
|
+ for ch in expected:
|
|
|
+ if ch in all_data:
|
|
|
+ position = nc
|
|
|
+ break
|
|
|
+ nc += 1
|
|
|
+ if position == -1:
|
|
|
+ iteration += 1
|
|
|
+ else:
|
|
|
+ iteration = 6
|
|
|
+ print(str(all_data))
|
|
|
+ self.all_data = self.all_data + str(all_data)
|
|
|
+ except EOFError as error:
|
|
|
iteration = 6
|
|
|
- print(str(all_data))
|
|
|
- self.all_data = self.all_data + str(all_data)
|
|
|
return position
|