Skip to content

Commit 6273cd1

Browse files
Modified code based on Review comments.
1 parent a86d393 commit 6273cd1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/sonic-config-engine/sonic-cfggen

+3-3
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ def main():
244244
print(template.render(data))
245245

246246
if args.var_json != None:
247-
try :
247+
if not data.has_key(args.var_json):
248+
print("{}")
249+
else:
248250
print(json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder))
249-
except KeyError:
250-
return
251251

252252
if args.write_to_db:
253253
configdb = ConfigDBConnector(**db_kwargs)

0 commit comments

Comments
 (0)