Skip to content

Commit 38f9067

Browse files
erwindounaedenhaus
authored andcommitted
Portainer fix CONF_VERIFY_SSL (home-assistant#153269)
Co-authored-by: Robert Resch <[email protected]>
1 parent 53a8a25 commit 38f9067

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

homeassistant/components/portainer/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ async def async_migrate_entry(hass: HomeAssistant, entry: PortainerConfigEntry)
5757
data[CONF_API_TOKEN] = data.pop(CONF_API_KEY)
5858
hass.config_entries.async_update_entry(entry=entry, data=data, version=2)
5959

60+
if entry.version < 3:
61+
data = dict(entry.data)
62+
data[CONF_VERIFY_SSL] = True
63+
hass.config_entries.async_update_entry(entry=entry, data=data, version=3)
64+
6065
return True

tests/components/portainer/test_init.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212
from homeassistant.components.portainer.const import DOMAIN
1313
from homeassistant.config_entries import ConfigEntryState
14-
from homeassistant.const import CONF_API_KEY, CONF_API_TOKEN, CONF_HOST, CONF_URL
14+
from homeassistant.const import (
15+
CONF_API_KEY,
16+
CONF_API_TOKEN,
17+
CONF_HOST,
18+
CONF_URL,
19+
CONF_VERIFY_SSL,
20+
)
1521
from homeassistant.core import HomeAssistant
1622

1723
from . import setup_integration
@@ -40,8 +46,8 @@ async def test_setup_exceptions(
4046
assert mock_config_entry.state == expected_state
4147

4248

43-
async def test_v1_migration(hass: HomeAssistant) -> None:
44-
"""Test migration from v1 to v2 config entry."""
49+
async def test_migrations(hass: HomeAssistant) -> None:
50+
"""Test migration from v1 config entry."""
4551
entry = MockConfigEntry(
4652
domain=DOMAIN,
4753
data={
@@ -52,11 +58,14 @@ async def test_v1_migration(hass: HomeAssistant) -> None:
5258
version=1,
5359
)
5460
entry.add_to_hass(hass)
61+
assert entry.version == 1
62+
assert CONF_VERIFY_SSL not in entry.data
5563
await hass.config_entries.async_setup(entry.entry_id)
5664
await hass.async_block_till_done()
5765

58-
assert entry.version == 2
66+
assert entry.version == 3
5967
assert CONF_HOST not in entry.data
6068
assert CONF_API_KEY not in entry.data
6169
assert entry.data[CONF_URL] == "http://test_host"
6270
assert entry.data[CONF_API_TOKEN] == "test_key"
71+
assert entry.data[CONF_VERIFY_SSL] is True

0 commit comments

Comments
 (0)