And everytime I test something new, I find a new bug:

# 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:~# 


:/


Hopefully this is enough to fix it:
--- gpo.py.orig 2025-04-15 19:35:07.051084668 +0000
+++ /usr/lib/python3/dist-packages/samba/netcmd/gpo.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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2107395

Title:
  Updating MOTD GPO adds new text instead of replacing existing one

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2107395/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to