]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Script ext should not crash if script missing
authorDavid Mulder <dmulder@suse.com>
Fri, 7 Aug 2020 19:39:18 +0000 (13:39 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 27 Aug 2020 15:59:33 +0000 (15:59 +0000)
If a user has manually removed a script, the
extension should not crash in an unapply removing
it.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gp_scripts_ext.py

index f36470800c6d0070a06fb1e4f67762c5f76ed932..80e2262019d681b412922381a130a6693dc3cfc9 100644 (file)
@@ -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()