Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
certbot-dnspod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
certbot-dnspod
Commits
db301385
Commit
db301385
authored
Dec 01, 2019
by
tengattack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compatibility for lexicon 2.x and 3.x
parent
0cb2e597
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
certbot_dns_dnspod/dns_dnspod.py
certbot_dns_dnspod/dns_dnspod.py
+40
-0
No files found.
certbot_dns_dnspod/dns_dnspod.py
View file @
db301385
...
...
@@ -2,6 +2,8 @@
import
logging
import
zope.interface
from
requests.exceptions
import
HTTPError
from
lexicon.providers
import
dnspod
from
certbot
import
errors
...
...
@@ -75,6 +77,44 @@ class _DNSPodLexiconClient(dns_common_lexicon.LexiconClient):
'ttl'
:
ttl
,
})
def
_find_domain_id
(
self
,
domain
):
"""
Find the domain_id for a given domain.
Rewrite certbot/plugins/dns_common_lexicon.py to ensure compatibility
for Lexicon 2.x and 3.x
:param str domain: The domain for which to find the domain_id.
:raises errors.PluginError: if the domain_id cannot be found.
"""
domain_name_guesses
=
dns_common
.
base_domain_name_guesses
(
domain
)
for
domain_name
in
domain_name_guesses
:
try
:
if
hasattr
(
self
.
provider
,
'options'
):
# For Lexicon 2.x
self
.
provider
.
options
[
'domain'
]
=
domain_name
else
:
# For Lexicon 3.x
self
.
provider
.
domain
=
domain_name
self
.
provider
.
authenticate
()
return
# If `authenticate` doesn't throw an exception, we've found the right name
except
HTTPError
as
e
:
result
=
self
.
_handle_http_error
(
e
,
domain_name
)
if
result
:
raise
result
except
Exception
as
e
:
# pylint: disable=broad-except
result
=
self
.
_handle_general_error
(
e
,
domain_name
)
if
result
:
raise
result
raise
errors
.
PluginError
(
'Unable to determine zone identifier for {0} using zone names: {1}'
.
format
(
domain
,
domain_name_guesses
))
def
_handle_http_error
(
self
,
e
,
domain_name
):
hint
=
None
if
str
(
e
)
.
startswith
(
'400 Client Error:'
):
...
...
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