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

[config reload]: fix the condition for checking if system is starting #1766

Merged
merged 1 commit into from
Aug 17, 2021
Merged
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
12 changes: 6 additions & 6 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from . import vxlan
from . import plugins
from .config_mgmt import ConfigMgmtDPB
from . import mclag
from . import mclag

# mock masic APIs for unit test
try:
Expand Down Expand Up @@ -727,9 +727,9 @@ def _swss_ready():
else:
return False

def _system_running():
def _is_system_starting():
out = clicommon.run_command("sudo systemctl is-system-running", return_cmd=True)
return out.strip() == "running"
return out.strip() == "starting"

def interface_is_in_vlan(vlan_member_table, interface_name):
""" Check if an interface is in a vlan """
Expand Down Expand Up @@ -1233,7 +1233,7 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, disable_arp_cach
<filename> : Names of configuration file(s) to load, separated by comma with no spaces in between
"""
if not force and not no_service_restart:
if not _system_running():
if _is_system_starting():
click.echo("System is not up. Retry later or use -f to avoid system checks")
return

Expand Down Expand Up @@ -1491,10 +1491,10 @@ def load_port_config(config_db, port_config_path):
# Validate if the input is an array
if not isinstance(port_config_input, list):
raise Exception("Bad format: port_config is not an array")

if len(port_config_input) == 0 or 'PORT' not in port_config_input[0]:
raise Exception("Bad format: PORT table not exists")

port_config = port_config_input[0]['PORT']

# Ensure all ports are exist
Expand Down