diff options
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/config/events/legacy/50.samba.script | 15 | ||||
-rwxr-xr-x | ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh | 4 | ||||
-rw-r--r-- | ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf | 1 | ||||
-rwxr-xr-x | ctdb/tests/UNIT/eventscripts/stubs/testparm | 23 |
4 files changed, 19 insertions, 24 deletions
diff --git a/ctdb/config/events/legacy/50.samba.script b/ctdb/config/events/legacy/50.samba.script index 44ae0a4e63b..84600e25024 100755 --- a/ctdb/config/events/legacy/50.samba.script +++ b/ctdb/config/events/legacy/50.samba.script @@ -109,21 +109,24 @@ testparm_background_update() testparm_foreground_update "$_timeout" >/dev/null 2>&1 </dev/null & } -testparm_cat() +testparm_get () { - testparm -s "$smbconf_cache" "$@" 2>/dev/null + _param="$1" + + sed -n \ + -e "s|^[[:space:]]*${_param}[[:space:]]*=[[:space:]]\(..*\)|\1|p" \ + "$smbconf_cache" + } list_samba_shares() { - testparm_cat | - sed -n -e 's@^[[:space:]]*path[[:space:]]*=[[:space:]]@@p' | - sed -e 's/"//g' + testparm_get "path" | sed -e 's/"//g' } list_samba_ports() { - testparm_cat --parameter-name="smb ports" + testparm_get "smb ports" } ########################### diff --git a/ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh b/ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh index 55df6da807e..d72855f2291 100755 --- a/ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh +++ b/ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh @@ -10,7 +10,7 @@ ok_null simple_test export FAKE_TESTPARM_FAIL="yes" -required_result 1 <<EOF +ok <<EOF WARNING: smb.conf cache update failed - using old cache file Load smb config files from ${CTDB_SYS_ETCDIR}/samba/smb.conf rlimit_max: increasing rlimit_max (2048) to minimum Windows limit (16384) @@ -19,7 +19,5 @@ Processing section "[share2]" Processing section "[share3]" Loaded services file OK. WARNING: 'workgroup' and 'netbios name' must differ. - -Failed to set smb ports EOF simple_test diff --git a/ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf b/ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf index da89db2b81f..45976cd655a 100644 --- a/ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf +++ b/ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf @@ -40,3 +40,4 @@ map readonly = no ea support = yes dmapi support = no + smb ports = 445 139 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/testparm b/ctdb/tests/UNIT/eventscripts/stubs/testparm index 0f8216ff8b3..faa0f347885 100755 --- a/ctdb/tests/UNIT/eventscripts/stubs/testparm +++ b/ctdb/tests/UNIT/eventscripts/stubs/testparm @@ -44,29 +44,22 @@ fi # the global one, unless some other file is specified. file="" -parameter="" +param="" for i; do case "$i" in - --parameter-name=*) parameter="${i#--parameter-name=}" ;; + --parameter-name=*) param="${i#--parameter-name=}" ;; -*) : ;; *) file="$i" ;; esac done -# Just hard-code parameter requests for now. Later on they could be -# parsed out of the file. -case "$parameter" in -security) - echo "ADS" +# Parse out parameter request +if [ -n "$param" ]; then + sed -n \ + -e "s|^[[:space:]]*${param}[[:space:]]*=[[:space:]]\(..*\)|\1|p" \ + "${file:-"${CTDB_SYS_ETCDIR}/samba/smb.conf"}" exit 0 - ;; -smb*ports) - echo "445 139" - exit 0 - ;; -?*) not_implemented "--parameter-name=$parameter" ;; - # Fall through if $parameter not set -esac +fi if [ -n "$file" ]; then # This should include the shares, since this is used when the |