Skip to content

Commit

Permalink
Handle project not configured as a workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
x4v13r64 committed Sep 29, 2020
1 parent a8d3c48 commit 577c233
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ScoutSuite/providers/gcp/facade/stackdrivermonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


class StackdriverMonitoringFacade:
# TODO find a way to skip the project if it's not configured as a stackdriver workspace

def get_uptime_client(self):
client_info = ClientInfo(user_agent=get_user_agent())
Expand All @@ -24,7 +25,8 @@ async def get_uptime_checks(self, project_id: str):
name = client.project_path(project_id)
return await run_concurrently(lambda: [r for r in client.list_uptime_check_configs(name)])
except Exception as e:
print_exception(f'Failed to retrieve uptime checks: {e}')
if 'is not a workspace' not in e.message and '404' not in str(e):
print_exception(f'Failed to retrieve uptime checks: {e}')
return []

async def get_alert_policies(self, project_id: str):
Expand All @@ -33,5 +35,6 @@ async def get_alert_policies(self, project_id: str):
name = client.project_path(project_id)
return await run_concurrently(lambda: [r for r in client.list_alert_policies(name)])
except Exception as e:
print_exception(f'Failed to retrieve alert policies: {e}')
if 'is not a workspace' not in e.message and '404' not in str(e):
print_exception(f'Failed to retrieve alert policies: {e}')
return []

0 comments on commit 577c233

Please sign in to comment.