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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-03-15 12:39:21 -07:00 committed by James Valleroy
parent 9366597b77
commit b5c641097a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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