Reversed some function args to make debug easier

This commit is contained in:
deajan 2016-04-01 21:22:18 +02:00
parent 79ec8668e4
commit 33570bc3f1
3 changed files with 38 additions and 38 deletions

View File

@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
PROGRAM_BUILD=2016033101
IS_STABLE=no
## FUNC_BUILD=2016033105
## FUNC_BUILD=2016040102
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
@ -798,7 +798,7 @@ function __CheckArguments {
local counted_arguments=$((iterate-4))
if [ $counted_arguments -ne $number_of_arguments ]; then
Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, see log file." "ERROR"
Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, bash seen: $number_of_given_arguments. see log file." "ERROR"
Logger "Arguments passed: $arg_list" "ERROR"
fi
fi
@ -807,8 +807,8 @@ function __CheckArguments {
#__END_WITH_PARANOIA_DEBUG
function RsyncPatternsAdd {
local pattern="${1}"
local pattern_type="${2}" # exclude or include
local pattern_type="${1}" # exclude or include
local pattern="${2}"
__CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
local rest=
@ -837,8 +837,8 @@ function RsyncPatternsAdd {
}
function RsyncPatternsFromAdd {
local pattern_from="${1}"
local pattern_type="${2}"
local pattern_type="${1}"
local pattern_from="${2}"
__CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
local pattern_from=
@ -857,22 +857,22 @@ function RsyncPatterns {
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"

View File

@ -1,4 +1,4 @@
## FUNC_BUILD=2016033105
## FUNC_BUILD=2016040102
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
@ -788,7 +788,7 @@ function __CheckArguments {
local counted_arguments=$((iterate-4))
if [ $counted_arguments -ne $number_of_arguments ]; then
Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, see log file." "ERROR"
Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, bash seen: $number_of_given_arguments. see log file." "ERROR"
Logger "Arguments passed: $arg_list" "ERROR"
fi
fi
@ -797,8 +797,8 @@ function __CheckArguments {
#__END_WITH_PARANOIA_DEBUG
function RsyncPatternsAdd {
local pattern="${1}"
local pattern_type="${2}" # exclude or include
local pattern_type="${1}" # exclude or include
local pattern="${2}"
__CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
local rest=
@ -827,8 +827,8 @@ function RsyncPatternsAdd {
}
function RsyncPatternsFromAdd {
local pattern_from="${1}"
local pattern_type="${2}"
local pattern_type="${1}"
local pattern_from="${2}"
__CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
local pattern_from=
@ -847,22 +847,22 @@ function RsyncPatterns {
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"

View File

@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre
PROGRAM_BUILD=2016033101
IS_STABLE=no
## FUNC_BUILD=2016033105
## FUNC_BUILD=2016040102
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
@ -742,8 +742,8 @@ function CheckConnectivity3rdPartyHosts {
#__END_WITH_PARANOIA_DEBUG
function RsyncPatternsAdd {
local pattern="${1}"
local pattern_type="${2}" # exclude or include
local pattern_type="${1}" # exclude or include
local pattern="${2}"
local rest=
@ -771,8 +771,8 @@ function RsyncPatternsAdd {
}
function RsyncPatternsFromAdd {
local pattern_from="${1}"
local pattern_type="${2}"
local pattern_type="${1}"
local pattern_from="${2}"
local pattern_from=
@ -789,22 +789,22 @@ function RsyncPatternsFromAdd {
function RsyncPatterns {
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN"
if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM"
fi
else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"