mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Do not raise repair issue about missing integration in safe mode (#123066)
This commit is contained in:
parent
3de8828358
commit
d2dd5ba0e6
@ -281,19 +281,20 @@ async def _async_setup_component(
|
|||||||
integration = await loader.async_get_integration(hass, domain)
|
integration = await loader.async_get_integration(hass, domain)
|
||||||
except loader.IntegrationNotFound:
|
except loader.IntegrationNotFound:
|
||||||
_log_error_setup_error(hass, domain, None, "Integration not found.")
|
_log_error_setup_error(hass, domain, None, "Integration not found.")
|
||||||
ir.async_create_issue(
|
if not hass.config.safe_mode:
|
||||||
hass,
|
ir.async_create_issue(
|
||||||
HOMEASSISTANT_DOMAIN,
|
hass,
|
||||||
f"integration_not_found.{domain}",
|
HOMEASSISTANT_DOMAIN,
|
||||||
is_fixable=True,
|
f"integration_not_found.{domain}",
|
||||||
issue_domain=HOMEASSISTANT_DOMAIN,
|
is_fixable=True,
|
||||||
severity=IssueSeverity.ERROR,
|
issue_domain=HOMEASSISTANT_DOMAIN,
|
||||||
translation_key="integration_not_found",
|
severity=IssueSeverity.ERROR,
|
||||||
translation_placeholders={
|
translation_key="integration_not_found",
|
||||||
"domain": domain,
|
translation_placeholders={
|
||||||
},
|
"domain": domain,
|
||||||
data={"domain": domain},
|
},
|
||||||
)
|
data={"domain": domain},
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
log_error = partial(_log_error_setup_error, hass, domain, integration)
|
log_error = partial(_log_error_setup_error, hass, domain, integration)
|
||||||
|
@ -245,7 +245,7 @@ async def test_validate_platform_config_4(hass: HomeAssistant) -> None:
|
|||||||
async def test_component_not_found(
|
async def test_component_not_found(
|
||||||
hass: HomeAssistant, issue_registry: IssueRegistry
|
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""setup_component should not crash if component doesn't exist."""
|
"""setup_component should raise a repair issue if component doesn't exist."""
|
||||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||||
assert len(issue_registry.issues) == 1
|
assert len(issue_registry.issues) == 1
|
||||||
issue = issue_registry.async_get_issue(
|
issue = issue_registry.async_get_issue(
|
||||||
@ -255,6 +255,15 @@ async def test_component_not_found(
|
|||||||
assert issue.translation_key == "integration_not_found"
|
assert issue.translation_key == "integration_not_found"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_component_missing_not_raising_in_safe_mode(
|
||||||
|
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||||
|
) -> None:
|
||||||
|
"""setup_component should not raise an issue if component doesn't exist in safe."""
|
||||||
|
hass.config.safe_mode = True
|
||||||
|
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||||
|
assert len(issue_registry.issues) == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_component_not_double_initialized(hass: HomeAssistant) -> None:
|
async def test_component_not_double_initialized(hass: HomeAssistant) -> None:
|
||||||
"""Test we do not set up a component twice."""
|
"""Test we do not set up a component twice."""
|
||||||
mock_setup = Mock(return_value=True)
|
mock_setup = Mock(return_value=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user