mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 13:16:29 +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
|
||||
if self.error_state and 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)
|
||||
else:
|
||||
raise HomeAssistantUpdateError()
|
||||
|
Loading…
x
Reference in New Issue
Block a user