Improve test defs create_identities()

Only set $DIDA1, $NAMEA1, etc. vars if the identity has a DID or
Name field
This commit is contained in:
Andrew Bettison 2015-08-31 19:07:05 +09:30
parent 71c7a4f870
commit 6486b3f469

View File

@ -67,11 +67,11 @@ extract_stdout_keyvalue_optional() {
if [ -n "$_line" ]; then
_value="${_line#*$_delim}"
_return=0
fi
if [ -n "$_var" ]; then
eval $_var="\$_value"
eval tfw_log "$_var=\$(shellarg "\${$_var}")"
fi
fi
return $_return
}
@ -743,15 +743,15 @@ create_identities() {
# If the DID and/or NAME is already specified in the variables, then use
# them, otherwise extract the DID and NAME automatically generated by
# servald.
if [ -n "${!didvar}" -o -n "${!namevar}" ]; then
if [ -n "${!didvar+x}" -o -n "${!namevar+x}" ]; then
executeOk_servald keyring set did "${servald_options[@]}" "${!sidvar}" "${!didvar}" "${!namevar}"
eval "$didvar=\${!didvar}"
eval "$namevar=\${!namevar}"
tfw_log "$didvar=$(shellarg "${!didvar}")"
tfw_log "$namevar=$(shellarg "${!namevar}")"
else
extract_stdout_keyvalue_optional $didvar did "$rexp_did" && tfw_log "$didvar=$(shellarg "${!didvar}")"
extract_stdout_keyvalue_optional $namevar name ".*" && tfw_log "$namevar=$(shellarg "${!namevar}")"
extract_stdout_keyvalue_optional $didvar did "$rexp_did"
extract_stdout_keyvalue_optional $namevar name ".*"
fi
done
for ((i = 1; i <= N; ++i)); do