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
9d448a42
Unverified
Commit
9d448a42
authored
Feb 15, 2021
by
neil
Committed by
GitHub
Feb 15, 2021
Browse files
Merge pull request #3409 from eastonman/master
DNSAPI, Huaweicloud DNS: Add error handling
parents
bf8c3370
31f65b89
Changes
2
Hide whitespace changes
Inline
Side-by-side
.github/workflows/DNS.yml
View file @
9d448a42
...
@@ -184,7 +184,7 @@ jobs:
...
@@ -184,7 +184,7 @@ jobs:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Clone acmetest
-
name
:
Clone acmetest
run
:
cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
run
:
cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
-
uses
:
vmactions/freebsd-vm@v0.
0.7
-
uses
:
vmactions/freebsd-vm@v0.
1.2
with
:
with
:
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
prepare
:
pkg install -y socat curl
prepare
:
pkg install -y socat curl
...
@@ -223,7 +223,7 @@ jobs:
...
@@ -223,7 +223,7 @@ jobs:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Clone acmetest
-
name
:
Clone acmetest
run
:
cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
run
:
cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
-
uses
:
vmactions/solaris-vm@v0.0.
1
-
uses
:
vmactions/solaris-vm@v0.0.
3
with
:
with
:
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
envs
:
'
TEST_DNS
TestingDomain
TEST_DNS_NO_WILDCARD
TEST_DNS_SLEEP
CASE
TEST_LOCAL
DEBUG
${{
secrets.TokenName1}}
${{
secrets.TokenName2}}
${{
secrets.TokenName3}}
${{
secrets.TokenName4}}
${{
secrets.TokenName5}}'
prepare
:
pkgutil -y -i socat curl
prepare
:
pkgutil -y -i socat curl
...
...
dnsapi/dns_huaweicloud.sh
View file @
9d448a42
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# HUAWEICLOUD_ProjectID
# HUAWEICLOUD_ProjectID
iam_api
=
"https://iam.myhuaweicloud.com"
iam_api
=
"https://iam.myhuaweicloud.com"
dns_api
=
"https://dns.ap-southeast-1.myhuaweicloud.com"
dns_api
=
"https://dns.ap-southeast-1.myhuaweicloud.com"
# Should work
######## Public functions #####################
######## Public functions #####################
...
@@ -29,16 +29,27 @@ dns_huaweicloud_add() {
...
@@ -29,16 +29,27 @@ dns_huaweicloud_add() {
return
1
return
1
fi
fi
unset
token
# Clear token
token
=
"
$(
_get_token
"
${
HUAWEICLOUD_Username
}
"
"
${
HUAWEICLOUD_Password
}
"
"
${
HUAWEICLOUD_ProjectID
}
"
)
"
token
=
"
$(
_get_token
"
${
HUAWEICLOUD_Username
}
"
"
${
HUAWEICLOUD_Password
}
"
"
${
HUAWEICLOUD_ProjectID
}
"
)
"
_debug2
"
${
token
}
"
if
[
-z
"
${
token
}
"
]
;
then
# Check token
_err
"dns_api(dns_huaweicloud): Error getting token."
return
1
fi
_debug
"Access token is:
${
token
}
"
unset
zoneid
zoneid
=
"
$(
_get_zoneid
"
${
token
}
"
"
${
fulldomain
}
"
)
"
zoneid
=
"
$(
_get_zoneid
"
${
token
}
"
"
${
fulldomain
}
"
)
"
_debug
"
${
zoneid
}
"
if
[
-z
"
${
zoneid
}
"
]
;
then
_err
"dns_api(dns_huaweicloud): Error getting zone id."
return
1
fi
_debug
"Zone ID is:
${
zoneid
}
"
_debug
"Adding Record"
_debug
"Adding Record"
_add_record
"
${
token
}
"
"
${
fulldomain
}
"
"
${
txtvalue
}
"
_add_record
"
${
token
}
"
"
${
fulldomain
}
"
"
${
txtvalue
}
"
ret
=
"
$?
"
ret
=
"
$?
"
if
[
"
${
ret
}
"
!=
"0"
]
;
then
if
[
"
${
ret
}
"
!=
"0"
]
;
then
_err
"dns_huaweicloud: Error adding record."
_err
"dns_
api(dns_
huaweicloud
)
: Error adding record."
return
1
return
1
fi
fi
...
@@ -69,12 +80,21 @@ dns_huaweicloud_rm() {
...
@@ -69,12 +80,21 @@ dns_huaweicloud_rm() {
return
1
return
1
fi
fi
unset
token
# Clear token
token
=
"
$(
_get_token
"
${
HUAWEICLOUD_Username
}
"
"
${
HUAWEICLOUD_Password
}
"
"
${
HUAWEICLOUD_ProjectID
}
"
)
"
token
=
"
$(
_get_token
"
${
HUAWEICLOUD_Username
}
"
"
${
HUAWEICLOUD_Password
}
"
"
${
HUAWEICLOUD_ProjectID
}
"
)
"
_debug2
"
${
token
}
"
if
[
-z
"
${
token
}
"
]
;
then
# Check token
_err
"dns_api(dns_huaweicloud): Error getting token."
return
1
fi
_debug
"Access token is:
${
token
}
"
unset
zoneid
zoneid
=
"
$(
_get_zoneid
"
${
token
}
"
"
${
fulldomain
}
"
)
"
zoneid
=
"
$(
_get_zoneid
"
${
token
}
"
"
${
fulldomain
}
"
)
"
_debug
"
${
zoneid
}
"
if
[
-z
"
${
zoneid
}
"
]
;
then
record_id
=
"
$(
_get_recordset_id
"
${
token
}
"
"
${
fulldomain
}
"
"
${
zoneid
}
"
)
"
_err
"dns_api(dns_huaweicloud): Error getting zone id."
_debug
"Record Set ID is:
${
record_id
}
"
return
1
fi
_debug
"Zone ID is:
${
zoneid
}
"
# Remove all records
# Remove all records
# Therotically HuaweiCloud does not allow more than one record set
# Therotically HuaweiCloud does not allow more than one record set
...
...
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