# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
_OFUNCTIONS_BOOTSTRAP=true
_OFUNCTIONS_BOOTSTRAP=true
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0)" &&exit1
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0) or build it with merge.sh" &&exit1
_LOGGER_PREFIX="time"
_LOGGER_PREFIX="time"
@ -2644,8 +2644,9 @@ function CheckCurrentConfigAll {
function _CheckReplicasLocal {
function _CheckReplicasLocal {
localreplicaPath="${1}"
localreplicaPath="${1}"
localreplicaType="${2}"
localreplicaType="${2}"
localstateDir="${3}"
__CheckArguments 2$#"$@"#__WITH_PARANOIA_DEBUG
__CheckArguments 3$#"$@"#__WITH_PARANOIA_DEBUG
local retval
local retval
local diskSpace
local diskSpace
@ -2662,7 +2663,29 @@ function _CheckReplicasLocal {
Logger "Created local replica path [$replicaPath].""NOTICE"
Logger "Created local replica path [$replicaPath].""NOTICE"
fi
fi
else
else
Logger "Local replica path [$replicaPath] does not exist / is not writable.""CRITICAL"
Logger "Local replica path [$replicaPath] does not exist or is not writable and CREATE_DIRS is not allowed.""CRITICAL"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
# Additionnaly, we need to copy the deletetion list to the remote state folder
# Additionnaly, we need to copy the deletetion list to the remote state folder
subject="Conflictual files found in [$INSTANCE_ID]"
subject="Conflictual files found in [$INSTANCE_ID]"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}")"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__conflictListFile]}")"
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
include #### _OFUNCTIONS_BOOTSTRAP SUBSET ####
include #### _OFUNCTIONS_BOOTSTRAP SUBSET ####
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0)" &&exit1
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0) or build it with merge.sh" &&exit1
_LOGGER_PREFIX="time"
_LOGGER_PREFIX="time"
@ -260,8 +260,9 @@ function CheckCurrentConfigAll {
function _CheckReplicasLocal {
function _CheckReplicasLocal {
localreplicaPath="${1}"
localreplicaPath="${1}"
localreplicaType="${2}"
localreplicaType="${2}"
localstateDir="${3}"
__CheckArguments 2$#"$@"#__WITH_PARANOIA_DEBUG
__CheckArguments 3$#"$@"#__WITH_PARANOIA_DEBUG
local retval
local retval
local diskSpace
local diskSpace
@ -278,7 +279,29 @@ function _CheckReplicasLocal {
Logger "Created local replica path [$replicaPath].""NOTICE"
Logger "Created local replica path [$replicaPath].""NOTICE"
fi
fi
else
else
Logger "Local replica path [$replicaPath] does not exist / is not writable.""CRITICAL"
Logger "Local replica path [$replicaPath] does not exist or is not writable and CREATE_DIRS is not allowed.""CRITICAL"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
# Additionnaly, we need to copy the deletetion list to the remote state folder
# Additionnaly, we need to copy the deletetion list to the remote state folder
subject="Conflictual files found in [$INSTANCE_ID]"
subject="Conflictual files found in [$INSTANCE_ID]"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}")"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__conflictListFile]}")"
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
_OFUNCTIONS_BOOTSTRAP=true
_OFUNCTIONS_BOOTSTRAP=true
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0)" &&exit1
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0) or build it with merge.sh" &&exit1
_LOGGER_PREFIX="time"
_LOGGER_PREFIX="time"
@ -2492,6 +2492,7 @@ function CheckCurrentConfigAll {
function _CheckReplicasLocal {
function _CheckReplicasLocal {
localreplicaPath="${1}"
localreplicaPath="${1}"
localreplicaType="${2}"
localreplicaType="${2}"
localstateDir="${3}"
local retval
local retval
@ -2509,7 +2510,29 @@ function _CheckReplicasLocal {
Logger "Created local replica path [$replicaPath].""NOTICE"
Logger "Created local replica path [$replicaPath].""NOTICE"
fi
fi
else
else
Logger "Local replica path [$replicaPath] does not exist / is not writable.""CRITICAL"
Logger "Local replica path [$replicaPath] does not exist or is not writable and CREATE_DIRS is not allowed.""CRITICAL"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampCurrentFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampCurrentFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for current target timestamp file.""ERROR"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${INITIATOR[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after initiator timestamp file.""ERROR"
return$retval
return$retval
fi
fi
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampAfterFilename"
sed -i'.withReplicaPath'"s;^${TARGET[$__replicaDir]};;g""${INITIATOR[$__stateDirAbsolute]}/${TARGET[$__type]}$timestampAfterFilename"
retval=$?
retval=$?
if[$retval -ne 0];then
if[$retval -ne 0];then
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
Logger "Cannot remove prepending replicaPaths for after target timestamp file.""ERROR"
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## This is a special coded function. Need to redelcare local functions on remote host, passing all needed variables as escaped arguments to ssh command.
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
## Anything beetween << ENDSSH and ENDSSH will be executed remotely
# Additionnaly, we need to copy the deletetion list to the remote state folder
# Additionnaly, we need to copy the deletetion list to the remote state folder
subject="Conflictual files found in [$INSTANCE_ID]"
subject="Conflictual files found in [$INSTANCE_ID]"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}")"
body="Truncated list of conflictual files:"$'\n'"$(head -c16384 "${INITIATOR[$__stateDirAbsolute]}/${INITIATOR[$__conflictListFile]}")"