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
28694e8a
Unverified
Commit
28694e8a
authored
Apr 26, 2019
by
neil
Committed by
GitHub
Apr 26, 2019
Browse files
Merge pull request #2207 from Kimmax/dns_hostingde_missing_templateValues
dns_hostingde.sh zoneConfig missing templateValues object
parents
c420a0ae
64e53927
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_hostingde.sh
View file @
28694e8a
...
@@ -53,6 +53,18 @@ _hostingde_parse() {
...
@@ -53,6 +53,18 @@ _hostingde_parse() {
fi
fi
}
}
_hostingde_parse_no_strip_whitespace
()
{
find
=
"
${
1
}
"
if
[
"
${
2
}
"
]
;
then
notfind
=
"
${
2
}
"
fi
if
[
"
${
notfind
}
"
]
;
then
_egrep_o
\"
"
${
find
}
\"
:.*"
|
grep
-v
"
${
notfind
}
"
|
cut
-d
':'
-f
2 |
cut
-d
','
-f
1
else
_egrep_o
\"
"
${
find
}
\"
:.*"
|
cut
-d
':'
-f
2 |
cut
-d
','
-f
1
fi
}
_hostingde_getZoneConfig
()
{
_hostingde_getZoneConfig
()
{
_info
"Getting ZoneConfig"
_info
"Getting ZoneConfig"
curZone
=
"
${
fulldomain
#*.
}
"
curZone
=
"
${
fulldomain
#*.
}
"
...
@@ -85,6 +97,22 @@ _hostingde_getZoneConfig() {
...
@@ -85,6 +97,22 @@ _hostingde_getZoneConfig() {
zoneConfigDnsServerGroupId
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"dnsServerGroupId"
)
zoneConfigDnsServerGroupId
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"dnsServerGroupId"
)
zoneConfigEmailAddress
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"emailAddress"
)
zoneConfigEmailAddress
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"emailAddress"
)
zoneConfigDnsSecMode
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"dnsSecMode"
)
zoneConfigDnsSecMode
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"dnsSecMode"
)
zoneConfigTemplateValues
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse_no_strip_whitespace
"templateValues"
)
if
[
"
$zoneConfigTemplateValues
"
!=
"null"
]
;
then
_debug
"Zone is tied to a template."
zoneConfigTemplateValuesTemplateId
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"templateId"
)
zoneConfigTemplateValuesTemplateName
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse_no_strip_whitespace
"templateName"
)
zoneConfigTemplateValuesTemplateReplacementsIPv4
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"ipv4Replacement"
)
zoneConfigTemplateValuesTemplateReplacementsIPv6
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"ipv6Replacement"
)
zoneConfigTemplateValuesTemplateReplacementsMailIPv4
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"mailIpv4Replacement"
)
zoneConfigTemplateValuesTemplateReplacementsMailIPv6
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"mailIpv6Replacement"
)
zoneConfigTemplateValuesTemplateTieToTemplate
=
$(
echo
"
${
curResult
}
"
| _hostingde_parse
"tieToTemplate"
)
zoneConfigTemplateValues
=
"{
\"
templateId
\"
:
${
zoneConfigTemplateValuesTemplateId
}
,
\"
templateName
\"
:
${
zoneConfigTemplateValuesTemplateName
}
,
\"
templateReplacements
\"
:{
\"
ipv4Replacement
\"
:
${
zoneConfigTemplateValuesTemplateReplacementsIPv4
}
,
\"
ipv6Replacement
\"
:
${
zoneConfigTemplateValuesTemplateReplacementsIPv6
}
,
\"
mailIpv4Replacement
\"
:
${
zoneConfigTemplateValuesTemplateReplacementsMailIPv4
}
,
\"
mailIpv6Replacement
\"
:
${
zoneConfigTemplateValuesTemplateReplacementsMailIPv6
}
},
\"
tieToTemplate
\"
:
${
zoneConfigTemplateValuesTemplateTieToTemplate
}
}"
_debug
"Template values: '{
$zoneConfigTemplateValues
}'"
fi
if
[
"
${
zoneConfigType
}
"
!=
"
\"
NATIVE
\"
"
]
;
then
if
[
"
${
zoneConfigType
}
"
!=
"
\"
NATIVE
\"
"
]
;
then
_err
"Zone is not native"
_err
"Zone is not native"
returnCode
=
1
returnCode
=
1
...
@@ -122,7 +150,7 @@ _hostingde_addRecord() {
...
@@ -122,7 +150,7 @@ _hostingde_addRecord() {
_hostingde_getZoneStatus
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
_debug
"Result of zoneStatus: '
${
zoneStatus
}
'"
done
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
${
zoneConfigId
}
,
\"
name
\"
:
${
zoneConfigName
}
,
\"
type
\"
:
${
zoneConfigType
}
,
\"
dnsServerGroupId
\"
:
${
zoneConfigDnsServerGroupId
}
,
\"
dnsSecMode
\"
:
${
zoneConfigDnsSecMode
}
,
\"
emailAddress
\"
:
${
zoneConfigEmailAddress
}
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}},
\"
recordsToAdd
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
,
\"
ttl
\"
:3600}]}"
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
${
zoneConfigId
}
,
\"
name
\"
:
${
zoneConfigName
}
,
\"
type
\"
:
${
zoneConfigType
}
,
\"
dnsServerGroupId
\"
:
${
zoneConfigDnsServerGroupId
}
,
\"
dnsSecMode
\"
:
${
zoneConfigDnsSecMode
}
,
\"
emailAddress
\"
:
${
zoneConfigEmailAddress
}
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}
,
\"
templateValues
\"
:
${
zoneConfigTemplateValues
}
},
\"
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'"
_debug
"Result of zoneUpdate: '
$curResult
'"
_debug
"Result of zoneUpdate: '
$curResult
'"
...
@@ -146,7 +174,7 @@ _hostingde_removeRecord() {
...
@@ -146,7 +174,7 @@ _hostingde_removeRecord() {
_hostingde_getZoneStatus
_hostingde_getZoneStatus
_debug
"Result of zoneStatus: '
$zoneStatus
'"
_debug
"Result of zoneStatus: '
$zoneStatus
'"
done
done
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
${
zoneConfigId
}
,
\"
name
\"
:
${
zoneConfigName
}
,
\"
type
\"
:
${
zoneConfigType
}
,
\"
dnsServerGroupId
\"
:
${
zoneConfigDnsServerGroupId
}
,
\"
dnsSecMode
\"
:
${
zoneConfigDnsSecMode
}
,
\"
emailAddress
\"
:
${
zoneConfigEmailAddress
}
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}},
\"
recordsToDelete
\"
:[{
\"
name
\"
:
\"
${
fulldomain
}
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
content
\"
:
\"\\\"
${
txtvalue
}
\\\"\"
}]}"
curData
=
"{
\"
authToken
\"
:
\"
${
HOSTINGDE_APIKEY
}
\"
,
\"
zoneConfig
\"
:{
\"
id
\"
:
${
zoneConfigId
}
,
\"
name
\"
:
${
zoneConfigName
}
,
\"
type
\"
:
${
zoneConfigType
}
,
\"
dnsServerGroupId
\"
:
${
zoneConfigDnsServerGroupId
}
,
\"
dnsSecMode
\"
:
${
zoneConfigDnsSecMode
}
,
\"
emailAddress
\"
:
${
zoneConfigEmailAddress
}
,
\"
soaValues
\"
:{
\"
expire
\"
:
${
zoneConfigExpire
}
,
\"
negativeTtl
\"
:
${
zoneConfigNegativeTtl
}
,
\"
refresh
\"
:
${
zoneConfigRefresh
}
,
\"
retry
\"
:
${
zoneConfigRetry
}
,
\"
ttl
\"
:
${
zoneConfigTtl
}
}
,
\"
templateValues
\"
:
${
zoneConfigTemplateValues
}
},
\"
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'"
_debug
"Result of zoneUpdate: '
$curResult
'"
_debug
"Result of zoneUpdate: '
$curResult
'"
...
...
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