gp: Re-create files if manually removed
authorDavid Mulder <dmulder@samba.org>
Wed, 7 Dec 2022 16:51:12 +0000 (09:51 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 21 Dec 2022 02:04:37 +0000 (02:04 +0000)
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/gp/gpclass.py
selftest/knownfail.d/gpo [deleted file]

index 42ce3dc63fb595a974db5ce0a64ae7a5112a7875..d6ada1dbaadacf0b4f8aeef05422e3cffc12a9d1 100644 (file)
@@ -544,7 +544,8 @@ class gp_file_applier(gp_applier):
         # Ignore removal if this policy is applied and hasn't changed
         old_val_hash, old_val_files = self.__parse_value(old_val, sep)
         if (old_val_hash != value_hash or \
-                self.cache_get_apply_state() == GPOSTATE.ENFORCE):
+                self.cache_get_apply_state() == GPOSTATE.ENFORCE) or \
+                not all([os.path.exists(f) for f in old_val_files]):
             self.unapply(guid, attribute, old_val_files)
         else:
             # If policy is already applied, skip application
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
deleted file mode 100644 (file)
index 7ea9bca..0000000
+++ /dev/null
@@ -1 +0,0 @@
-samba.tests.gpo.GPOTests.test_gp_centrify_sudoers_ext*