From: David Mulder Date: Fri, 26 Feb 2021 16:43:30 +0000 (-0700) Subject: gpo: Improve the samba-gpupdate --rsop output X-Git-Tag: tevent-0.11.0~1663 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b4b8082a14ec2927e845587cd3e4f1a9b95a54;p=thirdparty%2Fsamba.git gpo: Improve the samba-gpupdate --rsop output Use the CSE name based on the class name, not the module name. Also ignore the Local Policy gpo. Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py index 1b29711f245..51b006f7f7f 100644 --- a/python/samba/gpclass.py +++ b/python/samba/gpclass.py @@ -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)