Remove unnecessary getattr from init for Squeezebox (#149077)

This commit is contained in:
peteS-UK 2025-07-19 18:20:11 +01:00 committed by GitHub
parent b3f049676d
commit 0cfb395ab5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,9 +112,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
if not status: if not status:
# pysqueezebox's async_query returns None on various issues, # pysqueezebox's async_query returns None on various issues,
# including HTTP errors where it sets lms.http_status. # including HTTP errors where it sets lms.http_status.
http_status = getattr(lms, "http_status", "N/A")
if http_status == HTTPStatus.UNAUTHORIZED: if lms.http_status == HTTPStatus.UNAUTHORIZED:
_LOGGER.warning("Authentication failed for Squeezebox server %s", host) _LOGGER.warning("Authentication failed for Squeezebox server %s", host)
raise ConfigEntryAuthFailed( raise ConfigEntryAuthFailed(
translation_domain=DOMAIN, translation_domain=DOMAIN,
@ -128,14 +127,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
_LOGGER.warning( _LOGGER.warning(
"LMS %s returned no status or an error (HTTP status: %s). Retrying setup", "LMS %s returned no status or an error (HTTP status: %s). Retrying setup",
host, host,
http_status, lms.http_status,
) )
raise ConfigEntryNotReady( raise ConfigEntryNotReady(
translation_domain=DOMAIN, translation_domain=DOMAIN,
translation_key="init_get_status_failed", translation_key="init_get_status_failed",
translation_placeholders={ translation_placeholders={
"host": str(host), "host": str(host),
"http_status": str(http_status), "http_status": str(lms.http_status),
}, },
) )