Update pve RustDesk GA sync scripts
This commit is contained in:
@@ -222,25 +222,25 @@ def guest_file_read(vmid: int, guest_path: str) -> tuple[str | None, str | None]
|
|||||||
|
|
||||||
|
|
||||||
def read_rustdesk_id_cli(vmid: int) -> tuple[str | None, str | None]:
|
def read_rustdesk_id_cli(vmid: int) -> tuple[str | None, str | None]:
|
||||||
attempts = [
|
attempts = [
|
||||||
([RUSTDESK_EXE, '--get-id'], 'direct'),
|
([RUSTDESK_EXE, '--get-id'], 'direct'),
|
||||||
(['cmd.exe', '/c', f'"{RUSTDESK_EXE} --get-id"'], 'cmd'),
|
(['cmd.exe', '/c', f'"{RUSTDESK_EXE} --get-id"'], 'cmd'),
|
||||||
(
|
(
|
||||||
[
|
[
|
||||||
'powershell.exe', '-NoProfile', '-NonInteractive', '-Command',
|
'powershell.exe', '-NoProfile', '-NonInteractive', '-Command',
|
||||||
"$ProgressPreference='SilentlyContinue'; & 'C:\\Program Files\\RustDesk\\rustdesk.exe' --get-id",
|
"$ProgressPreference='SilentlyContinue'; & 'C:\\Program Files\\RustDesk\\rustdesk.exe' --get-id",
|
||||||
],
|
],
|
||||||
'powershell',
|
'powershell',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
errors: list[str] = []
|
errors: list[str] = []
|
||||||
for command, label in attempts:
|
for command, label in attempts:
|
||||||
rid, err = guest_exec_text(vmid, command, timeout=45)
|
rid, err = guest_exec_text(vmid, command, timeout=45)
|
||||||
if rid and re.fullmatch(r'\d{6,12}', rid):
|
if rid and re.fullmatch(r'\d{6,12}', rid):
|
||||||
log(f'VM {vmid}: ID {rid} from rustdesk --get-id ({label})')
|
log(f'VM {vmid}: ID {rid} from rustdesk --get-id ({label})')
|
||||||
return rid, None
|
return rid, None
|
||||||
errors.append(f'{label}: {err or "no id"}')
|
errors.append(f'{label}: {err or "no id"}')
|
||||||
return None, errors[-1] if errors else 'rustdesk --get-id failed'
|
return None, errors[-1] if errors else 'rustdesk --get-id failed'
|
||||||
|
|
||||||
|
|
||||||
def read_rustdesk_id_report(vmid: int) -> tuple[str | None, str | None]:
|
def read_rustdesk_id_report(vmid: int) -> tuple[str | None, str | None]:
|
||||||
|
|||||||
Reference in New Issue
Block a user