]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool gpo backup fix --generalize
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 14 Mar 2025 08:55:29 +0000 (21:55 +1300)
committerJule Anger <janger@samba.org>
Thu, 17 Apr 2025 11:31:14 +0000 (11:31 +0000)
This was broken with commit ce56d336f234febfd4cb3da11dd584842c24ce1d
but we didn't notice because the test was already broken.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15829

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
(cherry picked from commit 65751f2562f98bd7fd0734dc00784e6395d76322)

python/samba/netcmd/gpo.py
selftest/knownfail.d/samba-tool-gpo [deleted file]

index d4f6bad67af613a48ef00828a2f4d83492481f72..12fc2c6c40922bf88b7f78dd168694886bdad2ce 100644 (file)
@@ -1322,9 +1322,11 @@ class cmd_backup(GPOCommand):
             self.outf.write('\nAttempting to generalize XML entities:\n')
             entities = cmd_backup.generalize_xml_entities(self.outf, gpodir,
                                                           gpodir)
-            import operator
-            ents = "".join('<!ENTITY {} "{}\n">'.format(ent[1].strip('&;'), ent[0]) \
-                             for ent in sorted(entities.items(), key=operator.itemgetter(1)))
+
+            ent_list = [(v, k) for k, v in entities.items()]
+            ent_list.sort()
+            ents = "".join(f'<!ENTITY {ent.strip("&;")} "{val}">\n'
+                           for ent, val in ent_list)
 
             if ent_file:
                 with open(ent_file, 'w') as f:
diff --git a/selftest/knownfail.d/samba-tool-gpo b/selftest/knownfail.d/samba-tool-gpo
deleted file mode 100644 (file)
index 097495b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba.tests.samba_tool.gpo.+GpoCmdTestCase.test_backup_restore_generalize
-