Changelog: https://haproxy-wi.org/changelog.py#5_3_1
pull/304/head v5.3.1.0
Pavel Loginov 2021-10-31 13:46:17 +06:00
parent 2b2218bdb1
commit ef91b0a831
5 changed files with 23 additions and 8 deletions

View File

@ -233,7 +233,7 @@ def telegram_send_mess(mess, **kwargs):
channel_name = telegram.chanel_name channel_name = telegram.chanel_name
if token_bot == '' or channel_name == '': if token_bot == '' or channel_name == '':
mess = " error: Can't send message. Add Telegram channel before use alerting at this servers group" mess = " Can't send message. Add Telegram channel before use alerting at this servers group"
print(mess) print(mess)
logging('localhost', mess, haproxywi=1) logging('localhost', mess, haproxywi=1)
sys.exit() sys.exit()

View File

@ -0,0 +1,7 @@
---
- name: Ensure docker users are added to the docker group.
user:
name: "{{ item }}"
groups: docker
append: true
with_items: "{{ docker_users }}"

View File

@ -752,7 +752,7 @@ def get_dick_permit(**kwargs):
else: else:
token = '' token = ''
only_group = kwargs.get('only_group') only_group = kwargs.get('only_group')
disable = '' disable = 'enable = 1'
haproxy = '' haproxy = ''
nginx = '' nginx = ''
keepalived = '' keepalived = ''
@ -763,7 +763,7 @@ def get_dick_permit(**kwargs):
else: else:
type_ip = "and type_ip = 0" type_ip = "and type_ip = 0"
if kwargs.get('disable') == 0: if kwargs.get('disable') == 0:
disable = 'or enable = 0' disable = '(enable = 1 or enable = 0)'
if kwargs.get('ip'): if kwargs.get('ip'):
ip = "and ip = '%s'" % kwargs.get('ip') ip = "and ip = '%s'" % kwargs.get('ip')
if kwargs.get('haproxy'): if kwargs.get('haproxy'):
@ -776,11 +776,10 @@ def get_dick_permit(**kwargs):
if funct.check_user_group(token=token): if funct.check_user_group(token=token):
cursor = conn.cursor() cursor = conn.cursor()
if grp == '1' and not only_group: if grp == '1' and not only_group:
sql = """ select * from servers where enable = 1 {} {} {} {} {} order by pos""" .format(disable, type_ip, nginx, keepalived, ip) sql = """ select * from servers where {} {} {} {} {} order by pos""" .format(disable, type_ip, nginx, keepalived, ip)
else: else:
sql = """ select * from servers where groups = '{group}' and (enable = 1 {disable}) {type_ip} {ip} {haproxy} {nginx} {keepalived} order by pos sql = """ select * from servers where groups = '{group}' and ({disable}) {type_ip} {ip} {haproxy} {nginx} {keepalived} order by pos
""".format(group=grp, disable=disable, type_ip=type_ip, ip=ip, haproxy=haproxy, nginx=nginx, keepalived=keepalived) """.format(group=grp, disable=disable, type_ip=type_ip, ip=ip, haproxy=haproxy, nginx=nginx, keepalived=keepalived)
try: try:
cursor.execute(sql) cursor.execute(sql)
except Exception as e: except Exception as e:

View File

@ -36,6 +36,13 @@
Here you can work with previous versions of {%if service == 'keepalived' %}Keepalived{%elif service == 'nginx' %}Nginx{%else%}HAProxy{%endif%} configs. Roll back to them, view or delete Here you can work with previous versions of {%if service == 'keepalived' %}Keepalived{%elif service == 'nginx' %}Nginx{%else%}HAProxy{%endif%} configs. Roll back to them, view or delete
</div> </div>
{% endif %} {% endif %}
{% if open %}
{% for select in selects %}
{% if select.2 == serv %}
<script>showListOfVersion(1)</script>
{% endif %}
{% endfor %}
{% endif %}
</center> </center>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -67,7 +67,8 @@ if serv is not None and form.getvalue('del') is not None:
else: else:
os.remove(os.path.join(configs_dir, form.getvalue(get))) os.remove(os.path.join(configs_dir, form.getvalue(get)))
file.add(form.getvalue(get) + "<br />") file.add(form.getvalue(get) + "<br />")
funct.logging(serv, "versions.py were deleted configs: %s" % form.getvalue(get)) funct.logging(serv, "Version of config has been deleted: %s" % form.getvalue(get), login=1,
keep_history=1, service=service)
except OSError as e: except OSError as e:
stderr = "Error: %s - %s." % (e.filename,e.strerror) stderr = "Error: %s - %s." % (e.filename,e.strerror)
@ -77,7 +78,8 @@ if serv is not None and form.getvalue('config') is not None:
aftersave = 1 aftersave = 1
try: try:
funct.logging(serv, "versions.py upload old config %s" % configver) funct.logging(serv, "Version of config has been uploaded %s" % configver, login=1,
keep_history=1, service=service)
except Exception: except Exception:
pass pass