diff --git a/app/funct.py b/app/funct.py index 703713b..83cccbe 100644 --- a/app/funct.py +++ b/app/funct.py @@ -1068,7 +1068,8 @@ def check_new_version(**kwargs): import sql current_ver = check_ver() proxy = sql.get_setting('proxy') - + res = '' + if kwargs.get('service'): last_ver = '_'+kwargs.get('service') else: @@ -1076,17 +1077,16 @@ def check_new_version(**kwargs): try: if proxy is not None and proxy != '' and proxy != 'None': - proxyDict = {"https": proxy, "http": proxy} - response = requests.get('https://haproxy-wi.org/update.py?last_ver'+last_ver+'=1', timeout=1, proxies=proxyDict) - requests.get('https://haproxy-wi.org/update.py?ver_send='+current_ver, timeout=1, proxies=proxyDict) + proxy_dict = {"https": proxy, "http": proxy} + 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=proxy_dict) else: 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) res = response.content.decode(encoding='UTF-8') except requests.exceptions.RequestException as e: - e = str(e) - logging('localhost', ' '+e, haproxywi=1) + logging('localhost', ' '+str(e), haproxywi=1) return res diff --git a/app/metrics.py b/app/metrics.py index 81d74ec..78770fd 100644 --- a/app/metrics.py +++ b/app/metrics.py @@ -11,10 +11,10 @@ funct.check_login() try: 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) - if service_ver[0] == '* is not installed': + if service_ver == '* is not installed': servers = '' else: servers = sql.select_servers_metrics(user_id.value)