@@ -62,108 +62,42 @@ def __init__(self, host=None, session=None, config_files=None,
62
62
else :
63
63
self ._session = session
64
64
65
- def agent_version (self ):
66
- return self ._impl .agent_version ()
67
-
68
- def config_set_power_timeout (self , timeout ):
69
- return self ._impl .config_set_power_timeout (timeout , self ._session )
65
+ def __getattr__ (self , name ):
66
+ if self ._impl is None :
67
+ return None
70
68
71
- def config_set_session_timeout (self , timeout ):
72
- return self ._impl .config_set_session_timeout (timeout , self ._session )
69
+ attr = getattr (self ._impl , name )
70
+ if self ._session and callable (attr ):
71
+ def wrapper (* args , ** kwargs ):
72
+ kwargs ['session' ] = self ._session
73
+ return attr (* args , ** kwargs )
74
+ return wrapper
75
+ return attr
73
76
74
77
def console_prefix_key (self ):
75
78
return self ._agent .console_prefix_key ()
76
79
77
- def command (self , args ):
78
- return self ._impl .command (args , self ._session )
79
-
80
- def console_clear (self ):
81
- return self ._impl .console_clear (self ._session )
82
-
83
- def console_dump (self ):
84
- return self ._impl .console_dump (self ._session )
85
-
86
- def console_flush (self ):
87
- return self ._impl .console_flush (self ._session )
88
-
89
80
def console_getkey (self ):
90
81
return self ._agent .console_getkey ()
91
82
92
83
def console_init (self ):
93
84
return self ._agent .console_init ()
94
85
95
- def console_head (self ):
96
- return self ._impl .console_head (self ._session )
97
-
98
- def console_lines (self ):
99
- return self ._impl .console_lines (self ._session )
100
-
101
- def console_locked (self ):
102
- return self ._impl .console_locked (self ._session )
103
-
104
- def console_print (self , data ):
105
- return self ._impl .console_print (data , self ._session )
106
-
107
- def console_prompt (self , newPrompt = None ):
108
- return self ._impl .console_prompt (newPrompt , self ._session )
109
-
110
86
def console_remote (self , host , screen ):
111
87
return self ._agent .console_remote (host , screen )
112
88
113
- def console_run (self , cmd ):
114
- return self ._impl .console_run (cmd , self ._session )
115
-
116
- def console_send (self , data , raw = False ):
117
- return self ._impl .console_send (data , raw , self ._session )
118
-
119
89
def console_toggle (self ):
120
90
return self ._agent .console_toggle (self ._session )
121
91
122
- def console_tail (self ):
123
- return self ._impl .console_tail (self ._session )
124
-
125
- def console_wait (self , what , timeout = None ):
126
- return self ._impl .console_wait (what , timeout , self ._session )
127
-
128
- def env_get (self , name ):
129
- return self ._impl .env_get (name , self ._session )
130
-
131
- def env_set (self , name , value ):
132
- return self ._impl .env_set (name , value , self ._session )
133
-
134
- def keyboard_write (self , data ):
135
- return self ._impl .keyboard_write (data , self ._session )
136
-
137
92
def monitor_remote (self , host , screen ):
138
93
return self ._agent .monitor_remote (host , screen )
139
94
140
- def monitor_send (self , data , raw = False ):
141
- return self ._impl .monitor_send (data , raw , self ._session )
142
-
143
- def monitor_wait (self , what , timeout = None ):
144
- return self ._impl .monitor_wait (what , timeout , self ._session )
145
-
146
95
def pastebin_api_key (self ):
147
96
return self ._agent .pastebin_api_key ()
148
97
149
98
def pastebin_endpoint (self ):
150
99
return self ._agent .pastebin_endpoint ()
151
100
152
- def power_locked (self ):
153
- return self ._impl .power_locked (self ._session )
154
-
155
- def storage_bytes_written (self ):
156
- return self ._impl .storage_bytes_written (self ._session )
157
-
158
- def storage_close (self ):
159
- return self ._impl .storage_close (self ._session )
160
-
161
- def storage_locked (self ):
162
- return self ._impl .storage_locked (self ._session )
163
-
164
- def storage_mount (self , part = None ):
165
- return self ._impl .storage_mount (part , self ._session )
166
-
167
101
def storage_network (self , remote ):
168
102
cmd = '/usr/sbin/nbd-client'
169
103
if os .path .exists (cmd ) is False :
@@ -190,9 +124,6 @@ def storage_open(self):
190
124
else :
191
125
raise
192
126
193
- def storage_status (self ):
194
- return self ._impl .storage_status (self ._session )
195
-
196
127
def storage_update (self , dest , src = None , callback = None ):
197
128
path = dest if src is None else src
198
129
try :
@@ -315,15 +246,6 @@ def parseBmap(self, bmap, bmap_path):
315
246
return None
316
247
return bmapDict
317
248
318
- def storage_to_host (self ):
319
- return self ._impl .storage_to_host (self ._session )
320
-
321
- def storage_to_target (self ):
322
- return self ._impl .storage_to_target (self ._session )
323
-
324
- def storage_swap (self ):
325
- return self ._impl .storage_swap (self ._session )
326
-
327
249
def start (self ):
328
250
return self ._agent .start ()
329
251
@@ -349,57 +271,6 @@ def target_lock(self, retries=0):
349
271
time .sleep (60 )
350
272
return status
351
273
352
- def target_locked (self ):
353
- return self ._impl .target_locked (self ._session )
354
-
355
- def target_off (self ):
356
- return self ._impl .target_off (self ._session )
357
-
358
- def target_on (self ):
359
- return self ._impl .target_on (self ._session )
360
-
361
- def target_status (self ):
362
- return self ._impl .target_status (self ._session )
363
-
364
- def target_toggle (self ):
365
- return self ._impl .target_toggle (self ._session )
366
-
367
- def target_unlock (self ):
368
- return self ._impl .target_unlock (self ._session )
369
-
370
- def target_uptime (self ):
371
- return self ._impl .target_uptime (self ._session )
372
-
373
- def toggle_timestamps (self ):
374
- return self ._impl .toggle_timestamps ()
375
-
376
- def usb_find_by_class (self , className ):
377
- return self ._impl .usb_find_by_class (className , self ._session )
378
-
379
- def usb_has_class (self , className ):
380
- return self ._impl .usb_has_class (className , self ._session )
381
-
382
- def usb_off (self , ndx ):
383
- return self ._impl .usb_off (ndx , self ._session )
384
-
385
- def usb_off_by_class (self , className ):
386
- return self ._impl .usb_off_by_class (className , self ._session )
387
-
388
- def usb_on (self , ndx ):
389
- return self ._impl .usb_on (ndx , self ._session )
390
-
391
- def usb_on_by_class (self , className ):
392
- return self ._impl .usb_on_by_class (className , self ._session )
393
-
394
- def usb_ports (self ):
395
- return self ._impl .usb_ports (self ._session )
396
-
397
- def usb_status (self , ndx ):
398
- return self ._impl .usb_status (ndx , self ._session )
399
-
400
- def usb_toggle (self , ndx ):
401
- return self ._impl .usb_toggle (ndx , self ._session )
402
-
403
274
def version (self ):
404
275
return self ._agent .version
405
276
0 commit comments