Revision 11d9e642 ncclient/operations/session.py
b/ncclient/operations/session.py | ||
---|---|---|
19 | 19 |
|
20 | 20 |
class CloseSession(RPC): |
21 | 21 |
|
22 |
def __init__(self, session):
|
|
23 |
RPC.__init__(self, session)
|
|
22 |
def __init__(self, *args, **kwds):
|
|
23 |
RPC.__init__(self, *args, **kwds)
|
|
24 | 24 |
self.spec = { 'tag': 'close-session' } |
25 | 25 |
|
26 | 26 |
def deliver(self, reply): |
... | ... | |
28 | 28 |
# can't be too huge a reply, should be ok to parse in callback |
29 | 29 |
self._reply.parse() |
30 | 30 |
if self._reply.ok: |
31 |
self._listener.expect_close()
|
|
31 |
self._session.expect_close()
|
|
32 | 32 |
self._session.close() |
33 | 33 |
|
34 | 34 |
def request(self, reply_event=None): |
35 |
self._do_request(self.spec, reply_event)
|
|
35 |
self._request(self.spec, reply_event) |
|
36 | 36 |
|
37 | 37 |
|
38 | 38 |
class KillSession(RPC): |
39 | 39 |
|
40 |
def __init__(self, session):
|
|
41 |
RPC.__init__(self, session)
|
|
40 |
def __init__(self, *args, **kwds):
|
|
41 |
RPC.__init__(self, *args, **kwds)
|
|
42 | 42 |
self.spec = { |
43 | 43 |
'tag': 'kill-session', |
44 | 44 |
'children': [ { 'tag': 'session-id', 'text': None} ] |
45 | 45 |
} |
46 | 46 |
|
47 |
def request(self, session_id, reply_event=None):
|
|
47 |
def request(self, session_id): |
|
48 | 48 |
if not isinstance(session_id, basestring): # just make sure... |
49 | 49 |
session_id = str(session_id) |
50 | 50 |
self.spec['children'][0]['text'] = session_id |
51 |
self._do_request(self.spec, reply_event) |
|
51 |
self._request(self.spec) |
Also available in: Unified diff