This commit is contained in:
Chi Song 2020-11-24 13:10:31 +08:00
Родитель 69bb9fc6aa
Коммит 9ca96a03bf
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -446,7 +446,7 @@ class Tools:
if tool is None:
# the Tool is not installed on current node, try to install it.
tool_log = get_logger("tool", tool_key, self._node.log)
tool_log.debug(f"initializing {tool_key}")
tool_log.debug(f"initializing tool [{tool_key}]")
if isinstance(tool_type, CustomScriptBuilder):
tool = tool_type.build(self._node)

Просмотреть файл

@ -27,13 +27,14 @@ class Reboot(Tool):
timer = create_timer()
last_boot_time = who.last_boot()
current_boot_time = last_boot_time
date = self.node.tools[Date]
# who -b returns time without seconds.
# so if the node rebooted in one minute, the who -b is not changed.
# The reboot will wait forever.
# in this case, verify the time is wait enough to prevent this problem.
date = self.node.tools[Date]
current_delta = date.current() - current_boot_time
self._log.debug(f"delta time since last boot: {current_delta}")
while current_delta < timedelta(minutes=1):
# wait until one minute
wait_seconds = 60 - current_delta.seconds + 1