Skip to content

Commit

Permalink
Merge pull request #229 from smkent/replace-removesuffix-usage
Browse files Browse the repository at this point in the history
Replace `str.removesuffix` usage in domain_record module
  • Loading branch information
lgarber-akamai authored Nov 8, 2022
2 parents 7cb1bd0 + 2e21b3a commit 6775390
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/modules/domain_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ def __init__(self) -> None:

def _find_record(self, domain: Domain, name: str, rtype: str, target: str) \
-> Optional[DomainRecord]:
# We should strip the FQDN from the user-defined record name if defined.
suffix = '.' + domain.domain
search_name = name
if search_name.endswith(suffix):
search_name = search_name[:-len(suffix)]
try:
for record in domain.records:
# We should strip the FQDN from the user-defined record name
# if defined.
if record.name == name.removesuffix('.' + domain.domain) \
if record.name == search_name \
and record.type == rtype \
and record.target == target:
return record
Expand Down

0 comments on commit 6775390

Please sign in to comment.