Skip to content

Commit

Permalink
Small fixes on Network Dashboard cloud function code (#1218)
Browse files Browse the repository at this point in the history
* small fix on discovery compute quota file
decresed severity of log in discover cai from INFO to DEBUG

* remove else statement in condition

* add flag for debug logging

---------

Co-authored-by: Ludo <ludomagno@google.com>
  • Loading branch information
2 people authored and lcaggio committed May 5, 2023
1 parent a1de711 commit feed2db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
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

0 comments on commit feed2db

Please sign in to comment.