From d39545382831e59739c7dfb8475d388027b7aa71 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Tue, 1 Oct 2019 14:07:47 +1300 Subject: [PATCH] Add DP key to InvalidConfigError exceptions. --- faucet/config_parser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/faucet/config_parser.py b/faucet/config_parser.py index a2660dc193..956af2ac58 100644 --- a/faucet/config_parser.py +++ b/faucet/config_parser.py @@ -187,8 +187,14 @@ def _parse_dp(dp_key, dp_conf, acls_conf, meters_conf, routers_conf, vlans_conf) def _dp_parser_v2(dps_conf, acls_conf, meters_conf, routers_conf, vlans_conf, meta_dp_state): - dps = [_parse_dp(dp_key, dp_conf, acls_conf, meters_conf, routers_conf, vlans_conf) - for dp_key, dp_conf in dps_conf.items()] + dps = [] + for dp_key, dp_conf in dps_conf.items(): + try: + dps.append(_parse_dp( + dp_key, dp_conf, acls_conf, meters_conf, routers_conf, vlans_conf)) + except InvalidConfigError as err: + raise InvalidConfigError('DP %s: %s' % (dp_key, err)) + for dp in dps: dp.finalize_config(dps) for dp in dps: