Skip to content

Commit

Permalink
chore: ran black
Browse files Browse the repository at this point in the history
  • Loading branch information
VKotwicki committed Jul 21, 2023
1 parent 6259ebb commit 388166a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions providers/googlecloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

description = "Scan multiple domains by fetching them from Google Cloud. Requires GOOGLE_APPLICATION_CREDENTIALS environment variable."


def get_records(zone):
records = []
records = []

try:
records = zone.list_resource_record_sets(max_results=None, page_token=None)
except Exception as e:
logging.critical(
f"Failed to fetch zone records. {e}"
)
logging.critical(f"Failed to fetch zone records. {e}")
return []

return list(records)
Expand Down Expand Up @@ -57,9 +56,10 @@ def get_zones(client):
logging.debug(f"Got {len(zones)} zones from Google Cloud")
if len(zones) == 0:
return []

return zones


def fetch_domains(project_id, **args):
domains = []

Expand All @@ -74,9 +74,13 @@ def fetch_domains(project_id, **args):
try:
records = get_records(zone)
except:
logging.warning(f"Could not retrieve records for Google Cloud zone '{zone.dns_name}'")
logging.warning(
f"Could not retrieve records for Google Cloud zone '{zone.dns_name}'"
)
records = []
logging.debug(f"Got {len(records)} records for Google Cloud zone '{zone.dns_name}'")
logging.debug(
f"Got {len(records)} records for Google Cloud zone '{zone.dns_name}'"
)

for domain in convert_records_to_domains(records):
domains.append(domain)
Expand Down

0 comments on commit 388166a

Please sign in to comment.