@ -97,17 +97,19 @@ _dns_cloudns_init_check() {
fi
fi
CLOUDNS_AUTH_ID = " ${ CLOUDNS_AUTH_ID :- $( _readaccountconf_mutable CLOUDNS_AUTH_ID) } "
CLOUDNS_AUTH_ID = " ${ CLOUDNS_AUTH_ID :- $( _readaccountconf_mutable CLOUDNS_AUTH_ID) } "
CLOUDNS_SUB_AUTH_ID = " ${ CLOUDNS_SUB_AUTH_ID :- $( _readaccountconf_mutable CLOUDNS_SUB_AUTH_ID) } "
CLOUDNS_AUTH_PASSWORD = " ${ CLOUDNS_AUTH_PASSWORD :- $( _readaccountconf_mutable CLOUDNS_AUTH_PASSWORD) } "
CLOUDNS_AUTH_PASSWORD = " ${ CLOUDNS_AUTH_PASSWORD :- $( _readaccountconf_mutable CLOUDNS_AUTH_PASSWORD) } "
if [ -z " $CLOUDNS_AUTH_ID " ] || [ -z " $CLOUDNS_AUTH_PASSWORD " ] ; then
if [ -z " $CLOUDNS_AUTH_ID $CLOUDNS_SUB_AUTH_ID " ] || [ -z " $CLOUDNS_AUTH_PASSWORD " ] ; then
CLOUDNS_AUTH_ID = ""
CLOUDNS_AUTH_ID = ""
CLOUDNS_SUB_AUTH_ID = ""
CLOUDNS_AUTH_PASSWORD = ""
CLOUDNS_AUTH_PASSWORD = ""
_err "You don't specify cloudns api id and password yet."
_err "You don't specify cloudns api id and password yet."
_err "Please create you id and password and try again."
_err "Please create you id and password and try again."
return 1
return 1
fi
fi
if [ -z " $CLOUDNS_AUTH_ID " ] ; then
_err "CLOUDNS_AUTH_ID is not configured"
if [ -z " $CLOUDNS_AUTH_ID " ] && [ -z " $CLOUDNS_SUB_AUTH_ID " ] ; then
_err "CLOUDNS_AUTH_ID or CLOUDNS_SUB_AUTH_ID is not configured"
return 1
return 1
fi
fi
@ -125,6 +127,7 @@ _dns_cloudns_init_check() {
#save the api id and password to the account conf file.
#save the api id and password to the account conf file.
_saveaccountconf_mutable CLOUDNS_AUTH_ID " $CLOUDNS_AUTH_ID "
_saveaccountconf_mutable CLOUDNS_AUTH_ID " $CLOUDNS_AUTH_ID "
_saveaccountconf_mutable CLOUDNS_SUB_AUTH_ID " $CLOUDNS_SUB_AUTH_ID "
_saveaccountconf_mutable CLOUDNS_AUTH_PASSWORD " $CLOUDNS_AUTH_PASSWORD "
_saveaccountconf_mutable CLOUDNS_AUTH_PASSWORD " $CLOUDNS_AUTH_PASSWORD "
CLOUDNS_INIT_CHECK_COMPLETED = 1
CLOUDNS_INIT_CHECK_COMPLETED = 1
@ -168,12 +171,19 @@ _dns_cloudns_http_api_call() {
method = $1
method = $1
_debug CLOUDNS_AUTH_ID " $CLOUDNS_AUTH_ID "
_debug CLOUDNS_AUTH_ID " $CLOUDNS_AUTH_ID "
_debug CLOUDNS_SUB_AUTH_ID " $CLOUDNS_SUB_AUTH_ID "
_debug CLOUDNS_AUTH_PASSWORD " $CLOUDNS_AUTH_PASSWORD "
_debug CLOUDNS_AUTH_PASSWORD " $CLOUDNS_AUTH_PASSWORD "
if [ ! -z " $CLOUDNS_SUB_AUTH_ID " ] ; then
auth_user = " sub-auth-id= $CLOUDNS_SUB_AUTH_ID "
else
auth_user = " auth-id= $CLOUDNS_AUTH_ID "
fi ;
if [ -z " $2 " ] ; then
if [ -z " $2 " ] ; then
data = " auth-id= $CLOUDNS_AUTH_ID &auth-password= $CLOUDNS_AUTH_PASSWORD "
data = " $auth_user &auth-password= $CLOUDNS_AUTH_PASSWORD "
else
else
data = " auth-id= $CLOUDNS_AUTH_ID &auth-password= $CLOUDNS_AUTH_PASSWORD & $2 "
data = " $auth_user &auth-password= $CLOUDNS_AUTH_PASSWORD & $2 "
fi
fi
response = " $( _get " $CLOUDNS_API / $method ? $data " ) "
response = " $( _get " $CLOUDNS_API / $method ? $data " ) "