mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 13:16:29 +00:00
Improve fixups with Job condition checks (#2451)
This commit is contained in:
parent
1a978f4762
commit
dccfffd979
@ -3,6 +3,8 @@ import logging
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from ..coresys import CoreSys, CoreSysAttributes
|
from ..coresys import CoreSys, CoreSysAttributes
|
||||||
|
from ..jobs.const import JobCondition
|
||||||
|
from ..jobs.decorator import Job
|
||||||
from .data import Suggestion
|
from .data import Suggestion
|
||||||
from .fixups.base import FixupBase
|
from .fixups.base import FixupBase
|
||||||
from .fixups.clear_full_snapshot import FixupClearFullSnapshot
|
from .fixups.clear_full_snapshot import FixupClearFullSnapshot
|
||||||
@ -41,6 +43,7 @@ class ResolutionFixup(CoreSysAttributes):
|
|||||||
self._store_execute_remove,
|
self._store_execute_remove,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@Job(conditions=[JobCondition.HEALTHY])
|
||||||
async def run_autofix(self) -> None:
|
async def run_autofix(self) -> None:
|
||||||
"""Run all startup fixes."""
|
"""Run all startup fixes."""
|
||||||
_LOGGER.info("Starting system autofix at state %s", self.sys_core.state)
|
_LOGGER.info("Starting system autofix at state %s", self.sys_core.state)
|
||||||
|
@ -2,8 +2,14 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from supervisor.exceptions import ResolutionFixupError, StoreError, StoreNotFound
|
from ...exceptions import (
|
||||||
|
ResolutionFixupError,
|
||||||
|
ResolutionFixupJobError,
|
||||||
|
StoreError,
|
||||||
|
StoreNotFound,
|
||||||
|
)
|
||||||
|
from ...jobs.const import JobCondition
|
||||||
|
from ...jobs.decorator import Job
|
||||||
from ..const import ContextType, IssueType, SuggestionType
|
from ..const import ContextType, IssueType, SuggestionType
|
||||||
from .base import FixupBase
|
from .base import FixupBase
|
||||||
|
|
||||||
@ -13,6 +19,10 @@ _LOGGER: logging.Logger = logging.getLogger(__name__)
|
|||||||
class FixupStoreExecuteReload(FixupBase):
|
class FixupStoreExecuteReload(FixupBase):
|
||||||
"""Storage class for fixup."""
|
"""Storage class for fixup."""
|
||||||
|
|
||||||
|
@Job(
|
||||||
|
conditions=[JobCondition.INTERNET_SYSTEM, JobCondition.FREE_SPACE],
|
||||||
|
on_condition=ResolutionFixupJobError,
|
||||||
|
)
|
||||||
async def process_fixup(self, reference: Optional[str] = None) -> None:
|
async def process_fixup(self, reference: Optional[str] = None) -> None:
|
||||||
"""Initialize the fixup class."""
|
"""Initialize the fixup class."""
|
||||||
_LOGGER.info("Reload Store: %s", reference)
|
_LOGGER.info("Reload Store: %s", reference)
|
||||||
|
@ -21,7 +21,8 @@ class FixupStoreExecuteReset(FixupBase):
|
|||||||
"""Storage class for fixup."""
|
"""Storage class for fixup."""
|
||||||
|
|
||||||
@Job(
|
@Job(
|
||||||
conditions=[JobCondition.INTERNET_SYSTEM], on_condition=ResolutionFixupJobError
|
conditions=[JobCondition.INTERNET_SYSTEM, JobCondition.FREE_SPACE],
|
||||||
|
on_condition=ResolutionFixupJobError,
|
||||||
)
|
)
|
||||||
async def process_fixup(self, reference: Optional[str] = None) -> None:
|
async def process_fixup(self, reference: Optional[str] = None) -> None:
|
||||||
"""Initialize the fixup class."""
|
"""Initialize the fixup class."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user