Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature_base_driver' into featur…
Browse files Browse the repository at this point in the history
…e_base_driver
  • Loading branch information
alexquali committed Apr 23, 2024
2 parents 96ee9d8 + cd4f6d7 commit 909db11
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cloudshell/cp/proxmox/handlers/rest_api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def get_vnc_shell(self, node):
return self._do_post(
path=f"nodes/{node}/termproxy",
json={
"node": node,
"node": "proxmox1",
# "websocket": True
},
http_error_map=error_map,
Expand Down
34 changes: 22 additions & 12 deletions cloudshell/cp/proxmox/handlers/vnc_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ssl
import warnings
import websocket
from cloudshell.cli.session.helper.normalize_buffer import normalize_buffer

from cloudshell.cp.proxmox.handlers.rest_api_handler import ProxmoxAutomationAPI

Expand Down Expand Up @@ -32,7 +33,7 @@

cookie = api.token
headers = {
'Authorization': f'PVEAPIToken={proxmox_user}',
'Authorization': f'PVEAPIToken={api.token}',
'Sec-WebSocket-Protocol': 'bianry',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
Expand All @@ -50,19 +51,28 @@

ws = websocket.create_connection(url=f"{websocket_url}?{urlencode(query_params)}", sslopt=opts, header=headers)

ws.send(f'{proxmox_user}:{ticket}\n')
print(ws.getstatus())
print(ws.recv_data())
ws.send('1:86:24:')
print(ws.getstatus())
print(ws.recv_data())
ws.ping()
ws.send_bytes(bytearray('lxc-info -n 108 -i\n', 'utf-8'))
handshake = f"{proxmox_user}!{api.token}:{ticket}\n"
# handshake = f"{proxmox_user}:{ticket}\n"

ws.send(handshake)
print(ws.getstatus())
ws.ping()
print(ws.recv_data())
print(ws.recv_data())
ws.ping()
# ws.send('1:86:24:')
# print(ws.getstatus())
# print(ws.recv_data())
# ws.ping()
# ws.send_text('lxc-info -n 108 -i\n')
# ws.send_bytes(bytearray('lxc-info -n 108 -i\n', 'utf-8'))
# ws.send('1:86:24:')
# print(ws.getstatus())
# ws.ping()
# print(ws.recv_data())
# print(ws.recv_data())
# print(ws.recv_data())
# print(ws.recv_data())
# print(ws.recv_data())

# ws.ping()
# print(ws.recv_data())
# print(ws.recv_data())
# print(ws.recv_data())
Expand Down

0 comments on commit 909db11

Please sign in to comment.