diff --git a/plinth/modules/zoph/privileged.py b/plinth/modules/zoph/privileged.py index eb555f44b..65f342281 100644 --- a/plinth/modules/zoph/privileged.py +++ b/plinth/modules/zoph/privileged.py @@ -90,11 +90,15 @@ def set_configuration(enable_osm: Optional[bool] = None, @privileged -def is_configured() -> bool: +def is_configured() -> Optional[bool]: """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: + return None @privileged diff --git a/plinth/modules/zoph/views.py b/plinth/modules/zoph/views.py index f7689de9e..f646f5de6 100644 --- a/plinth/modules/zoph/views.py +++ b/plinth/modules/zoph/views.py @@ -48,9 +48,12 @@ class ZophAppView(views.AppView): def dispatch(self, request, *args, **kwargs): """Redirect to setup page if setup is not done yet.""" - if not privileged.is_configured(): + is_configured = privileged.is_configured() + if is_configured is False: return redirect('zoph:setup') + # During operations such as uninstall, zoph command may not be + # available, let the base class show operations view instead. return super().dispatch(request, *args, **kwargs) def get_initial(self):