gpo: Improve the samba-gpupdate --rsop output
authorDavid Mulder <dmulder@suse.com>
Fri, 26 Feb 2021 16:43:30 +0000 (09:43 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 8 Mar 2021 17:58:37 +0000 (17:58 +0000)
Use the CSE name based on the class name, not the
module name. Also ignore the Local Policy gpo.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/gpclass.py

index 1b29711f24575bc2ffadbc21739e1dd3a31820e0..51b006f7f7f0506b4ba575c1392044eb85fbc189 100644 (file)
@@ -515,11 +515,18 @@ def rsop(lp, creds, logger, store, gp_extensions, target):
     print('%s Policy\n' % target)
     term_width = shutil.get_terminal_size(fallback=(120, 50))[0]
     for gpo in gpos:
+        if gpo.display_name.strip() == 'Local Policy':
+            continue # We never apply local policy
         print('GPO: %s' % gpo.display_name)
         print('='*term_width)
         for ext in gp_extensions:
             ext = ext(logger, lp, creds, store)
-            print('  CSE: %s' % ext.__module__.split('.')[-1])
+            cse_name_m = re.findall("'([\w\.]+)'", str(type(ext)))
+            if len(cse_name_m) > 0:
+                cse_name = cse_name_m[-1].split('.')[-1]
+            else:
+                cse_name = ext.__module__.split('.')[-1]
+            print('  CSE: %s' % cse_name)
             print('  ' + ('-'*int(term_width/2)))
             for section, settings in ext.rsop(gpo).items():
                 print('    Policy Type: %s' % section)