[Admin Util] Do not write edge mapp file if no mappings found

The NSX-T Json schema validator requires mappings to be present with
at least one item. If no mappings are present therefore the JSON file
should not be presented at all.

Change-Id: I8c5721212291262e647202edb1c0bddb9efdf8ef
This commit is contained in:
Salvatore Orlando 2021-08-20 00:11:24 -07:00
parent 59d6c01238
commit e7a21d276b
1 changed files with 4 additions and 0 deletions

View File

@ -669,6 +669,10 @@ def build_edge_mapping_file(resource, event, trigger, **kwargs):
mappings.append(
{'v_edges': [edge_id],
'policy_gateway_name': router['id']})
if not mappings:
LOG.info("No edge mapping available. Not producing output file")
return
data = [{'name': 'dlr_edges_to_migrate',
'v_edges_to_policy_gateways_mappings': mappings}]
LOG.info(formatters.output_formatter(