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
c99d4948
Commit
c99d4948
authored
Jan 09, 2018
by
neilpang
Browse files
we should not use "updating" to support wildcard
parent
ee6f7880
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_ovh.sh
View file @
c99d4948
...
@@ -137,48 +137,27 @@ dns_ovh_add() {
...
@@ -137,48 +137,27 @@ dns_ovh_add() {
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_debug
"Getting txt records"
_info
"Adding record"
_ovh_rest GET
"domain/zone/
$_domain
/record?fieldType=TXT&subDomain=
$_sub_domain
"
if
_ovh_rest POST
"domain/zone/
$_domain
/record"
"{
\"
fieldType
\"
:
\"
TXT
\"
,
\"
subDomain
\"
:
\"
$_sub_domain
\"
,
\"
target
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:60}"
;
then
if
_contains
"
$response
"
"
$txtvalue
"
;
then
if
_contains
"
$response
"
'\[\]'
||
_contains
"
$response
"
"This service does not exist"
;
then
_ovh_rest POST
"domain/zone/
$_domain
/refresh"
_info
"Adding record"
_debug
"Refresh:
$response
"
if
_ovh_rest POST
"domain/zone/
$_domain
/record"
"{
\"
fieldType
\"
:
\"
TXT
\"
,
\"
subDomain
\"
:
\"
$_sub_domain
\"
,
\"
target
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:60}"
;
then
_info
"Added, sleeping 10 seconds"
if
_contains
"
$response
"
"
$txtvalue
"
;
then
sleep
10
_ovh_rest POST
"domain/zone/
$_domain
/refresh"
return
0
_debug
"Refresh:
$response
"
_info
"Added, sleeping 10 seconds"
sleep
10
return
0
fi
fi
_err
"Add txt record error."
else
_info
"Updating record"
record_id
=
$(
printf
"%s"
"
$response
"
|
tr
-d
"[]"
|
cut
-d
,
-f
1
)
if
[
-z
"
$record_id
"
]
;
then
_err
"Can not get record id."
return
1
fi
_debug
"record_id"
"
$record_id
"
if
_ovh_rest PUT
"domain/zone/
$_domain
/record/
$record_id
"
"{
\"
target
\"
:
\"
$txtvalue
\"
,
\"
subDomain
\"
:
\"
$_sub_domain
\"
,
\"
ttl
\"
:60}"
;
then
if
_contains
"
$response
"
"null"
;
then
_ovh_rest POST
"domain/zone/
$_domain
/refresh"
_debug
"Refresh:
$response
"
_info
"Updated, sleeping 10 seconds"
sleep
10
return
0
fi
fi
fi
_err
"Update error"
return
1
fi
fi
_err
"Add txt record error."
return
1
}
}
#fulldomain
#fulldomain
dns_ovh_rm
()
{
dns_ovh_rm
()
{
fulldomain
=
$1
fulldomain
=
$1
txtvalue
=
$2
_debug
"Getting txt records"
#_ovh_rest GET "domain/zone/$_domain/record?fieldType=TXT&subDomain=$_sub_domain"
}
}
...
...
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