[updategraph] Use empty configuration when DHCP graphurl option is missing (#2185)

This commit is contained in:
Taoyu Li 2018-10-29 12:16:00 -07:00 committed by GitHub
parent c64f105a3e
commit 2897686de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 10 deletions

View File

@ -3,7 +3,7 @@ case $reason in
if [ -n "$new_minigraph_url" ]; then
echo $new_minigraph_url > /tmp/dhcp_graph_url
else
echo "default" > /tmp/dhcp_graph_url
echo "N/A" > /tmp/dhcp_graph_url
fi
if [ -n "$new_acl_url" ]; then
echo $new_acl_url > /tmp/dhcp_acl_url

View File

@ -82,16 +82,8 @@ if [ "$src" = "dhcp" ]; then
sleep 1
done
if [ "`cat /tmp/dhcp_graph_url`" = "default" ]; then
echo "No graph_url option in DHCP response. Skipping graph update and using existing minigraph."
if [ "$dhcp_as_static" = "true" ]; then
sed -i "/enabled=/d" /etc/sonic/updategraph.conf
echo "enabled=false" >> /etc/sonic/updategraph.conf
fi
exit 0
fi
if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then
echo "'N/A' found in DHCP response. Skipping graph update and generating an empty configuration."
echo "No graph_url option in DHCP response. Skipping graph update and generating an empty configuration."
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
if [ -f /etc/sonic/minigraph.xml ]; then
sonic-cfggen -H -m /etc/sonic/minigraph.xml --preset empty > /tmp/device_meta.json