From b5c641097aef0e210aad5bdcb538a28497042b8c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 15 Mar 2024 12:39:21 -0700 Subject: [PATCH] zoph: Re-add a safety check when reading the setup state of the app - Similar check was removed in 6646512a0adab6943503ec47372502fb28805911 when it was that it was not needed. Tests: - Run functional tests for zoph. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/zoph/privileged.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plinth/modules/zoph/privileged.py b/plinth/modules/zoph/privileged.py index 2f5655c88..12c009606 100644 --- a/plinth/modules/zoph/privileged.py +++ b/plinth/modules/zoph/privileged.py @@ -104,9 +104,13 @@ def set_configuration(enable_osm: bool | None = None, @privileged def is_configured() -> bool | None: """Return whether zoph app is configured.""" - process = subprocess.run(['zoph', '--get-config', 'interface.user.remote'], - stdout=subprocess.PIPE, check=True) - return process.stdout.decode().strip() == 'true' + try: + process = subprocess.run( + ['zoph', '--get-config', 'interface.user.remote'], + stdout=subprocess.PIPE, check=True) + return process.stdout.decode().strip() == 'true' + except (FileNotFoundError, subprocess.CalledProcessError): + return None @privileged