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
c6bd004d
Unverified
Commit
c6bd004d
authored
Aug 21, 2018
by
neil
Committed by
GitHub
Aug 21, 2018
Browse files
Merge pull request #1806 from Aarup/dev
Update dns api to support v2 wildcard cert #1261
parents
9173140d
8b6986ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_unoeuro.sh
View file @
c6bd004d
...
@@ -50,34 +50,16 @@ dns_unoeuro_add() {
...
@@ -50,34 +50,16 @@ dns_unoeuro_add() {
_err
"Error"
_err
"Error"
return
1
return
1
fi
fi
_info
"Adding record"
if
!
_contains
"
$response
"
"
$_sub_domain
"
>
/dev/null
;
then
if
_uno_rest POST
"my/products/
$h
/dns/records"
"{
\"
name
\"
:
\"
$fulldomain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
_info
"Adding record"
if
_uno_rest POST
"my/products/
$h
/dns/records"
"{
\"
name
\"
:
\"
$fulldomain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
if
_contains
"
$response
"
"
\"
status
\"
: 200"
>
/dev/null
;
then
_info
"Added, OK"
return
0
else
_err
"Add txt record error."
return
1
fi
fi
_err
"Add txt record error."
else
_info
"Updating record"
record_line_number
=
$(
echo
"
$response
"
|
grep
-n
"
$_sub_domain
"
|
cut
-d
:
-f
1
)
record_line_number
=
$(
_math
"
$record_line_number
"
- 1
)
record_id
=
$(
echo
"
$response
"
| _head_n
"
$record_line_number
"
| _tail_n 1 1 | _egrep_o
"[0-9]{1,}"
)
_debug
"record_id"
"
$record_id
"
_uno_rest PUT
"my/products/
$h
/dns/records/
$record_id
"
"{
\"
name
\"
:
\"
$fulldomain
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
data
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
if
_contains
"
$response
"
"
\"
status
\"
: 200"
>
/dev/null
;
then
if
_contains
"
$response
"
"
\"
status
\"
: 200"
>
/dev/null
;
then
_info
"
Updat
ed, OK"
_info
"
Add
ed, OK"
return
0
return
0
else
_err
"Add txt record error."
return
1
fi
fi
_err
"Update error"
return
1
fi
fi
}
}
...
@@ -122,23 +104,24 @@ dns_unoeuro_rm() {
...
@@ -122,23 +104,24 @@ dns_unoeuro_rm() {
if
!
_contains
"
$response
"
"
$_sub_domain
"
;
then
if
!
_contains
"
$response
"
"
$_sub_domain
"
;
then
_info
"Don't need to remove."
_info
"Don't need to remove."
else
else
record_line_number
=
$(
echo
"
$response
"
|
grep
-n
"
$_sub_domain
"
|
cut
-d
:
-f
1
)
for
record_line_number
in
$(
echo
"
$response
"
|
grep
-n
"
$_sub_domain
"
|
cut
-d
:
-f
1
)
;
do
record_line_number
=
$(
_math
"
$record_line_number
"
- 1
)
record_line_number
=
$(
_math
"
$record_line_number
"
- 1
)
record_id
=
$(
echo
"
$response
"
| _head_n
"
$record_line_number
"
| _tail_n 1 1 | _egrep_o
"[0-9]{1,}"
)
_debug
"record_line_number"
"
$record_line_number
"
_debug
"record_id"
"
$record_id
"
record_id
=
$(
echo
"
$response
"
| _head_n
"
$record_line_number
"
| _tail_n 1 1 | _egrep_o
"[0-9]{1,}"
)
_debug
"record_id"
"
$record_id
"
if
[
-z
"
$record_id
"
]
;
then
_err
"Can not get record id to remove."
if
[
-z
"
$record_id
"
]
;
then
return
1
_err
"Can not get record id to remove."
fi
return
1
fi
if
!
_uno_rest DELETE
"my/products/
$h
/dns/records/
$record_id
"
;
then
if
!
_uno_rest DELETE
"my/products/
$h
/dns/records/
$record_id
"
;
then
_err
"Delete record error."
_err
"Delete record error."
return
1
return
1
fi
fi
_contains
"
$response
"
"
\"
status
\"
: 200"
_contains
"
$response
"
"
\"
status
\"
: 200"
done
fi
fi
}
}
#################### Private functions below ##################################
#################### Private functions below ##################################
...
...
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