Pavel Loginov 2020-11-26 10:18:51 +06:00
parent a7e40b1dad
commit c880393c43
2 changed files with 2 additions and 4 deletions

View File

@ -85,7 +85,7 @@
</div>
<div id="openvpn">
{% if openvpn != 'package openvpn3-client is not installed' %}
{% if openvpn != '' %}
<table id="openvpn_table" class="overview">
<caption><h3>OpenVPN profiles</h3></caption>
<tr class="overviewHead">

View File

@ -43,15 +43,13 @@ try:
openvpn = ''
stdout, stderr = funct.subprocess_execute("rpm --query openvpn3-client")
if stdout[0] != 'package openvpn3-client is not installed':
if stdout[0] != 'package openvpn3-client is not installed' and stderr != '/bin/sh: rpm: command not found':
cmd = "sudo openvpn3 configs-list |grep -E 'ovpn|(^|[^0-9])[0-9]{4}($|[^0-9])' |grep -v net|awk -F\" \" '{print $1}'|awk 'ORS=NR%2?\" \":\"\\n\"'"
openvpn_configs, stderr = funct.subprocess_execute(cmd)
cmd = "sudo openvpn3 sessions-list|grep -E 'Config|Status'|awk -F\":\" '{print $2}'|awk 'ORS=NR%2?\" \":\"\\n\"'| sed 's/^ //g'"
cmd = 'echo "client.ovpn Connection, Client connected"'
openvpn_sess, stderr = funct.subprocess_execute(cmd)
openvpn = stdout[0]
except Exception:
pass