From: David Mulder Date: Wed, 7 Dec 2022 16:49:53 +0000 (-0700) Subject: gp: Test that files are re-created if manually removed X-Git-Tag: talloc-2.4.0~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d170d8cfbb4571af8b66f1dcd7355a598b0abd1f;p=thirdparty%2Fsamba.git gp: Test that files are re-created if manually removed Currently applied files which are manually removed do not get re-applied. Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py index d0ee5518212..1ae273f8719 100644 --- a/python/samba/tests/gpo.py +++ b/python/samba/tests/gpo.py @@ -7221,10 +7221,20 @@ class GPOTests(tests.TestCase): ext.process_group_policy([], gpos, dname) sudoers = os.listdir(dname) self.assertEquals(len(sudoers), 1, 'The sudoer file was not created') - self.assertIn(e2.data, - open(os.path.join(dname, sudoers[0]), 'r').read(), + sudoers_file = os.path.join(dname, sudoers[0]) + self.assertIn(e2.data, open(sudoers_file, 'r').read(), 'The sudoers entry was not applied') + # Remove the sudoers file, and make sure a re-apply puts it back + os.unlink(sudoers_file) + ext.process_group_policy([], gpos, dname) + sudoers = os.listdir(dname) + self.assertEquals(len(sudoers), 1, + 'The sudoer file was not recreated') + sudoers_file = os.path.join(dname, sudoers[0]) + self.assertIn(e2.data, open(sudoers_file, 'r').read(), + 'The sudoers entry was not reapplied') + # Remove policy gp_db = store.get_gplog(machine_creds.get_username()) del_gpos = get_deleted_gpos_list(gp_db, []) diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo new file mode 100644 index 00000000000..7ea9bca77f8 --- /dev/null +++ b/selftest/knownfail.d/gpo @@ -0,0 +1 @@ +samba.tests.gpo.GPOTests.test_gp_centrify_sudoers_ext*