summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDavid Mulder <dmulder@suse.com>2020-08-07 13:39:18 -0600
committerDavid Mulder <dmulder@samba.org>2020-08-27 15:59:33 +0000
commit87fe86270e16cc06d4d4d6462705b2c3c93a473c (patch)
treef9e13ca8c91b292862fbb3038ddca5da054056a7 /python
parent7c6969e9c9cccc1fdf0a668389bc9b3eaa6d2831 (diff)
downloadsamba-87fe86270e16cc06d4d4d6462705b2c3c93a473c.tar.gz
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 <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python')
-rw-r--r--python/samba/gp_scripts_ext.py3
1 files changed, 2 insertions, 1 deletions
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()