From fd05839898ae1977b52ac9570daae030a4ef2f3b Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Wed, 4 Dec 2024 12:32:42 +0100 Subject: [PATCH] fix(ns-api): fix ns.ovpnrw list-users Return an empty list if the ovpn instance exists but has not been configured. Before this change list-users threw an exception in this scenario --- packages/ns-api/files/ns.ovpnrw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/ns-api/files/ns.ovpnrw b/packages/ns-api/files/ns.ovpnrw index 02678bae..32ec2e46 100755 --- a/packages/ns-api/files/ns.ovpnrw +++ b/packages/ns-api/files/ns.ovpnrw @@ -540,6 +540,8 @@ def list_users(ovpninstance): connected = ovpn.list_connected_clients(ovpninstance) expirations = list_user_expirations(ovpninstance) db = u.get("openvpn", ovpninstance, "ns_user_db", default=None) + if not db: + return {"users": []} db_users = users.list_users(u, db) try: tags = u.get_all("openvpn", ovpninstance, "ns_tag")