1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-01 09:32:21 +01:00

[core] Fix serial upload regression from DNS resolution PR #10595 (#10648)

This commit is contained in:
J. Nick Koston
2025-09-08 10:41:03 -05:00
committed by GitHub
parent e5bba00deb
commit 75c9430d91
2 changed files with 22 additions and 30 deletions

View File

@@ -310,7 +310,7 @@ def perform_ota(
def run_ota_impl_(
remote_host: str | list[str], remote_port: int, password: str, filename: str
) -> int:
) -> tuple[int, str | None]:
# Handle both single host and list of hosts
try:
# Resolve all hosts at once for parallel DNS resolution
@@ -344,21 +344,22 @@ def run_ota_impl_(
perform_ota(sock, password, file_handle, filename)
except OTAError as err:
_LOGGER.error(str(err))
return 1
return 1, None
finally:
sock.close()
return 0
# Successfully uploaded to sa[0]
return 0, sa[0]
_LOGGER.error("Connection failed.")
return 1
return 1, None
def run_ota(
remote_host: str | list[str], remote_port: int, password: str, filename: str
) -> int:
) -> tuple[int, str | None]:
try:
return run_ota_impl_(remote_host, remote_port, password, filename)
except OTAError as err:
_LOGGER.error(err)
return 1
return 1, None