]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gp: gp_sudoers_ext warn w/out visudo installed
authorDavid Mulder <dmulder@samba.org>
Thu, 9 Feb 2023 17:43:42 +0000 (10:43 -0700)
committerDavid Mulder <dmulder@samba.org>
Fri, 10 Feb 2023 20:31:37 +0000 (20:31 +0000)
Rather than print an ugly error message from
Popen, display a warning to the user if visudo
is missing.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Fri Feb 10 20:31:37 UTC 2023 on atb-devel-224

python/samba/gp/gp_sudoers_ext.py

index 5607298eb192fb64770caefde548d0910790203f..1990962144faa8a611a600c2aeefcb6cbed64892 100644 (file)
@@ -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()