Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
bddde605
Commit
bddde605
authored
Mar 07, 2023
by
Easton Man
Browse files
fix: use update instead of remove then add
parent
e9366f8c
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_huaweicloud.sh
View file @
bddde605
...
@@ -254,19 +254,16 @@ _add_record() {
...
@@ -254,19 +254,16 @@ _add_record() {
_record_id
=
"
$(
_get_recordset_id
"
${
_token
}
"
"
${
_domain
}
"
"
${
zoneid
}
"
)
"
_record_id
=
"
$(
_get_recordset_id
"
${
_token
}
"
"
${
_domain
}
"
"
${
zoneid
}
"
)
"
_debug
"Record Set ID is:"
"
${
_record_id
}
"
_debug
"Record Set ID is:"
"
${
_record_id
}
"
# Remove all records
_recursive_rm_record
"
${
token
}
"
"
${
_domain
}
"
"
${
_zoneid
}
"
"
${
_record_id
}
"
ret
=
"
$?
"
if
[
"
${
ret
}
"
!=
"0"
]
;
then
return
1
fi
# Add brand new records with all old and new records
# Add brand new records with all old and new records
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
export
_H1
=
"X-Auth-Token:
${
_token
}
"
export
_H1
=
"X-Auth-Token:
${
_token
}
"
_debug2
"
${
_post_body
}
"
_debug2
"
${
_post_body
}
"
if
[
-z
"
${
_exist_record
}
"
]
;
then
_post
"
${
_post_body
}
"
"
${
dns_api
}
/v2/zones/
${
zoneid
}
/recordsets"
>
/dev/null
_post
"
${
_post_body
}
"
"
${
dns_api
}
/v2/zones/
${
zoneid
}
/recordsets"
>
/dev/null
else
_post
"
${
_post_body
}
"
"
${
dns_api
}
/v2/zones/
${
zoneid
}
/recordsets/{
$_record_id
}"
false
"PUT"
>
/dev/null
fi
_code
=
"
$(
grep
"^HTTP"
"
$HTTP_HEADER
"
| _tail_n 1 |
cut
-d
" "
-f
2 |
tr
-d
"
\\
r
\\
n"
)
"
_code
=
"
$(
grep
"^HTTP"
"
$HTTP_HEADER
"
| _tail_n 1 |
cut
-d
" "
-f
2 |
tr
-d
"
\\
r
\\
n"
)
"
if
[
"
$_code
"
!=
"202"
]
;
then
if
[
"
$_code
"
!=
"202"
]
;
then
_err
"dns_huaweicloud: http code
${
_code
}
"
_err
"dns_huaweicloud: http code
${
_code
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment