Skip to content
Snippets Groups Projects
Commit 69ace900 authored by Martin Bergemann's avatar Martin Bergemann :speech_balloon:
Browse files

Enable auto save

parent 357c22cf
No related branches found
No related tags found
1 merge request!17Update playbooks
Pipeline #18599 passed
......@@ -562,6 +562,8 @@ class RunForm(npyscreen.FormMultiPageAction):
def on_ok(self) -> None:
"""Define what happens once the `ok` for applying the deployment is hit."""
self.parentApp.thread_stop.set()
if not self.project_name.value:
npyscreen.notify_confirm("You have to set a project name", title="ERROR")
return
......@@ -580,10 +582,10 @@ class RunForm(npyscreen.FormMultiPageAction):
cert_file: str = self.cert_file.value or ""
if cert_file:
if not Path(cert_file).exists() or not Path(cert_file).is_file():
msg = f"Public certificate file `{cert_file}` must exist or empty."
is_file = Path(cert_file).exists()
msg = f"Public certificate file `{cert_file}` {is_file} must exist or empty."
npyscreen.notify_confirm(msg, title="ERROR")
return
self.parentApp.thread_stop.set()
save_file = self.parentApp.save_config_to_file(write_toml_file=True)
self.parentApp.setup = {
"project_name": self.project_name.value,
......
......@@ -36,9 +36,13 @@ class MainApp(npyscreen.NPSAppManaged):
for step in self._steps_lookup.keys():
self.config.setdefault(step, {"hosts": "", "config": {}})
self._add_froms()
self.start_auto_save()
def start_auto_save(self) -> None:
"""(Re)-Start the auto save thread."""
self.thread_stop = threading.Event()
self._save_thread = threading.Thread(target=self._auto_save)
# self._save_thread.start()
self._save_thread.start()
def _add_froms(self) -> None:
"""Add forms to edit the deploy steps to the main window."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment