From e8e5b4b59b23ec1b6a5bf97c7fe431ac638d47b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C3=A9cureuil?= Date: Mon, 22 Apr 2024 14:52:17 +0200 Subject: [PATCH] (plugin_updatenetworkcheck) Protect the file copy of medullanetnotify.exe in a try (cherry picked from commit c199e1e6b2a381eaaadb688d34e76606cd8960fb) --- .../pluginsmachine/plugin_updatenetworkcheck.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pulse_xmpp_agent/pluginsmachine/plugin_updatenetworkcheck.py b/pulse_xmpp_agent/pluginsmachine/plugin_updatenetworkcheck.py index 8595039f..f161f5ac 100644 --- a/pulse_xmpp_agent/pluginsmachine/plugin_updatenetworkcheck.py +++ b/pulse_xmpp_agent/pluginsmachine/plugin_updatenetworkcheck.py @@ -218,10 +218,13 @@ def updatenetworkcheck(xmppobject): querycmd_result = utils.simplecommand(querycmd) # We need to have a copy of pythonservices named based on _exe_name_ if not os.path.isfile(os.path.join(win32_path, "medullanetnotify.exe")): - shutil.copyfile( - os.path.join(win32_path, "pythonservice.exe"), - os.path.join(win32_path, "medullanetnotify.exe"), - ) + try: + shutil.copyfile( + os.path.join(win32_path, "pythonservice.exe"), + os.path.join(win32_path, "medullanetnotify.exe"), + ) + except IOError as error_copy: + logger.error(f"The error {error_copy} \n occured while copying files") if querycmd_result["code"] != 0: servicecmd = '%s "%s\\%s" --startup=auto install' % (