@@ -1720,8 +1720,9 @@ def load_mgmt_config(filename):
1720
1720
expose_value = False , prompt = 'Reload config from minigraph?' )
1721
1721
@click .option ('-n' , '--no_service_restart' , default = False , is_flag = True , help = 'Do not restart docker services' )
1722
1722
@click .option ('-t' , '--traffic_shift_away' , default = False , is_flag = True , help = 'Keep device in maintenance with TSA' )
1723
+ @click .option ('-p' , '--golden_config_path' , help = 'The path of golden config file' )
1723
1724
@clicommon .pass_db
1724
- def load_minigraph (db , no_service_restart , traffic_shift_away ):
1725
+ def load_minigraph (db , no_service_restart , traffic_shift_away , golden_config_path ):
1725
1726
"""Reconfigure based on minigraph."""
1726
1727
log .log_info ("'load_minigraph' executing..." )
1727
1728
@@ -1794,13 +1795,20 @@ def load_minigraph(db, no_service_restart, traffic_shift_away):
1794
1795
# Keep device isolated with TSA
1795
1796
if traffic_shift_away :
1796
1797
clicommon .run_command ("TSA" , display_cmd = True )
1797
- if os .path .isfile (DEFAULT_GOLDEN_CONFIG_DB_FILE ):
1798
+ if golden_config_path or not golden_config_path and os .path .isfile (DEFAULT_GOLDEN_CONFIG_DB_FILE ):
1798
1799
log .log_warning ("Golden configuration may override System Maintenance state. Please execute TSC to check the current System mode" )
1799
1800
click .secho ("[WARNING] Golden configuration may override Traffic-shift-away state. Please execute TSC to check the current System mode" )
1800
1801
1801
1802
# Load golden_config_db.json
1802
- if os .path .isfile (DEFAULT_GOLDEN_CONFIG_DB_FILE ):
1803
- override_config_by (DEFAULT_GOLDEN_CONFIG_DB_FILE )
1803
+ if golden_config_path :
1804
+ if not os .path .isfile (golden_config_path ):
1805
+ click .secho ("Cannot find '{}'!" .format (golden_config_path ),
1806
+ fg = 'magenta' )
1807
+ raise click .Abort ()
1808
+ override_config_by (golden_config_path )
1809
+ else :
1810
+ if os .path .isfile (DEFAULT_GOLDEN_CONFIG_DB_FILE ):
1811
+ override_config_by (DEFAULT_GOLDEN_CONFIG_DB_FILE )
1804
1812
1805
1813
# We first run "systemctl reset-failed" to remove the "failed"
1806
1814
# status from all services before we attempt to restart them
0 commit comments