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
cd4f2913
Commit
cd4f2913
authored
Jan 02, 2019
by
Oliver Dick
Browse files
waiting for API zoneStatus active
parent
c9baca79
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_hostingde.sh
View file @
cd4f2913
...
@@ -74,8 +74,26 @@ _hostingde_getZoneConfig() {
...
@@ -74,8 +74,26 @@ _hostingde_getZoneConfig() {
return
$returnCode
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
()
{
_hostingde_addRecord
()
{
_info
"Adding record to zone"
_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}]}"
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"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
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() {
...
@@ -93,6 +111,13 @@ _hostingde_addRecord() {
_hostingde_removeRecord
()
{
_hostingde_removeRecord
()
{
_info
"Removing record from zone"
_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
}
\\\"\"
}]}"
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
\"
${
zoneConfigId
}
\"
},
\"
recordsToDelete
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
}]}"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
HOSTINGDE_ENDPOINT
}
/api/dns/v1/json/zoneUpdate"
)
"
_debug
"Calling zoneUpdate: '
${
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