Skip to content

Commit 50bdee8

Browse files
committed
Allow specification of aggregator secret.
1 parent added1e commit 50bdee8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

openpectus_engine_manager_gui/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class PersistentData(JsonData):
110110
"aggregator_hostname": "openpectus.com",
111111
"aggregator_port": 443,
112112
"aggregator_secure": True,
113+
"aggregator_secret": "",
113114
"uods": []
114115
}
115116

@@ -227,7 +228,7 @@ async def run_engine(loop: asyncio.EventLoop):
227228
log.error(f"Failed to create uod: {ex}")
228229
return
229230
engine = Engine(uod, enable_archiver=True)
230-
dispatcher = EngineDispatcher(f"{self.persistent_data['aggregator_hostname']}:{self.persistent_data['aggregator_port']}", self.persistent_data['aggregator_secure'], uod.options)
231+
dispatcher = EngineDispatcher(f"{self.persistent_data['aggregator_hostname']}:{self.persistent_data['aggregator_port']}", self.persistent_data['aggregator_secure'], uod.options, self.persistent_data["aggregator_secret"])
231232
if len(uod.required_roles) > 0 and not dispatcher.is_aggregator_authentication_enabled():
232233
log.warning('"with_required_roles" specified in ' +
233234
f'"{uod_filename}" but aggregator does ' +
@@ -497,6 +498,7 @@ def start(self):
497498
label_ag_hostname = tk.Label(window, text="Aggregator Hostname")
498499
label_ag_port = tk.Label(window, text="Aggregator Port")
499500
label_ag_ssl = tk.Label(window, text="Aggregator SSL")
501+
label_ag_secret = tk.Label(window, text="Aggregator Secret")
500502
entry_ag_hostname = tk.Entry(window)
501503
entry_ag_port = tk.Entry(window)
502504
checkbox_ag_ssl = tk.Checkbutton(
@@ -506,6 +508,7 @@ def start(self):
506508
onvalue=1,
507509
offvalue=0
508510
)
511+
entry_ag_secret = tk.Entry(window)
509512
verify_and_save_button = tk.Button(
510513
window,
511514
text="Verify and Save"
@@ -516,6 +519,7 @@ def start(self):
516519
checkbox_ag_ssl.select()
517520
entry_ag_hostname.insert(0, self.persistent_data["aggregator_hostname"])
518521
entry_ag_port.insert(0, self.persistent_data["aggregator_port"])
522+
entry_ag_secret.insert(0, self.persistent_data["aggregator_secret"])
519523

520524
# Configure layout
521525
label_ag_hostname.grid(row=0, column=0, sticky=tk.W)
@@ -524,7 +528,9 @@ def start(self):
524528
entry_ag_port.grid(row=1, column=1)
525529
label_ag_ssl.grid(row=2, column=0, sticky=tk.W)
526530
checkbox_ag_ssl.grid(row=2, column=1)
527-
verify_and_save_button.grid(row=3, column=0, columnspan=2)
531+
label_ag_secret.grid(row=3, column=0, sticky=tk.W)
532+
entry_ag_secret.grid(row=3, column=1)
533+
verify_and_save_button.grid(row=4, column=0, columnspan=2)
528534

529535
def reset_button():
530536
verify_and_save_button["bg"] = "SystemButtonFace"
@@ -552,6 +558,7 @@ def verify_connection_and_save():
552558
aggregator_hostname=entry_ag_hostname.get(),
553559
aggregator_port=entry_ag_port.get(),
554560
aggregator_secure=ag_ssl_value.get() == 1,
561+
aggregator_secret=entry_ag_secret.get(),
555562
))
556563
except httpx.HTTPError:
557564
# Blink button red

openpectus_engine_manager_gui/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_read_write_persistent_data(self):
2121
"aggregator_hostname",
2222
"aggregator_port",
2323
"aggregator_secure",
24+
"aggregator_secret",
2425
"uods",
2526
]
2627
for key in keys:
@@ -37,6 +38,7 @@ def engine_manager_factory(uods: List[str]) -> openpectus_engine_manager_gui.Eng
3738
aggregator_hostname="github.openpectus.org",
3839
aggregator_port=443,
3940
aggregator_secure=True,
41+
aggregator_secret="",
4042
uods=[demo_uod.__file__],
4143
),
4244
)

0 commit comments

Comments
 (0)