From eacf5f6f8cfa3c8ed7561cce6d8d2bd89a3c9946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksa=20Siri=C5=A1ki?= <31509435+aleksasiriski@users.noreply.github.com> Date: Tue, 15 Nov 2022 01:04:38 +0100 Subject: [PATCH] Add server_name field It doesn't do any harm and makes my [script](https://github.com/aleksasiriski/hcloud-rffmpeg) possible to work. I've set so that `rffmpeg add` always uses "manual" as the name but that could also be an option just like weight. --- rffmpeg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rffmpeg b/rffmpeg index 1a42450..9fa6c1a 100755 --- a/rffmpeg +++ b/rffmpeg @@ -240,7 +240,7 @@ def get_target_host(config): # Generate a mapping dictionary of hosts and processes host_mappings = dict() for host in hosts: - hid, hostname, weight = host + hid, hostname, weight, server_name = host # Get the latest state with dbconn(config) as cur: @@ -536,7 +536,7 @@ def run_control(config): try: with dbconn(config) as cur: cur.execute( - """CREATE TABLE hosts (id INTEGER PRIMARY KEY, hostname TEXT NOT NULL, weight INTEGER DEFAULT 1)""" + """CREATE TABLE hosts (id INTEGER PRIMARY KEY, hostname TEXT NOT NULL, weight INTEGER DEFAULT 1, server_name TEXT NOT NULL)""" ) cur.execute( """CREATE TABLE processes (id INTEGER PRIMARY KEY, host_id INTEGER, process_id INTEGER, cmd TEXT)""" @@ -590,7 +590,7 @@ def run_control(config): } for host in hosts: - hid, hostname, weight = host + hid, hostname, weight, server_name = host # Get the latest state with dbconn(config) as cur: @@ -705,7 +705,8 @@ def run_control(config): click.echo("Adding new host '{}'".format(host)) with dbconn(config) as cur: cur.execute( - """INSERT INTO hosts (hostname, weight) VALUES (?, ?)""", (host, weight) + "INSERT INTO hosts (hostname, weight, server_name) VALUES (?, ?, ?)", + (host, weight, "manual"), ) rffmpeg_click.add_command(rffmpeg_click_add)