refactor(plugin : arch) 重构platform脚本的异常退出功能

This commit is contained in:
leimingsheng 2025-03-27 09:43:19 +08:00
parent 032b36ea7b
commit 48300473d9
3 changed files with 17 additions and 3 deletions

@ -121,7 +121,7 @@ conf_pre_check
parse_slot_name parse_slot_name
i2c_bus=`connect_i2c` i2c_bus=`connect_i2c`
if [ $? -ne 0 ];then if [ $i2c_bus -lt 0 ];then
$fmt_print "console" "Error" "An Error occured when build i2c connection with ${nic_type} ${slot_id}" $fmt_print "console" "Error" "An Error occured when build i2c connection with ${nic_type} ${slot_id}"
exit 1 exit 1
fi fi

@ -15,6 +15,13 @@ pca9548_channel=""
is_have_pca9641=0 is_have_pca9641=0
# An func to echo a error code and then exit
# @Param1 error code
throw_error(){
echo $1
exit 1
}
record_i2c_status(){ record_i2c_status(){
$fmt_print "log" "Info" "[platform_5280m7] Start record i2c configuration" $fmt_print "log" "Info" "[platform_5280m7] Start record i2c configuration"
$fmt_print "log" "Info" "Nic Type: $nic_type" $fmt_print "log" "Info" "Nic Type: $nic_type"
@ -89,7 +96,7 @@ get_pca9641_control(){
if [ "$res_build" != "0x87" ];then if [ "$res_build" != "0x87" ];then
$fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!" $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!"
exit 1 throw_error "-1"
fi fi
} }

@ -15,6 +15,13 @@ pca9548_channel=""
is_have_pca9641=0 is_have_pca9641=0
# An func to echo a error code and then exit
# @Param1 error code
throw_error(){
echo $1
exit 1
}
record_i2c_status(){ record_i2c_status(){
$fmt_print "log" "Info" "[platform_5688m7] Start record i2c configuration" $fmt_print "log" "Info" "[platform_5688m7] Start record i2c configuration"
$fmt_print "log" "Info" "Nic Type: $nic_type" $fmt_print "log" "Info" "Nic Type: $nic_type"
@ -83,7 +90,7 @@ get_pca9641_control(){
if [ "$res_build" != "0x87" ];then if [ "$res_build" != "0x87" ];then
$fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!" $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!"
exit 1 throw_error "-1"
fi fi
} }