mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
error if X in last-X is too big
This commit is contained in:
parent
f9d3ae1084
commit
45e3f6b1a2
1 changed files with 12 additions and 8 deletions
20
src/log.py
20
src/log.py
|
@ -173,15 +173,19 @@ def log_show(
|
|||
share
|
||||
"""
|
||||
|
||||
match_path = re.match(r"last(?:-(?P<position>[0-9]{1,6}))?$", path)
|
||||
# Set up path with correct value if 'last' or 'last-X' magic keywords are used
|
||||
last = re.match(r"last(?:-(?P<position>[0-9]{1,6}))?$", path)
|
||||
if last:
|
||||
position = 1
|
||||
if last.group("position") is not None:
|
||||
position += int(last.group("position"))
|
||||
|
||||
if match_path:
|
||||
if match_path.group("position") == None:
|
||||
position = 1
|
||||
else:
|
||||
position = int(match_path.group("position")) + 1
|
||||
logs = log_list()
|
||||
path = list(logs["operation"])[-position]["path"]
|
||||
logs = list(log_list()["operation"])
|
||||
|
||||
if position > len(logs):
|
||||
raise YunohostValidationError(f"There isn't that many logs", raw_msg=True)
|
||||
|
||||
path = logs[-position]["path"]
|
||||
|
||||
if share:
|
||||
filter_irrelevant = True
|
||||
|
|
Loading…
Add table
Reference in a new issue