mirror of https://github.com/Aidaho12/haproxy-wi
v7.2.4.0: Update requirements and refactor date formatting function
The requirements for el9, deb, and main have been updated to specifically use version 2.27.1 of the "requests" package. In addition, the date formatting function get_time_zoned_date in common.py has been refactored. The default format for the date has been moved to the function arguments, and the function now also checks if the provided date is an instance of datetime before processing it.pull/377/head
parent
04e39325c8
commit
5b98f1b611
|
@ -26,7 +26,7 @@ def _convert_to_time_zone(date: datetime) -> datetime:
|
||||||
return native
|
return native
|
||||||
|
|
||||||
|
|
||||||
def get_time_zoned_date(date: datetime, fmt: str = None) -> str:
|
def get_time_zoned_date(date: datetime, fmt: str = '%Y-%m-%d %H:%M:%S') -> str:
|
||||||
"""
|
"""
|
||||||
Formats a given date and returns the formatted date in the specified or default format.
|
Formats a given date and returns the formatted date in the specified or default format.
|
||||||
|
|
||||||
|
@ -39,12 +39,11 @@ def get_time_zoned_date(date: datetime, fmt: str = None) -> str:
|
||||||
:return: The formatted date.
|
:return: The formatted date.
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
native = _convert_to_time_zone(date)
|
|
||||||
date_format = '%Y-%m-%d %H:%M:%S'
|
date_format = '%Y-%m-%d %H:%M:%S'
|
||||||
if fmt:
|
if not isinstance(date, datetime):
|
||||||
return native.strftime(fmt)
|
date = datetime.strptime(date, date_format)
|
||||||
else:
|
native = _convert_to_time_zone(date)
|
||||||
return native.strftime(date_format)
|
return native.strftime(fmt)
|
||||||
|
|
||||||
|
|
||||||
def get_present_time():
|
def get_present_time():
|
||||||
|
|
|
@ -185,7 +185,7 @@ function createHaClusterStep1(edited=false, cluster_id=0, clean=true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.getScript('/inc/ha.js');
|
$.getScript('/app/static/js/ha.js');
|
||||||
var regx = /^[a-z0-9_-]+$/;
|
var regx = /^[a-z0-9_-]+$/;
|
||||||
var dialog_div = $("#create-ha-cluster-step-1").dialog({
|
var dialog_div = $("#create-ha-cluster-step-1").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
|
@ -614,7 +614,7 @@ function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.getScript('/inc/ha.js');
|
$.getScript('/app/static/js/ha.js');
|
||||||
var dialog_div = $("#add-vip").dialog({
|
var dialog_div = $("#add-vip").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -739,7 +739,7 @@ function addCheckToStatus(server_id, server_ip) {
|
||||||
'</div>';
|
'</div>';
|
||||||
$('#add_check-' + server_id).remove();
|
$('#add_check-' + server_id).remove();
|
||||||
$("#enabled-check").append(html_tag);
|
$("#enabled-check").append(html_tag);
|
||||||
$.getScript('/inc/ha.js');
|
$.getScript('/app/static/js/ha.js');
|
||||||
}
|
}
|
||||||
function removeCheckFromStatus(server_id, server_ip) {
|
function removeCheckFromStatus(server_id, server_ip) {
|
||||||
var hostname = $('#remove_check-' + server_id).attr('data-name');
|
var hostname = $('#remove_check-' + server_id).attr('data-name');
|
|
@ -4,7 +4,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
|
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
|
||||||
<script src="/inc/users.js"></script>
|
<script src="/inc/users.js"></script>
|
||||||
<script src="/inc/ha.js"></script>
|
<script src="/app/static/js/ha.js"></script>
|
||||||
<script src="/inc/overview.js"></script>
|
<script src="/inc/overview.js"></script>
|
||||||
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
|
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
|
||||||
<link href="{{ url_for('static', filename='css/smon.css') }}" rel="stylesheet">
|
<link href="{{ url_for('static', filename='css/smon.css') }}" rel="stylesheet">
|
||||||
|
|
|
@ -19,3 +19,5 @@ websockets>=9.0
|
||||||
ansible-core>=2.11.12
|
ansible-core>=2.11.12
|
||||||
ansible-runner==2.3.2
|
ansible-runner==2.3.2
|
||||||
python-whois>=0.8.0
|
python-whois>=0.8.0
|
||||||
|
requests==2.27.1
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,4 @@ tzlocal==2.0.0
|
||||||
ansible-core>=2.11.12
|
ansible-core>=2.11.12
|
||||||
ansible-runner==2.3.1
|
ansible-runner==2.3.1
|
||||||
python-whois>=0.8.0
|
python-whois>=0.8.0
|
||||||
|
requests==2.27.1
|
||||||
|
|
|
@ -2,7 +2,7 @@ configparser>=3.5.0
|
||||||
paramiko-ng>=2.5.0
|
paramiko-ng>=2.5.0
|
||||||
pytz>=2017.3
|
pytz>=2017.3
|
||||||
tzlocal==2.0.0
|
tzlocal==2.0.0
|
||||||
requests>=2.22.0
|
requests==2.27.1
|
||||||
pyTelegramBotAPI>=3.6.3
|
pyTelegramBotAPI>=3.6.3
|
||||||
networkx>=2.6
|
networkx>=2.6
|
||||||
matplotlib>=2.1.2
|
matplotlib>=2.1.2
|
||||||
|
|
Loading…
Reference in New Issue