From: David Mulder Date: Thu, 9 Feb 2023 17:43:42 +0000 (-0700) Subject: gp: gp_sudoers_ext warn w/out visudo installed X-Git-Tag: talloc-2.4.1~1639 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b7fc5b696cc64c8a612d1a59eb3baa9d59e63c4;p=thirdparty%2Fsamba.git gp: gp_sudoers_ext warn w/out visudo installed Rather than print an ugly error message from Popen, display a warning to the user if visudo is missing. Signed-off-by: David Mulder Reviewed-by: Andreas Schneider Autobuild-User(master): David Mulder Autobuild-Date(master): Fri Feb 10 20:31:37 UTC 2023 on atb-devel-224 --- diff --git a/python/samba/gp/gp_sudoers_ext.py b/python/samba/gp/gp_sudoers_ext.py index 5607298eb19..1990962144f 100644 --- a/python/samba/gp/gp_sudoers_ext.py +++ b/python/samba/gp/gp_sudoers_ext.py @@ -49,6 +49,8 @@ def sudo_applier_func(sudo_dir, sudo_entries): with NamedTemporaryFile() as f: with open(f.name, 'w') as w: w.write(contents) + if visudo is None: + raise FileNotFoundError('visudo not found, please install it') sudo_validation = \ Popen([visudo, '-c', '-f', f.name], stdout=PIPE, stderr=PIPE).wait()