mirror of https://github.com/Aidaho12/haproxy-wi
parent
b304130eeb
commit
4e55accb2d
10
app/funct.py
10
app/funct.py
|
@ -1068,6 +1068,7 @@ def check_new_version(**kwargs):
|
||||||
import sql
|
import sql
|
||||||
current_ver = check_ver()
|
current_ver = check_ver()
|
||||||
proxy = sql.get_setting('proxy')
|
proxy = sql.get_setting('proxy')
|
||||||
|
res = ''
|
||||||
|
|
||||||
if kwargs.get('service'):
|
if kwargs.get('service'):
|
||||||
last_ver = '_'+kwargs.get('service')
|
last_ver = '_'+kwargs.get('service')
|
||||||
|
@ -1076,17 +1077,16 @@ def check_new_version(**kwargs):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if proxy is not None and proxy != '' and proxy != 'None':
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
proxyDict = {"https": proxy, "http": proxy}
|
proxy_dict = {"https": proxy, "http": proxy}
|
||||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver'+last_ver+'=1', timeout=1, proxies=proxyDict)
|
response = requests.get('https://haproxy-wi.org/update.py?last_ver'+last_ver+'=1', timeout=1, proxies=proxy_dict)
|
||||||
requests.get('https://haproxy-wi.org/update.py?ver_send='+current_ver, timeout=1, proxies=proxyDict)
|
requests.get('https://haproxy-wi.org/update.py?ver_send='+current_ver, timeout=1, proxies=proxy_dict)
|
||||||
else:
|
else:
|
||||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver'+last_ver+'=1', timeout=1)
|
response = requests.get('https://haproxy-wi.org/update.py?last_ver'+last_ver+'=1', timeout=1)
|
||||||
requests.get('https://haproxy-wi.org/update.py?ver_send='+current_ver, timeout=1)
|
requests.get('https://haproxy-wi.org/update.py?ver_send='+current_ver, timeout=1)
|
||||||
|
|
||||||
res = response.content.decode(encoding='UTF-8')
|
res = response.content.decode(encoding='UTF-8')
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
e = str(e)
|
logging('localhost', ' '+str(e), haproxywi=1)
|
||||||
logging('localhost', ' '+e, haproxywi=1)
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ funct.check_login()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user, user_id, role, token, servers = funct.get_users_params()
|
user, user_id, role, token, servers = funct.get_users_params()
|
||||||
cmd = "rpm --query haproxy-wi-metrics-* |awk -F\"metrics_haproxy\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
|
cmd = "rpm --query haproxy-wi-metrics-* |awk -F\"metrics\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
|
||||||
service_ver, stderr = funct.subprocess_execute(cmd)
|
service_ver, stderr = funct.subprocess_execute(cmd)
|
||||||
|
|
||||||
if service_ver[0] == '* is not installed':
|
if service_ver == '* is not installed':
|
||||||
servers = ''
|
servers = ''
|
||||||
else:
|
else:
|
||||||
servers = sql.select_servers_metrics(user_id.value)
|
servers = sql.select_servers_metrics(user_id.value)
|
||||||
|
|
Loading…
Reference in New Issue