From c30dc1bfba8cf03ab7d67a19ebc127c5f3a1f626 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Wed, 19 Jan 2022 17:17:31 +0300 Subject: [PATCH] v5.4.0.0 Changelog: https://haproxy-wi.org/changelog.py#5_4_0 --- app/funct.py | 2 +- app/scripts/ansible/roles/grafana.yml | 10 +++++----- app/versions.py | 9 ++++++--- inc/configshow.js | 7 +++++++ inc/users.js | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/funct.py b/app/funct.py index 73f2a581..101ac4e1 100644 --- a/app/funct.py +++ b/app/funct.py @@ -670,7 +670,7 @@ def show_installation_output(error, output, service): for l in output: if "UNREACHABLE" in l: print(l + '
') - if "Traceback" in l or "FAILED" in l or "error" in l: + if "Traceback" in l or "FAILED" in l or "error" in l or "ERROR" in l: try: print(l) break diff --git a/app/scripts/ansible/roles/grafana.yml b/app/scripts/ansible/roles/grafana.yml index 6159fb1d..a3eda312 100644 --- a/app/scripts/ansible/roles/grafana.yml +++ b/app/scripts/ansible/roles/grafana.yml @@ -66,11 +66,11 @@ state: present - name: Add the Grafana user - user: - name: grafana - shell: /sbin/nologin - groups: grafana - append: yes + user: + name: grafana + shell: /sbin/nologin + groups: grafana + append: yes - name: Create a directory if it does not exist file: diff --git a/app/versions.py b/app/versions.py index 623fc5de..f0606196 100644 --- a/app/versions.py +++ b/app/versions.py @@ -66,9 +66,12 @@ if serv is not None and form.getvalue('del') is not None: pass else: os.remove(os.path.join(configs_dir, form.getvalue(get))) - file.add(form.getvalue(get) + "
") - funct.logging(serv, "Version of config has been deleted: %s" % form.getvalue(get), login=1, - keep_history=1, service=service) + try: + file.add(form.getvalue(get) + "
") + funct.logging(serv, "Version of config has been deleted: %s" % form.getvalue(get), login=1, + keep_history=1, service=service) + except Exception: + pass except OSError as e: stderr = "Error: %s - %s." % (e.filename,e.strerror) diff --git a/inc/configshow.js b/inc/configshow.js index 4d4fb47d..bfe6dd83 100644 --- a/inc/configshow.js +++ b/inc/configshow.js @@ -64,6 +64,13 @@ $( function() { if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error') != '-1' || data.indexOf('failed ') != '-1' || data.indexOf('emerg] ') != '-1') { toastr.clear(); toastr.error(data); + } else if (data.indexOf('command not found') != '-1') { + try { + var service = findGetParameter('service'); + toastr.error('Cannot save config. There is no ' + service); + } catch (err) { + console.log(err); + } } else { toastr.clear(); toastr.success(data); diff --git a/inc/users.js b/inc/users.js index 1c6e7a49..d4029dff 100644 --- a/inc/users.js +++ b/inc/users.js @@ -146,7 +146,7 @@ $( function() { success: function( data ) { data = data.replace(/\s+/g,' '); $("#ajaxmon").html(''); - if (data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1') { + if (data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1' || data.indexOf('ERROR') != '-1') { toastr.clear(); toastr.error(data);; } else if (data.indexOf('success') != '-1' ){