webhooks: Add process id, user id and group id to the info endpoint. (#6284)

Signed-off-by: Gregoire Mbutilovich <skyknight_x@hotmail.com>
This commit is contained in:
SkyKnight 2023-07-28 18:48:14 +02:00 committed by GitHub
parent ba4eed175d
commit e9534d6f92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -354,9 +354,14 @@ class WebHooks:
state_message, state = self.printer.get_state_message() state_message, state = self.printer.get_state_message()
src_path = os.path.dirname(__file__) src_path = os.path.dirname(__file__)
klipper_path = os.path.normpath(os.path.join(src_path, "..")) klipper_path = os.path.normpath(os.path.join(src_path, ".."))
response = {'state': state, 'state_message': state_message, response = {'state': state,
'state_message': state_message,
'hostname': socket.gethostname(), 'hostname': socket.gethostname(),
'klipper_path': klipper_path, 'python_path': sys.executable} 'klipper_path': klipper_path,
'python_path': sys.executable,
'process_id': os.getpid(),
'user_id': os.getuid(),
'group_id': os.getgid()}
start_args = self.printer.get_start_args() start_args = self.printer.get_start_args()
for sa in ['log_file', 'config_file', 'software_version', 'cpu_info']: for sa in ['log_file', 'config_file', 'software_version', 'cpu_info']:
response[sa] = start_args.get(sa) response[sa] = start_args.get(sa)