Addming more functionality
This commit is contained in:
parent
cc218af2e0
commit
4d3caf98c1
14
src/app.py
14
src/app.py
@ -49,8 +49,18 @@ def get_logs():
|
||||
if issue_type not in config:
|
||||
return jsonify({"error": "Invalid issue type"})
|
||||
issue_config = config[issue_type]
|
||||
response = {log.get('log_file').split('*')[0]: read_log_from_dir(*split_directory_and_file(log.get('log_file')), log['lines']) if '*' in log.get('log_file') else read_log(log['log_file'], log['lines']) for log in issue_config['logs']}
|
||||
response.update({comm.get('tag'): os.popen(comm.get('comm')).read() for comm in issue_config['commands']})
|
||||
# response = {log.get('log_file').split('*')[0]: read_log_from_dir(*split_directory_and_file(log.get('log_file')), log['lines']) if '*' in log.get('log_file') else read_log(log['log_file'], log['lines']) for log in issue_config['logs']}
|
||||
# response.update({comm.get('tag'): os.popen(comm.get('comm')).read() for comm in issue_config['commands']})
|
||||
|
||||
response = {
|
||||
log.get('log_file').split('*')[0]: f"```\n{read_log_from_dir(*split_directory_and_file(log.get('log_file')), log['lines'])}\n```" if '*' in log.get('log_file') else f"```\n{read_log(log['log_file'], log['lines'])}\n```"
|
||||
for log in issue_config['logs']
|
||||
}
|
||||
response.update({
|
||||
comm.get('tag'): f"```\n{os.popen(comm.get('comm')).read()}\n```" for comm in issue_config['commands']
|
||||
})
|
||||
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)})
|
||||
return jsonify(response)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user