Bug 8063 - tlwebadm crashes if lpstat is missing
Summary: tlwebadm crashes if lpstat is missing
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Web Administration (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.15.0
Assignee: Pierre Ossman
URL:
Keywords: relnotes, tobfa_tester
Depends on:
Blocks:
 
Reported: 2022-12-29 11:25 CET by Pierre Ossman
Modified: 2023-07-05 09:26 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2022-12-29 11:25:01 CET
Having CUPS installed is only required for the printer features, and the rest of the product should work fine if it is missing. However, tlwebadm crashes with a 500 error if you access some parts of the printer configuration:

> 2022-12-29 11:19:07 INFO tlwebadm[85259]: [::ffff:10.47.1.240] 'GET /locations/terminals?new_terminal=Add+new+terminal HTTP/1.1' 500 -
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240] ----------------------------------------
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240] Exception happened during processing of request from ('::ffff:10.47.1.240', 61366, 0, 0)
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240] Traceback (most recent call last):
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/forkingserver.py", line 62, in process_request
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self . finish_request ( request , cl
> ient_address )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 407, in finish_request
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     super ( ) . finish_request ( request , client_address )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlstunnel.py", line 71, in finish_request
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self . TLSRequestHandlerClass ( request , client_address , self )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 78, in __init__
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     super ( ) . __init__ ( request , client_address , server )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/usr/lib64/python3.9/socketserver.py", line 747, in __init__
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self.handle()
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 380, in handle
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     super ( ) . handle ( )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/usr/lib64/python3.9/http/server.py", line 432, in handle
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self.handle_one_request()
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 155, in handle_one_request
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     super ( ) . handle_one_request ( )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/usr/lib64/python3.9/http/server.py", line 420, in handle_one_request
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     method()
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/server.py", line 148, in do_GET
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self . post_or_get ( "do_GET" , II1iiii )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/server.py", line 162, in post_or_get
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     OooO0O00o0 , OOo = getattr ( IIiII11I , action ) ( I11ii1IiIii , query , OooO0O00o0 )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/main.py", line 129, in do_GET
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self . _GET_METHODS . get ( page_name , self . error_404 ) ( query ) )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/locations.py", line 137, in terminals
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     Ooo [ "all_printers" ] = get_current_printerlist ( username = None )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/opt/thinlinc/modules/thinlinc/tlprinter.py", line 395, in get_current_printerlist
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     i1II1 = subprocess . Popen ( I1IiIi , stdout = subprocess . PIPE )
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     self._execute_child(args, executable, preexec_fn, close_fds,
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]   File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240]     raise child_exception_type(errno_num, err_msg, err_filename)
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240] FileNotFoundError: [Errno 2] No such file or directory: 'lpstat'
> 2022-12-29 11:19:07 ERROR tlwebadm[85259]: [::ffff:10.47.1.240] ----------------------------------------
Comment 3 Pierre Ossman cendio 2022-12-29 14:21:56 CET
Works well now.
Comment 4 Tobias cendio 2023-01-02 13:53:25 CET
Tested using server development builds #2969 (pre-fix) and #2971 (post-fix) on Ubuntu22.04.

Attempted to add a new location under the Locations/Locations tab in tlwebadm. Having disabled access to lpstat while using the pre-fix build yields the same log traceback as in comment 0 and a 500 error in the browser,

> 2023-01-02 13:46:34 INFO tlwebadm[10339]: [::ffff:10.47.1.70] 'GET /locations/locations HTTP/1.1' 200 -
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] code 500, message Internal error on page '/locations/locations?new_location=Add+new+location'
> 2023-01-02 13:46:35 INFO tlwebadm[10341]: [::ffff:10.47.1.70] 'GET /locations/locations?new_location=Add+new+location HTTP/1.1' 500 -
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] ----------------------------------------
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] Exception happened during processing of request from ('::ffff:10.47.1.70', 40328, 0, 0)
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] Traceback (most recent call last):
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/forkingserver.py", line 62, in process_request
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self . finish_request ( request , client_address )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 407, in finish_request
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     super ( ) . finish_request ( request , client_address )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlstunnel.py", line 71, in finish_request
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self . TLSRequestHandlerClass ( request , client_address , self )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 78, in __init__
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     super ( ) . __init__ ( request , client_address , server )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/usr/lib/python3.10/socketserver.py", line 747, in __init__
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self.handle()
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 380, in handle
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     super ( ) . handle ( )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/usr/lib/python3.10/http/server.py", line 425, in handle
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self.handle_one_request()
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/httpserver.py", line 155, in handle_one_request
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     super ( ) . handle_one_request ( )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/usr/lib/python3.10/http/server.py", line 413, in handle_one_request
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     method()
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/server.py", line 148, in do_GET
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self . post_or_get ( "do_GET" , II1iiii )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/server.py", line 162, in post_or_get
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     OooO0O00o0 , OOo = getattr ( IIiII11I , action ) ( I11ii1IiIii , query , OooO0O00o0 )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/main.py", line 129, in do_GET
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self . _GET_METHODS . get ( page_name , self . error_404 ) ( query ) )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlwebadm/locations.py", line 88, in locations
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     Ooo [ "all_printers" ] = get_current_printerlist ( username = None )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/opt/thinlinc/modules/thinlinc/tlprinter.py", line 395, in get_current_printerlist
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     i1II1 = subprocess . Popen ( I1IiIi , stdout = subprocess . PIPE )
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     self._execute_child(args, executable, preexec_fn, close_fds,
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]   File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70]     raise child_exception_type(errno_num, err_msg, err_filename)
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] FileNotFoundError: [Errno 2] No such file or directory: 'lpstat'
> 2023-01-02 13:46:35 ERROR tlwebadm[10341]: [::ffff:10.47.1.70] ----------------------------------------

while under the same circumstances, the post-fix build gracefully progresses as if no printers are available.

Closing.

Note You need to log in before you can comment on or make changes to this bug.