diff options
author | Martin Schwenke <martin@meltin.net> | 2012-07-04 07:29:18 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2012-07-26 22:03:00 +1000 |
commit | d26c21df4a6a8a7a070316c86b4e95b98a0f9fa7 (patch) | |
tree | 3e96816d7891eb4ec5f58b92d9c2501d245b20ba | |
parent | cb8517ed4c82239d7bd61cf9b38907d446ca37eb (diff) | |
download | samba-d26c21df4a6a8a7a070316c86b4e95b98a0f9fa7.tar.gz samba-d26c21df4a6a8a7a070316c86b4e95b98a0f9fa7.tar.xz samba-d26c21df4a6a8a7a070316c86b4e95b98a0f9fa7.zip |
tests/eventscripts: Rewrite the testparm stub
It currently needs the real testparm command installed even though it
only uses limited features. It is easy enough to fake up the
functionality that 50.samba uses.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 7ef9916bd95ff2472359a412eac5489f1aad2dce)
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/testparm | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/ctdb/tests/eventscripts/stubs/testparm b/ctdb/tests/eventscripts/stubs/testparm index 83aa578673..9e3747f45c 100755 --- a/ctdb/tests/eventscripts/stubs/testparm +++ b/ctdb/tests/eventscripts/stubs/testparm @@ -1,25 +1,40 @@ #!/bin/sh +not_implemented () +{ + echo "testparm: option \"$1\" not implemented in stub" >&2 + exit 2 +} + # Ensure that testparm always uses our canned configuration instead of -# the global one, unless some other file is specified. This requires -# testparm to be installed but is quicker than reimplementing all the -# various command-line options. +# the global one, unless some other file is specified. -file_specified=false +file="" +parameter="" for i ; do case "$i" in + --parameter-name=*) parameter="${i#--parameter-name=}" ;; -*) : ;; - *) file_specified=true + *) file="$i" ;; esac done -if $file_specified ; then +# Just hard-code parameter requests for now. Later on they could be +# parsed out of the file. +case "$parameter" in + security) echo "ADS" ; exit 0 ;; + smb*ports) echo "445 139" ; exit 0 ;; + ?*) not_implemented "--parameter-name=$parameter" ;; + # Fall through if $parameter not set +esac + +if [ -n "$file" ] ; then # This should include the shares, since this is used when the # samba eventscript caches the output. - /usr/bin/testparm "$@" + cat "$file" else # We force our own smb.conf and add the shares. - /usr/bin/testparm "$@" "${CTDB_ETCDIR}/samba/smb.conf" + cat "${CTDB_ETCDIR}/samba/smb.conf" for i in $FAKE_SHARES ; do bi=$(basename "$i") |