From 88b572d27c8d58f32214df07ae4a0f7251946366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Wed, 22 Feb 2023 00:01:38 +0100 Subject: [PATCH] fixed fields --- rffmpeg | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rffmpeg b/rffmpeg index 0645f9b..43e9af5 100755 --- a/rffmpeg +++ b/rffmpeg @@ -329,8 +329,9 @@ def get_target_host(config): current_state = "idle" marking_pid = "N/A" else: - current_state = current_state["state"] - marking_pid = current_state["process_id"] + sid, host_id, process_id, state = current_state + current_state = state + marking_pid = process_id # Create the mappings entry host_mappings[hid] = { @@ -580,10 +581,11 @@ def run_control(config): with dbconn(config) as cur: cur.execute("SELECT * FROM hosts") for host in cur.fetchall(): - if host["servername"] == "invalid": + hid, servername, hostname, weight, created = host + if servername == "invalid": cur.execute( f"UPDATE hosts SET servername = {SQL_VAR_SIGN} WHERE hostname = {SQL_VAR_SIGN}", - (host["hostname"], host["hostname"]), + (hostname, hostname), ) @click.command(name="init", short_help="Initialize the system.") @@ -666,7 +668,8 @@ def run_control(config): # Determine if there are any fallback processes running fallback_processes = list() for process in processes: - if process["host_id"] == 0: + pid, host_id, process_id, cmd = process + if host_id == 0: fallback_processes.append(process) # Generate a mapping dictionary of hosts and processes @@ -695,7 +698,8 @@ def run_control(config): if not current_state: current_state = "idle" else: - current_state = current_state["state"] + sid, host_id, process_id, state = current_state + current_state = state # Create the mappings entry host_mappings[hid] = {