From 5973b9e77353c3a5d57a69253b4f8926a8405413 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Sun, 5 Jan 2025 02:34:11 +0200 Subject: kvmd-otgconf: Ignore some errors --- kvmd/apps/otgconf/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kvmd/apps/otgconf/__init__.py b/kvmd/apps/otgconf/__init__.py index 4ad9c2ea..ac5d54f5 100644 --- a/kvmd/apps/otgconf/__init__.py +++ b/kvmd/apps/otgconf/__init__.py @@ -103,12 +103,18 @@ class _GadgetControl: def enable_functions(self, funcs: list[str]) -> None: with self.__udc_stopped(): for func in funcs: - os.symlink(self.__get_fsrc_path(func), self.__get_fdest_path(func)) + try: + os.symlink(self.__get_fsrc_path(func), self.__get_fdest_path(func)) + except FileExistsError: + pass def disable_functions(self, funcs: list[str]) -> None: with self.__udc_stopped(): for func in funcs: - os.unlink(self.__get_fdest_path(func)) + try: + os.unlink(self.__get_fdest_path(func)) + except FileNotFoundError: + pass def list_functions(self) -> None: metas = list(self.__read_metas()) -- cgit v1.2.3