added files to config services, added default logic for creating files from templates, added new method to provide extra data to templates, updated gui to display templates raw
This commit is contained in:
parent
9447ddb94f
commit
7b5df11dc7
11 changed files with 120 additions and 52 deletions
|
@ -63,6 +63,7 @@ class CoreClient:
|
|||
self.app = app
|
||||
self.master = app.master
|
||||
self.services = {}
|
||||
self.config_services_groups = {}
|
||||
self.config_services = {}
|
||||
self.default_services = {}
|
||||
self.emane_models = []
|
||||
|
@ -417,7 +418,10 @@ class CoreClient:
|
|||
# get config service informations
|
||||
response = self.client.get_config_services()
|
||||
for service in response.services:
|
||||
group_services = self.config_services.setdefault(service.group, set())
|
||||
self.config_services[service.name] = service
|
||||
group_services = self.config_services_groups.setdefault(
|
||||
service.group, set()
|
||||
)
|
||||
group_services.add(service.name)
|
||||
|
||||
# if there are no sessions, create a new session, else join a session
|
||||
|
|
|
@ -46,7 +46,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
self.default_shutdown = []
|
||||
self.validation_mode = None
|
||||
self.validation_time = None
|
||||
self.validation_period = None
|
||||
self.validation_period = tk.StringVar()
|
||||
self.documentnew_img = Images.get(ImageEnum.DOCUMENTNEW, 16)
|
||||
self.editdelete_img = Images.get(ImageEnum.EDITDELETE, 16)
|
||||
|
||||
|
@ -68,35 +68,33 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
def load(self):
|
||||
try:
|
||||
self.app.core.create_nodes_and_links()
|
||||
default_config = self.app.core.get_node_service(
|
||||
self.node_id, self.service_name
|
||||
)
|
||||
self.default_startup = default_config.startup[:]
|
||||
self.default_validate = default_config.validate[:]
|
||||
self.default_shutdown = default_config.shutdown[:]
|
||||
custom_configs = self.service_configs
|
||||
if (
|
||||
self.node_id in custom_configs
|
||||
and self.service_name in custom_configs[self.node_id]
|
||||
):
|
||||
service_config = custom_configs[self.node_id][self.service_name]
|
||||
else:
|
||||
service_config = default_config
|
||||
# default_config = self.app.core.get_node_service(
|
||||
# self.node_id, self.service_name
|
||||
# )
|
||||
# self.default_startup = default_config.startup[:]
|
||||
# self.default_validate = default_config.validate[:]
|
||||
# self.default_shutdown = default_config.shutdown[:]
|
||||
# custom_configs = self.service_configs
|
||||
# if (
|
||||
# self.node_id in custom_configs
|
||||
# and self.service_name in custom_configs[self.node_id]
|
||||
# ):
|
||||
# service_config = custom_configs[self.node_id][self.service_name]
|
||||
# else:
|
||||
# service_config = default_config
|
||||
|
||||
service_config = self.core.config_services[self.service_name]
|
||||
self.dependencies = service_config.dependencies[:]
|
||||
self.executables = service_config.executables[:]
|
||||
self.filenames = service_config.configs[:]
|
||||
self.filenames = service_config.files[:]
|
||||
self.startup_commands = service_config.startup[:]
|
||||
self.validation_commands = service_config.validate[:]
|
||||
self.shutdown_commands = service_config.shutdown[:]
|
||||
self.validation_mode = service_config.validation_mode
|
||||
self.validation_time = service_config.validation_timer
|
||||
self.original_service_files = {
|
||||
x: self.app.core.get_node_service_file(
|
||||
self.node_id, self.service_name, x
|
||||
)
|
||||
for x in self.filenames
|
||||
}
|
||||
self.validation_period.set(service_config.validation_period)
|
||||
response = self.core.client.get_config_service_templates(self.service_name)
|
||||
self.original_service_files = response.templates
|
||||
self.temp_service_files = dict(self.original_service_files)
|
||||
file_configs = self.file_configs
|
||||
if (
|
||||
|
@ -303,7 +301,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
label = ttk.Label(frame, text="Validation Period")
|
||||
label.grid(row=2, column=0, sticky="w", padx=PADX)
|
||||
self.validation_period_entry = ttk.Entry(
|
||||
frame, state=tk.DISABLED, textvariable=tk.StringVar()
|
||||
frame, state=tk.DISABLED, textvariable=self.validation_period
|
||||
)
|
||||
self.validation_period_entry.grid(row=2, column=1, sticky="ew", pady=PADY)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class NodeConfigServiceDialog(Dialog):
|
|||
label_frame.columnconfigure(0, weight=1)
|
||||
self.groups = ListboxScroll(label_frame)
|
||||
self.groups.grid(sticky="nsew")
|
||||
for group in sorted(self.app.core.config_services):
|
||||
for group in sorted(self.app.core.config_services_groups):
|
||||
self.groups.listbox.insert(tk.END, group)
|
||||
self.groups.listbox.bind("<<ListboxSelect>>", self.handle_group_change)
|
||||
self.groups.listbox.selection_set(0)
|
||||
|
@ -98,7 +98,7 @@ class NodeConfigServiceDialog(Dialog):
|
|||
index = selection[0]
|
||||
group = self.groups.listbox.get(index)
|
||||
self.services.clear()
|
||||
for name in sorted(self.app.core.config_services[group]):
|
||||
for name in sorted(self.app.core.config_services_groups[group]):
|
||||
checked = name in self.current_services
|
||||
self.services.add(name, checked)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue