Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump aiohasupervisor to version 0.2.1 #129574

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions homeassistant/components/hassio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import asyncio
import logging
from typing import Any
from uuid import UUID

from aiohasupervisor import SupervisorError
from aiohasupervisor.models import Discovery
Expand Down Expand Up @@ -86,7 +87,7 @@ async def post(self, request: web.Request, uuid: str) -> web.Response:
"""Handle new discovery requests."""
# Fetch discovery data and prevent injections
try:
data = await self._supervisor_client.discovery.get(uuid)
data = await self._supervisor_client.discovery.get(UUID(uuid))
except SupervisorError as err:
_LOGGER.error("Can't read discovery data: %s", err)
raise HTTPServiceUnavailable from None
Expand All @@ -104,7 +105,7 @@ async def delete(self, request: web.Request, uuid: str) -> web.Response:
async def async_rediscover(self, uuid: str) -> None:
"""Rediscover add-on when config entry is removed."""
try:
data = await self._supervisor_client.discovery.get(uuid)
data = await self._supervisor_client.discovery.get(UUID(uuid))
except SupervisorError as err:
_LOGGER.debug("Can't read discovery data: %s", err)
else:
Expand Down Expand Up @@ -146,7 +147,7 @@ async def async_process_del(self, data: dict[str, Any]) -> None:

# Check if really deletet / prevent injections
try:
data = await self._supervisor_client.discovery.get(uuid)
await self._supervisor_client.discovery.get(UUID(uuid))
except SupervisorError:
pass
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/hassio/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def get_supervisor_client(hass: HomeAssistant) -> SupervisorClient:
"""Return supervisor client."""
hassio: HassIO = hass.data[DOMAIN]
return SupervisorClient(
hassio.base_url,
str(hassio.base_url),
os.environ.get("SUPERVISOR_TOKEN", ""),
session=hassio.websession,
)
2 changes: 1 addition & 1 deletion homeassistant/components/hassio/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/hassio",
"iot_class": "local_polling",
"quality_scale": "internal",
"requirements": ["aiohasupervisor==0.2.0"],
"requirements": ["aiohasupervisor==0.2.1"],
"single_config_entry": true
}
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
aiodhcpwatcher==1.0.2
aiodiscover==2.1.0
aiodns==3.2.0
aiohasupervisor==0.2.0
aiohasupervisor==0.2.1
aiohttp-fast-zlib==0.1.1
aiohttp==3.10.10
aiohttp_cors==0.7.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = [
# Integrations may depend on hassio integration without listing it to
# change behavior based on presence of supervisor. Deprecated with #127228
# Lib can be removed with 2025.11
"aiohasupervisor==0.2.0",
"aiohasupervisor==0.2.1",
"aiohttp==3.10.10",
"aiohttp_cors==0.7.0",
"aiohttp-fast-zlib==0.1.1",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Home Assistant Core
aiodns==3.2.0
aiohasupervisor==0.2.0
aiohasupervisor==0.2.1
aiohttp==3.10.10
aiohttp_cors==0.7.0
aiohttp-fast-zlib==0.1.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ aioguardian==2022.07.0
aioharmony==0.2.10

# homeassistant.components.hassio
aiohasupervisor==0.2.0
aiohasupervisor==0.2.1

# homeassistant.components.homekit_controller
aiohomekit==3.2.5
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ aioguardian==2022.07.0
aioharmony==0.2.10

# homeassistant.components.hassio
aiohasupervisor==0.2.0
aiohasupervisor==0.2.1

# homeassistant.components.homekit_controller
aiohomekit==3.2.5
Expand Down
13 changes: 8 additions & 5 deletions tests/components/hassio/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ async def test_hassio_discovery_webhook(
addon_installed.return_value.name = "Mosquitto Test"

resp = await hassio_client.post(
"/api/hassio_push/discovery/testuuid",
json={"addon": "mosquitto", "service": "mqtt", "uuid": "testuuid"},
f"/api/hassio_push/discovery/{uuid!s}",
json={"addon": "mosquitto", "service": "mqtt", "uuid": str(uuid)},
)
await hass.async_block_till_done()
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
Expand All @@ -208,6 +208,9 @@ async def test_hassio_discovery_webhook(
)


TEST_UUID = str(uuid4())


@pytest.mark.parametrize(
(
"entry_domain",
Expand All @@ -217,13 +220,13 @@ async def test_hassio_discovery_webhook(
# Matching discovery key
(
"mock-domain",
{"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),)},
{"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),)},
),
# Matching discovery key
(
"mock-domain",
{
"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),),
"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),),
"other": (DiscoveryKey(domain="other", key="blah", version=1),),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if key is an UUID, should we make sure this is also an UUID here?

},
),
Expand All @@ -232,7 +235,7 @@ async def test_hassio_discovery_webhook(
# entry. Such a check can be added if needed.
(
"comp",
{"hassio": (DiscoveryKey(domain="hassio", key="test", version=1),)},
{"hassio": (DiscoveryKey(domain="hassio", key=TEST_UUID, version=1),)},
),
],
)
Expand Down