From: Michael Tokarev Date: Tue, 26 Apr 2022 13:14:38 +0000 (+0300) Subject: testparm: do not fail if /run/samba does not exist X-Git-Tag: archive/raspbian/2%4.22.0+dfsg-1+rpi1^2^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6f738aec61126738c409db270895b5e45ca61c82;p=samba.git testparm: do not fail if /run/samba does not exist Forwarded: https://gitlab.com/samba-team/samba/-/merge_requests/3872 testparm explicitly fails if $piddir or $lockdir does not exist. However, the daemons which actually use these directories, will create it on demand, there is no need to fail even simple testparm operations if the dirs are not there. This change lets to (pre)configure samba without bothering to pre-create the directories which are overwise needed only to fulfil testparm criteria. Signed-off-by: Michael Tokarev Gbp-Pq: Name testparm-do-not-fail-if-pid-dir-does-not-exist.patch --- diff --git a/python/samba/netcmd/testparm.py b/python/samba/netcmd/testparm.py index a419ddf1..6fbde635 100644 --- a/python/samba/netcmd/testparm.py +++ b/python/samba/netcmd/testparm.py @@ -145,14 +145,12 @@ class cmd_testparm(Command): lockdir = lp.get("lockdir") if not os.path.isdir(lockdir): - logger.error("lock directory %s does not exist", lockdir) - valid = False + logger.warning("lock directory %s does not exist", lockdir) piddir = lp.get("pid directory") if not os.path.isdir(piddir): - logger.error("pid directory %s does not exist", piddir) - valid = False + logger.warning("pid directory %s does not exist", piddir) winbind_separator = lp.get("winbind separator") diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index a31a7a8a..55c9bf1e 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -420,9 +420,8 @@ static int do_global_checks(void) } if (!directory_exist_stat(lp_lock_directory(), &st)) { - fprintf(stderr, "ERROR: lock directory %s does not exist\n\n", + fprintf(stderr, "WARNING: lock directory %s does not exist\n\n", lp_lock_directory()); - ret = 1; } else if ((st.st_ex_mode & 0777) != 0755) { fprintf(stderr, "WARNING: lock directory %s should have " "permissions 0755 for browsing to work\n\n", @@ -450,9 +449,8 @@ static int do_global_checks(void) } if (!directory_exist_stat(lp_pid_directory(), &st)) { - fprintf(stderr, "ERROR: pid directory %s does not exist\n\n", + fprintf(stderr, "WARNING: pid directory %s does not exist\n\n", lp_pid_directory()); - ret = 1; } if (lp_passdb_expand_explicit()) {