|
@ -0,0 +1,28 @@ |
|
|
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
OPTS=( |
|
|
|
|
|
host |
|
|
|
|
|
port |
|
|
|
|
|
connection-security |
|
|
|
|
|
auth-method |
|
|
|
|
|
) |
|
|
|
|
|
for var in "${OPTS[@]}"; do |
|
|
|
|
|
value=$(options-get "$var") && relation-set "$var" "$value" || exit 1 |
|
|
|
|
|
case "$var:$value" in |
|
|
|
|
|
auth-method:password) |
|
|
|
|
|
login=$(options-get "login") || { |
|
|
|
|
|
err "${WHITE}login${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\"" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
password=$(options-get "password") || { |
|
|
|
|
|
err "${WHITE}password${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\"" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
relation-set login "$login" |
|
|
|
|
|
relation-set password "$password" |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
|
|
|
done |
|
|
|
|
|
|