Two fixes: (#5191)

a) we should use get_platform() with new sonic_py-common package
b) In 201911 DB Connector is still using db id based constructor
as following PR https://github.com/Azure/sonic-buildimage/pull/4549
is not cherry-picked yet. So revert the change to use db is insatead of
db_name for now.

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
This commit is contained in:
abdosi 2020-08-14 18:10:20 -07:00 committed by GitHub
parent 13e260ba29
commit ef4d85855f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -8,8 +8,12 @@ from .logger import Logger
#
# Constants ====================================================================
#
# Redis DB information
REDIS_HOSTNAME = 'localhost'
REDIS_PORT = 6379
REDIS_TIMEOUT_MSECS = 0
EEPROM_MODULE_NAME = 'eeprom'
EEPROM_CLASS_NAME = 'board'
@ -17,9 +21,12 @@ EEPROM_CLASS_NAME = 'board'
# Helper functions =============================================================
#
def db_connect(db_name):
def db_connect(db):
from swsscommon import swsscommon
return swsscommon.DBConnector(db_name, REDIS_TIMEOUT_MSECS, True)
return swsscommon.DBConnector(db,
REDIS_HOSTNAME,
REDIS_PORT,
REDIS_TIMEOUT_MSECS)
#
# DaemonBase ===================================================================

View File

@ -248,7 +248,7 @@ def get_npu_id_from_name(npu_name):
def get_npu_device_id(npu_id):
platform = get_platform_info(get_machine_info())
platform = get_platform()
if not platform:
return None