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

Fix sonic-installer and 'show version' command crash when database docker not running issue. #2183

Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
'toposort==1.6',
'www-authenticate==0.9.2',
'xmltodict==0.12.0',
'lazy-object-proxy',
],
setup_requires= [
'pytest-runner',
Expand Down
5 changes: 3 additions & 2 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re

import click
import lazy_object_proxy
import utilities_common.cli as clicommon
from sonic_py_common import multi_asic
import utilities_common.multi_asic as multi_asic_util
Expand Down Expand Up @@ -126,8 +127,8 @@ def run_command(command, display_cmd=False, return_cmd=False):
if rc != 0:
sys.exit(rc)

# Global class instance for SONiC interface name to alias conversion
iface_alias_converter = clicommon.InterfaceAliasConverter()
# Lazy global class instance for SONiC interface name to alias conversion
iface_alias_converter = lazy_object_proxy.Proxy(lambda: clicommon.InterfaceAliasConverter())

#
# Display all storm-control data
Expand Down
5 changes: 3 additions & 2 deletions utilities_common/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import click
import json
import lazy_object_proxy
import netaddr

from natsort import natsorted
Expand Down Expand Up @@ -183,8 +184,8 @@ def alias_to_name(self, interface_alias):
# interface_alias not in port_dict. Just return interface_alias
return interface_alias if sub_intf_sep_idx == -1 else interface_alias + VLAN_SUB_INTERFACE_SEPARATOR + vlan_id

# Global class instance for SONiC interface name to alias conversion
iface_alias_converter = InterfaceAliasConverter()
# Lazy global class instance for SONiC interface name to alias conversion
iface_alias_converter = lazy_object_proxy.Proxy(lambda: InterfaceAliasConverter())

def get_interface_naming_mode():
mode = os.getenv('SONIC_CLI_IFACE_MODE')
Expand Down