[!] Fix states

[!] Fix reboot
This commit is contained in:
2024-07-18 17:20:44 +03:00
parent b560ed0ae6
commit 20e34dd255

View File

@@ -282,7 +282,7 @@ class VMKer:
def _clone(self, new_name, destfolder, clone_spec):
logger.info(f"[{new_name}] Cloning from {self.template.name!r}")
task = self.template.Clone(name=new_name, folder=destfolder, spec=clone_spec)
while task.info.state == vim.TaskInfo.State.running:
while task.info.state in [vim.TaskInfo.State.running, vim.TaskInfo.State.queued]:
time.sleep(1)
if task.info.state != vim.TaskInfo.State.success:
logger.error(f"Error while cloning")
@@ -332,7 +332,7 @@ class VMKer:
logger.info(f"[{_name}] [YML] Executing %.yml")
logger.info(f"[{_name}] Rebooting")
ssh.send_command('reboot')
ssh.send_command_timing('reboot')
ssh.disconnect()
end_time = time.time() + timeout