From d26d949105aafe1f561a0c189d7a9864c34a68f6 Mon Sep 17 00:00:00 2001 From: Aidaho12 Date: Tue, 1 May 2018 15:00:30 +0600 Subject: [PATCH] v2.3.2 update script --- README.md | 9 +++++++++ app/sql.py | 7 +++++-- update.sh | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 update.sh diff --git a/README.md b/README.md index 6f1a3c3f..5caf3ceb 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,15 @@ For Runtime API enable state file on HAproxt servers and need install socat on a ``` ![alt text](image/haproxy-wi-logs.jpeg "View logs page") +# Update +``` +# cd /var/www/haproxy-wi +# chmod +x update.sh +# ./update.sh +``` + +After update old config saved at /tmp/ folder. Compare new and old config, if in new no changes overwrite the new configuration with the old one, or edit new with your ENV. + # Update DB ``` $ cd /var/www/haproxy-wi/app diff --git a/app/sql.py b/app/sql.py index 740a6adc..872680e3 100644 --- a/app/sql.py +++ b/app/sql.py @@ -539,6 +539,7 @@ if form.getvalue('updategroup') is not None: update_group(name, descript, id) if form.getvalue('updateserver') is not None: + import funct name = form.getvalue('updateserver') ip = form.getvalue('ip') group = form.getvalue('servergroup') @@ -551,5 +552,7 @@ if form.getvalue('updateserver') is not None: print(error_mess) else: print('Content-type: text/html\n') - update_server(name, ip, group, typeip, enable, master, id) - \ No newline at end of file + if funct.ssh_connect(ip, check=1): + update_server(name, ip, group, typeip, enable, master, id) + else: + print('X') \ No newline at end of file diff --git a/update.sh b/update.sh new file mode 100644 index 00000000..8d197830 --- /dev/null +++ b/update.sh @@ -0,0 +1,22 @@ +#!/bin/bash +cp app/haproxy-webintarface.config /tmp/ + +git reset --hard +git pull https://github.com/Aidaho12/haproxy-wi.git + +chmod +x app/*py +chown -R apache:apache * + +cd app/ +./update_db.py + +echo "" +echo "#################" +echo "Change in config:" +diff --expand-tabs -W 100 -y /tmp/haproxy-webintarface.config haproxy-webintarface.config |grep "|" +echo "" +echo "Please set your config" +echo "" +echo "################" +echo "Your config saved in /tmp/haproxy-webintarface.config. Please comare with new and set your env back" +echo "" \ No newline at end of file