Small fixes on Network Dashboard cloud function code (#1218)
* 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>
This commit is contained in:
parent
6ba0f8b0ba
commit
6aa0fde85b
|
@ -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 = []
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue