mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 17:43:14 +00:00
Continue trying to flesh out socket api
This commit is contained in:
parent
adf52517fd
commit
35a5e9cbf0
@ -136,6 +136,9 @@ elif opts.unixsock:
|
||||
#Next stop, reading and writing from whichever of stdin and server goes first.
|
||||
#see pyghmi code for solconnect.py
|
||||
|
||||
banner = server.recv(128)
|
||||
while "\n" not in banner:
|
||||
banner += server.recv(128)
|
||||
tty.setraw(sys.stdin.fileno())
|
||||
fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
|
||||
# clear on start can help with readable of TUI, but it
|
||||
|
@ -24,19 +24,25 @@ def sessionhdl(connection, authname):
|
||||
connection.sendall("Confluent -- v0 --\r\n")
|
||||
if authname is None: # prompt for name and passphrase
|
||||
connection.sendall("Name: ")
|
||||
username = connection.recv()
|
||||
username = connection.recv(4096)
|
||||
connection.sendall(username)
|
||||
while "\r" not in username:
|
||||
ddata = connection.recv(4096)
|
||||
if not ddata:
|
||||
return
|
||||
connection.sendall(ddata)
|
||||
username += ddata
|
||||
username, _, passphrase = username.partition("\r")
|
||||
connection.sendall("\nPassphrase: ")
|
||||
while "\r" not in passphrase:
|
||||
passphrase += connection.recv(4096)
|
||||
pdata = connection.recv(4096)
|
||||
if not pdata:
|
||||
return
|
||||
passphrase += pdata
|
||||
connection.sendall("\r\n")
|
||||
print username
|
||||
print passphrase
|
||||
connection.sendall("Confluent -- v0 -- Session Granted\r\n/->")
|
||||
cfm = config.ConfigManager(tenant=0)
|
||||
consession = console.ConsoleSession(node='n1', configmanager=cfm,
|
||||
datacallback=connection.sendall)
|
||||
|
Loading…
Reference in New Issue
Block a user