mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 05:06:30 +00:00
Make a copy of the logfile before rollback (#1867)
* Make a copy of the logfile before rollback * Review changes and add log about the log file
This commit is contained in:
parent
e1ce19547e
commit
4ffaee6013
@ -359,6 +359,17 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
# Update going wrong, revert it
|
# Update going wrong, revert it
|
||||||
if self.error_state and rollback:
|
if self.error_state and rollback:
|
||||||
_LOGGER.critical("HomeAssistant update fails -> rollback!")
|
_LOGGER.critical("HomeAssistant update fails -> rollback!")
|
||||||
|
# Make a copy of the current log file if it exsist
|
||||||
|
logfile = self.sys_config.path_homeassistant / "home-assistant.log"
|
||||||
|
if logfile.exists():
|
||||||
|
backup = (
|
||||||
|
self.sys_config.path_homeassistant / "home-assistant-rollback.log"
|
||||||
|
)
|
||||||
|
|
||||||
|
shutil.copy(logfile, backup)
|
||||||
|
_LOGGER.info(
|
||||||
|
"A backup of the logfile is stored in /config/home-assistant-rollback.log"
|
||||||
|
)
|
||||||
await _update(rollback)
|
await _update(rollback)
|
||||||
else:
|
else:
|
||||||
raise HomeAssistantUpdateError()
|
raise HomeAssistantUpdateError()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user