Revision d6688264 ncclient/manager.py
b/ncclient/manager.py | ||
---|---|---|
44 | 44 |
self._session.connect(*args, **kwds) |
45 | 45 |
|
46 | 46 |
def __getattr__(self, name): |
47 |
name = name.replace('_', '-') |
|
47 | 48 |
if name in OPERATIONS: |
48 | 49 |
return OPERATIONS[name](self._session).request |
49 | 50 |
else: |
50 | 51 |
raise AttributeError |
52 |
|
|
53 |
def get(self, *args, **kwds): |
|
54 |
g = operations.Get(self._session) |
|
55 |
reply = g.request(*args, **kwds) |
|
56 |
if reply.errors: |
|
57 |
raise RPCError(reply.errors) |
|
58 |
else: |
|
59 |
return reply.data |
|
60 |
|
|
61 |
def get_config(self, *args, **kwds): |
|
62 |
gc = operations.GetConfig(self._session) |
|
63 |
reply = gc.request(*args, **kwds) |
|
64 |
if reply.errors: |
|
65 |
raise RPCError(reply.errors) |
|
66 |
else: |
|
67 |
return reply.data |
|
68 |
|
|
69 |
def locked(self, target='running'): |
|
70 |
return LockContext(self._session, target) |
Also available in: Unified diff