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

Load run form setup from config file.

parent 382f48c2
No related branches found
No related tags found
1 merge request!32Load run form setup from config file.
Pipeline #20099 passed
......@@ -744,6 +744,7 @@ class RunForm(npyscreen.FormMultiPageAction):
def on_cancel(self) -> None:
"""Define what happens after the the cancel button is hit."""
name = self.parentApp.current_form.lower()
self.parentApp.setup = {}
for step, form_name in self.parentApp._steps_lookup.items():
if name.startswith(step):
# Tell the MyTestApp object to change forms.
......@@ -761,11 +762,14 @@ class RunForm(npyscreen.FormMultiPageAction):
def _add_widgets(self) -> None:
"""Add the widgets to the form."""
project_name = self.parentApp.config.get(
"project_name", self.parentApp._read_cache("project_name", "")
)
ssh_pw = self.parentApp._read_cache("ssh_pw", True)
self.project_name = self.add_widget_intelligent(
npyscreen.TitleText,
name=f"{self.num}Set the name of the project",
value=self.parentApp._read_cache("project_name", ""),
value=project_name,
)
self.inventory_file = self.add_widget_intelligent(
npyscreen.TitleFilename,
......
......@@ -228,6 +228,9 @@ class MainApp(npyscreen.NPSAppManaged):
def read_cert_file(self, key: str) -> str:
"""Read the certificate file from the cache."""
cert_file = cast(str, self.config.get("certificates", {}).get(key, ""))
if cert_file:
return cert_file
return cast(str, self._read_cache(key, ""))
@property
......
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