Trying to list a MOTD GPO after having cleared it returns a traceback: # Clearing the MOTD text root@p-gpo:~# samba-tool gpo manage motd set {31B2F340-016D-11D2-945F-00C04FB984F9} "" -U Administrator%Passw0rd WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start. # Listing root@p-gpo:~# samba-tool gpo manage motd list '{31B2F340-016D-11D2-945F-00C04FB984F9}' ERROR(<class 'TypeError'>): uncaught exception - write() argument must be str, not None File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 353, in _run return self.run(*args, **kwargs) ~~~~~~~~^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/samba/netcmd/gpo.py", line 3751, in run self.outf.write(text.text) ~~~~~~~~~~~~~~~^^^^^^^^^^^ root@p-gpo:~# Something like this should fix it I hope: --- python/samba/netcmd/gpo.py.py.orig 2025-04-15 19:35:07.051084668 +0000 +++ python/samba/netcmd/gpo.py.py 2025-04-15 19:35:08.665997025 +0000 @@ -3748,7 +3748,9 @@ policy = xml_data.find('policysetting') data = policy.find('data') text = data.find('text') - self.outf.write(text.text) + if text is not None: + if text.text is not None: + self.outf.write(text.text) class cmd_set_motd(GPOCommand): """Sets a VGP MOTD Group Policy to the sysvol I'll format it properly as a patch.
Created attachment 18632 [details] fix crash when listing empty MOTD GPO