summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDavid Mulder <dmulder@suse.com>2020-12-11 10:38:32 -0700
committerJeremy Allison <jra@samba.org>2021-02-11 17:21:33 +0000
commitff4279575f271fbbf04892c79e038d9fbaa96da3 (patch)
tree63a1242187e58e616f8d218d717bb43a7370af72 /python
parentc27c97ab552d18de00ec4eb9cbc4da457daa15a6 (diff)
downloadsamba-ff4279575f271fbbf04892c79e038d9fbaa96da3.tar.gz
samba-ff4279575f271fbbf04892c79e038d9fbaa96da3.tar.bz2
samba-ff4279575f271fbbf04892c79e038d9fbaa96da3.zip
gpo: Ensure empty Security sections are removed
Failing to remove the empty section causes tests to fail, and is also just bad practice. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/gpo.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index a0629feb4cd..33069200a44 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -1986,6 +1986,8 @@ PasswordComplexity Password must meet complexity requirements
inf_data.set(section, policy, value)
else:
inf_data.remove_option(section, policy)
+ if len(inf_data.options(section)) == 0:
+ inf_data.remove_section(section)
out = StringIO()
inf_data.write(out)