mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Replace file_name by path in log display cmd
This commit is contained in:
parent
2cb0e7916e
commit
930567f54f
2 changed files with 9 additions and 9 deletions
|
@ -1625,10 +1625,10 @@ log:
|
||||||
### log_display()
|
### log_display()
|
||||||
display:
|
display:
|
||||||
action_help: Display a log content
|
action_help: Display a log content
|
||||||
api: GET /logs/<file_name>
|
api: GET /logs/display
|
||||||
arguments:
|
arguments:
|
||||||
file_name:
|
path:
|
||||||
help: Log filename which to display the content
|
help: Log file which to display the content
|
||||||
-n:
|
-n:
|
||||||
full: --number
|
full: --number
|
||||||
help: Number of lines to display
|
help: Number of lines to display
|
||||||
|
|
|
@ -82,7 +82,7 @@ def log_list(limit=None, full=False):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def log_display(file_name, number=50):
|
def log_display(path, number=50):
|
||||||
"""
|
"""
|
||||||
Display a log file enriched with metadata if any.
|
Display a log file enriched with metadata if any.
|
||||||
|
|
||||||
|
@ -95,12 +95,12 @@ def log_display(file_name, number=50):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Normalize log/metadata paths and filenames
|
# Normalize log/metadata paths and filenames
|
||||||
abs_path = file_name
|
abs_path = path
|
||||||
log_path = None
|
log_path = None
|
||||||
if not file_name.startswith('/'):
|
if not path.startswith('/'):
|
||||||
abs_path = os.path.join(OPERATIONS_PATH, file_name)
|
abs_path = os.path.join(OPERATIONS_PATH, path)
|
||||||
|
|
||||||
if os.path.exists(abs_path) and not file_name.endswith(METADATA_FILE_EXT) :
|
if os.path.exists(abs_path) and not path.endswith(METADATA_FILE_EXT) :
|
||||||
log_path = abs_path
|
log_path = abs_path
|
||||||
|
|
||||||
base_path = os.path.splitext(abs_path)[0]
|
base_path = os.path.splitext(abs_path)[0]
|
||||||
|
@ -111,7 +111,7 @@ def log_display(file_name, number=50):
|
||||||
|
|
||||||
if not os.path.exists(md_path) and not os.path.exists(log_path):
|
if not os.path.exists(md_path) and not os.path.exists(log_path):
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('log_does_exists', log=file_name))
|
m18n.n('log_does_exists', log=path))
|
||||||
|
|
||||||
infos = {}
|
infos = {}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue