From 87fe86270e16cc06d4d4d6462705b2c3c93a473c Mon Sep 17 00:00:00 2001 From: David Mulder Date: Fri, 7 Aug 2020 13:39:18 -0600 Subject: gpo: Script ext should not crash if script missing If a user has manually removed a script, the extension should not crash in an unapply removing it. Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall --- python/samba/gp_scripts_ext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/samba/gp_scripts_ext.py b/python/samba/gp_scripts_ext.py index f36470800c6..80e2262019d 100644 --- a/python/samba/gp_scripts_ext.py +++ b/python/samba/gp_scripts_ext.py @@ -39,7 +39,8 @@ class gp_scripts_ext(gp_pol_ext): self.gp_db.set_guid(guid) if str(self) in settings: for attribute, script in settings[str(self)].items(): - os.unlink(script) + if os.path.exists(script): + os.unlink(script) self.gp_db.delete(str(self), attribute) self.gp_db.commit() -- cgit v1.2.1