Skip to content

Commit

Permalink
fix(ns-api): fix ns.ovpnrw list-users (#950)
Browse files Browse the repository at this point in the history
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

#943
  • Loading branch information
andre8244 authored Dec 4, 2024
1 parent 623e529 commit 9d3d217
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ns-api/files/ns.ovpnrw
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 9d3d217

Please sign in to comment.