Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
b18804f5
Unverified
Commit
b18804f5
authored
Jan 03, 2019
by
neil
Committed by
GitHub
Jan 03, 2019
Browse files
Merge pull request #2001 from hosting-de/fix-issue-2000
hosting.de API: waiting for API zoneStatus active
parents
550a5fb4
08982378
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_hostingde.sh
View file @
b18804f5
...
...
@@ -74,8 +74,26 @@ _hostingde_getZoneConfig() {
return
$returnCode
}
_hostingde_getZoneStatus
()
{
_debug
"Checking Zone status"
curData
=
"{
\"
filter
\"
:{
\"
field
\"
:
\"
zoneConfigId
\"
,
\"
value
\"
:
\"
${
zoneConfigId
}
\"
},
\"
limit
\"
:1,
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zonesFind"
)
"
_debug
"Calling zonesFind '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zonesFind'"
_debug
"Result of zonesFind '
$curResult
'"
zoneStatus
=
$(
echo
"
${
curResult
}
"
|
grep
-v
success | _egrep_o
'"status":.*'
|
cut
-d
':'
-f
2 |
cut
-d
'"'
-f
2
)
_debug
"zoneStatus '
${
zoneStatus
}
'"
return
0
}
_hostingde_addRecord
()
{
_info
"Adding record to zone"
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
while
[
"
${
zoneStatus
}
"
!=
"active"
]
;
do
_sleep 5
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
},
\"
recordsToAdd
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
,
\"
ttl
\"
:3600}]}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
...
...
@@ -93,6 +111,13 @@ _hostingde_addRecord() {
_hostingde_removeRecord
()
{
_info
"Removing record from zone"
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
$zoneStatus
'"
while
[
"
$zoneStatus
"
!=
"active"
]
;
do
_sleep 5
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
$zoneStatus
'"
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
},
\"
recordsToDelete
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
}]}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
curData
}
' '
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate'"
...
...
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