Skip to content
Merged
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ def reload(filename):
command = "{} -j {} --write-to-db".format(SONIC_CFGGEN_PATH, filename)
run_command(command, display_cmd=True)
client.set(config_db.INIT_INDICATOR, True)
command = "{} -j {} -v \"DEVICE_METADATA['localhost']['hostname']\"".format(SONIC_CFGGEN_PATH, filename)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
p.wait()
hostname = p.communicate()[0].strip()
_change_hostname(hostname)
run_command("service interfaces-config restart", display_cmd=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lines 139-148 duplicates lines 195-204. Please create a separate function (e.g., restart_services()) to contain these lines so they only need to be modified in one place.

run_command("service ntp-config restart", display_cmd=True)
run_command("service rsyslog-config restart", display_cmd=True)
run_command("service swss restart", display_cmd=True)
run_command("service bgp restart", display_cmd=True)
run_command("service teamd restart", display_cmd=True)
run_command("service pmon restart", display_cmd=True)
run_command("service lldp restart", display_cmd=True)
run_command("service snmp restart", display_cmd=True)
run_command("service dhcp_relay restart", display_cmd=True)

@cli.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
Expand Down