mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-10 16:44:11 +00:00
shellcheck fixes
This commit is contained in:
parent
c1f44f589b
commit
53c5a78662
@ -30,7 +30,7 @@ dns_plesk_add() {
|
|||||||
_debug _domain "$_domain"
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
_info "Adding record"
|
_info "Adding record"
|
||||||
add_txt_record $_domain_id $_sub_domain $txtvalue
|
add_txt_record "$_domain_id" "$_sub_domain" "$txtvalue"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ dns_plesk_rm() {
|
|||||||
_debug _domain "$_domain"
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
_info "Remove record"
|
_info "Remove record"
|
||||||
del_txt_record $_domain_id $fulldomain
|
del_txt_record "$_domain_id" "$fulldomain"
|
||||||
}
|
}
|
||||||
|
|
||||||
#################### Private functions below ##################################
|
#################### Private functions below ##################################
|
||||||
@ -80,25 +80,25 @@ function init_config(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function plesk_api() {
|
function plesk_api() {
|
||||||
local request="$1"
|
request="$1"
|
||||||
|
|
||||||
export _H1="HTTP_AUTH_LOGIN: $PLESK_User"
|
export _H1="HTTP_AUTH_LOGIN: $PLESK_User"
|
||||||
export _H2="HTTP_AUTH_PASSWD: $PLESK_Password"
|
export _H2="HTTP_AUTH_PASSWD: $PLESK_Password"
|
||||||
export _H3="content-Type: text/xml"
|
export _H3="content-Type: text/xml"
|
||||||
export _H4="HTTP_PRETTY_PRINT: true"
|
export _H4="HTTP_PRETTY_PRINT: true"
|
||||||
|
|
||||||
response="$(_post $request "https://$PLESK_Host:8443/enterprise/control/agent.php" "" "POST")"
|
response="$(_post "$request" "https://$PLESK_Host:8443/enterprise/control/agent.php" "" "POST")"
|
||||||
_debug2 "response" "$response"
|
_debug2 "response" "$response"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_txt_record() {
|
function add_txt_record() {
|
||||||
local site_id=$1
|
site_id=$1
|
||||||
local subdomain=$2
|
subdomain=$2
|
||||||
local txt_value=$3
|
txt_value=$3
|
||||||
local request="<packet><dns><add_rec><site-id>$site_id</site-id><type>TXT</type><host>$subdomain</host><value>$txt_value</value></add_rec></dns></packet>"
|
request="<packet><dns><add_rec><site-id>$site_id</site-id><type>TXT</type><host>$subdomain</host><value>$txt_value</value></add_rec></dns></packet>"
|
||||||
plesk_api $request
|
plesk_api "$request"
|
||||||
|
|
||||||
if ! _contains "${response}" '<status>ok</status>'; then
|
if ! _contains "${response}" '<status>ok</status>'; then
|
||||||
return 1
|
return 1
|
||||||
@ -107,15 +107,15 @@ function add_txt_record() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function del_txt_record() {
|
function del_txt_record() {
|
||||||
local site_id=$1
|
site_id=$1
|
||||||
local fulldomain="${2}."
|
fulldomain="${2}."
|
||||||
|
|
||||||
get_dns_record_list $site_id
|
get_dns_record_list "$site_id"
|
||||||
|
|
||||||
j=0
|
j=0
|
||||||
for item in "${_plesk_dns_host[@]}"
|
for item in "${_plesk_dns_host[@]}"
|
||||||
do
|
do
|
||||||
_debug "item" $item
|
_debug "item" "$item"
|
||||||
if [ "$fulldomain" = "$item" ]; then
|
if [ "$fulldomain" = "$item" ]; then
|
||||||
_dns_record_id=${_plesk_dns_ids[$j]}
|
_dns_record_id=${_plesk_dns_ids[$j]}
|
||||||
fi
|
fi
|
||||||
@ -123,8 +123,8 @@ function del_txt_record() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
_debug "record id" "$_dns_record_id"
|
_debug "record id" "$_dns_record_id"
|
||||||
local request="<packet><dns><del_rec><filter><id>$_dns_record_id</id></filter></del_rec></dns></packet>"
|
request="<packet><dns><del_rec><filter><id>$_dns_record_id</id></filter></del_rec></dns></packet>"
|
||||||
plesk_api $request
|
plesk_api "$request"
|
||||||
|
|
||||||
if ! _contains "${response}" '<status>ok</status>'; then
|
if ! _contains "${response}" '<status>ok</status>'; then
|
||||||
return 1
|
return 1
|
||||||
@ -134,9 +134,9 @@ function del_txt_record() {
|
|||||||
|
|
||||||
#fetches the domain list for the given account
|
#fetches the domain list for the given account
|
||||||
function get_domain_list() {
|
function get_domain_list() {
|
||||||
local request='<packet><customer><get-domain-list><filter></filter></get-domain-list></customer></packet>'
|
request='<packet><customer><get-domain-list><filter></filter></get-domain-list></customer></packet>'
|
||||||
|
|
||||||
plesk_api $request
|
plesk_api "$request"
|
||||||
|
|
||||||
if ! _contains "${response}" '<status>ok</status>'; then
|
if ! _contains "${response}" '<status>ok</status>'; then
|
||||||
return 1
|
return 1
|
||||||
@ -150,10 +150,10 @@ function get_domain_list() {
|
|||||||
|
|
||||||
#fetches all dns records fo rthe given sit
|
#fetches all dns records fo rthe given sit
|
||||||
function get_dns_record_list() {
|
function get_dns_record_list() {
|
||||||
local siteid=$1
|
siteid=$1
|
||||||
local request="<packet><dns><get_rec><filter><site-id>$siteid</site-id></filter></get_rec></dns></packet>"
|
request="<packet><dns><get_rec><filter><site-id>$siteid</site-id></filter></get_rec></dns></packet>"
|
||||||
|
|
||||||
plesk_api $request
|
plesk_api "$request"
|
||||||
|
|
||||||
if ! _contains "${response}" '<status>ok</status>'; then
|
if ! _contains "${response}" '<status>ok</status>'; then
|
||||||
return 1
|
return 1
|
||||||
@ -187,7 +187,7 @@ _get_root() {
|
|||||||
j=0
|
j=0
|
||||||
for item in "${_plesk_domain_names[@]}"
|
for item in "${_plesk_domain_names[@]}"
|
||||||
do
|
do
|
||||||
_debug "item" $item
|
_debug "item" "$item"
|
||||||
if [ "$h" = "$item" ]; then
|
if [ "$h" = "$item" ]; then
|
||||||
|
|
||||||
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p)
|
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user