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

[load_minigraph] Reuse updategraph service to load minigraph in cli #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
20 changes: 3 additions & 17 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,9 @@ def load_mgmt_config(filename):
expose_value=False, prompt='Reload config from minigraph?')
def load_minigraph():
"""Reconfigure based on minigraph."""
config_db = ConfigDBConnector()
config_db.connect()
client = config_db.redis_clients[config_db.CONFIG_DB]
client.flushdb()
if os.path.isfile('/etc/sonic/init_cfg.json'):
command = "{} -H -m -j /etc/sonic/init_cfg.json --write-to-db".format(SONIC_CFGGEN_PATH)
else:
command = "{} -H -m --write-to-db".format(SONIC_CFGGEN_PATH)
run_command(command, display_cmd=True)
client.set(config_db.INIT_INDICATOR, 1)
run_command('pfcwd start_default', display_cmd=True)
if os.path.isfile('/etc/sonic/acl.json'):
run_command("acl-loader update full /etc/sonic/acl.json", display_cmd=True)
run_command("config qos reload", display_cmd=True)
#FIXME: After config DB daemon is implemented, we'll no longer need to restart every service.
_restart_services()
print "Please note setting loaded from minigraph will be lost after system reboot. To preserve setting, run `config save`."
run_command('sed -i "/enabled=/d" /etc/sonic/updategraph.conf', display_cmd=True)
run_command('echo enabled=reload_only /etc/sonic/updategraph.conf', display_cmd=True)
Copy link
Contributor

@jleveque jleveque Mar 16, 2018

Choose a reason for hiding this comment

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

I believe you're missing a redirect operator here (either echo enabled=reload_only > /etc/sonic/updategraph.conf or echo enabled=reload_only >> /etc/sonic/updategraph.conf). I believe you intended to append.

run_command('service updategraph restart', display_cmd=True)

#
# 'qos' group
Expand Down