[ruijie] Fix show version error info (#7541)

Fix following crash in `show version`:

```
Traceback (most recent call last):
  File "/usr/local/bin/decode-syseeprom", line 32, in instantiate_eeprom_object
    eeprom = sonic_platform.platform.Platform().get_chassis().get_eeprom()
AttributeError: module 'sonic_platform' has no attribute 'platform'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/decode-syseeprom", line 262, in <module>
    sys.exit(main())
  File "/usr/local/bin/decode-syseeprom", line 244, in main
    print_serial(use_db)
  File "/usr/local/bin/decode-syseeprom", line 169, in print_serial
    eeprom = instantiate_eeprom_object()
  File "/usr/local/bin/decode-syseeprom", line 34, in instantiate_eeprom_object
    log.log_error('Failed to obtain EEPROM object due to {}'.format(repr(e)))
NameError: name 'log' is not defined
```

Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
This commit is contained in:
pettershao-ragilenetworks 2021-05-07 05:53:20 +08:00 committed by GitHub
parent 06377f0f9a
commit 8ceec5c843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -1 +1,2 @@
__all__ = ["platform", "chassis", "fan", "psu", "sfp", "thermal", "common"]
from sonic_platform import platform

View File

@ -9,6 +9,7 @@ SUB_BUILD_DIR = $(PWD)/build
DIR_KERNEL_SRC = $(PWD)/modules
SCRIPT_DIR = $(PWD)/script
SERVICE_DIR = $(PWD)/service
DEPMOD_CONF_DIR = $(PWD)/depmod_conf
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
export KBUILD_EXTRA_SYMBOLS
@ -17,6 +18,7 @@ INSTALL_MODULE_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)
INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system
INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.7/dist-packages
INSTALL_DEPMOD_CONF = $(SUB_BUILD_DIR)/etc/depmod.d
all:
$(MAKE) -C $(KERNEL_SRC)/build M=$(DIR_KERNEL_SRC) modules
@ -27,6 +29,8 @@ all:
@if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi
@if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR2} ;fi
cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_MODULE_DIR)
@if [ ! -d ${INSTALL_DEPMOD_CONF} ]; then mkdir -p ${INSTALL_DEPMOD_CONF} ;fi
cp -r $(DEPMOD_CONF_DIR)/* $(INSTALL_DEPMOD_CONF)
cp -r $(SCRIPT_DIR)/* $(INSTALL_SCRIPT_DIR)
cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR)
@if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi

View File

@ -0,0 +1,4 @@
# depmod.conf
#
# override default search ordering for kmod packaging
search updates extra external built-in weak-updates