Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes on Network Dashboard cloud function code #1218

Merged
merged 6 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions blueprints/cloud-operations/network-dashboard/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ def main_cf_pubsub(event, context):
help='Load JSON resources from file, skips init and discovery.')
@click.option('--debug-plugin',
help='Run only core and specified timeseries plugin.')
@click.option('--debug', is_flag=True, default=False,
help='Turn on debug logging.')
def main(discovery_root, monitoring_project, project=None, folder=None,
custom_quota_file=None, dump_file=None, load_file=None,
debug_plugin=None):
debug_plugin=None, debug=False):
'CLI entry point.'
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.INFO if not debug else logging.DEBUG)
if discovery_root.partition('/')[0] not in ('folders', 'organizations'):
raise SystemExit('Invalid discovery root.')
descriptors = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _handle_resource(resources, asset_type, data):
# derive parent type and id and skip if parent is not within scope
parent_data = _get_parent(data['parent'], resources)
if not parent_data:
LOGGER.info(f'{resource["self_link"]} outside perimeter')
LOGGER.debug(f'{resource["self_link"]} outside perimeter')
LOGGER.debug([
resources['organization'], resources['folders'],
resources['projects:number']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def _handle_discovery(resources, response):
self_link = part.get('selfLink')
if not self_link:
logging.warn('invalid quota response')
continue
self_link = self_link.split('/')
if kind == 'compute#project':
project_id = self_link[-1]
Expand Down