Skip to content

Commit

Permalink
[config]: Add file check before load_minigraph command
Browse files Browse the repository at this point in the history
This will prevent config load_minigraph fail during the
middle of the command execution.

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
  • Loading branch information
Shu0T1an ChenG committed Aug 27, 2018
1 parent c14d917 commit 7b66e0d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import mlnx

SONIC_CFGGEN_PATH = "sonic-cfggen"
SONIC_MINIGRAPH_PATH = "/etc/sonic/minigraph.xml"

#
# Helper functions
Expand Down Expand Up @@ -321,7 +322,11 @@ def load_mgmt_config(filename):
expose_value=False, prompt='Reload config from minigraph?')
def load_minigraph():
"""Reconfigure based on minigraph."""
#Stop services before config push
# Check /etc/sonic/minigraph.xml file exists
if not os.path.isfile(SONIC_MINIGRAPH_PATH):
exit("No minigraph.xml file found under folder /etc/sonic")

# Stop services before config push
_stop_services()

config_db = ConfigDBConnector()
Expand Down

0 comments on commit 7b66e0d

Please sign in to comment.