Skip to content

Commit 0392392

Browse files
committed
add SSH backend (not working yet)
1 parent 17dc7c6 commit 0392392

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libspecinfra/backend/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,15 @@ def __init__(self):
1313

1414
def __exit__(self, exc_type, exc_value, traceback):
1515
self.lib.backend_direct_free(self.obj)
16+
17+
class SSH(object):
18+
19+
def __init__(self, host):
20+
lib = libspecinfra.load()
21+
lib.backend_ssh_new.argtypes = (ctypes.c_char_p,)
22+
lib.backend_ssh_new.restype = ctypes.POINTER(BackendWrapperS)
23+
lib.backend_ssh_free.argtypes = (ctypes.POINTER(BackendWrapperS),)
24+
self.obj = lib.backend_ssh_new(host.encode('utf-8'))
25+
26+
def __exit__(self, exc_type, exc_value, traceback):
27+
self.lib.backend_ssh_free(self.obj)

0 commit comments

Comments
 (0)