Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-cfggen]: Fix minigraph DhcpRelays parsing issue #2154

Merged
merged 4 commits into from
Oct 16, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def parse_dpg(dpg, hname):

# If this VLAN requires a DHCP relay agent, it will contain a <DhcpRelays> element
# containing a list of DHCP server IPs
if vintf.find(str(QName(ns, "DhcpRelays"))) is not None:
if vintf.find(str(QName(ns, "DhcpRelays"))) is not None and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line break in the middle of if statement requires parentheses around entire statement or backslash to escape newline. This is the cause of the check build failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right. Refactored

vintf.find(str(QName(ns, "DhcpRelays"))).text is not None:
vintfdhcpservers = vintf.find(str(QName(ns, "DhcpRelays"))).text
vdhcpserver_list = vintfdhcpservers.split(';')
vlan_attributes['dhcp_servers'] = vdhcpserver_list
Expand Down