redfish接口定制的脚本中调用string库函数报错

问题描述

25.12 LTS SP2的代码加上JD定制后Processors、Memory相关redfish接口异常。

1、Processors

日志

2、Memory

定制config.json中相关配置

日志

求助

不管是string.match还是string.lower,在通用的redfish接口及JD仓都有大量的使用,且都是对同样类型的数据进行处理,目前只发现这两个接口有异常,请问这可能是什么原因导致的,要怎么定位?

谢谢!

环境信息

  • 操作系统:[]

  • 软件版本:[25.12 LTS SP2]、[JD组件:1.80.63]

  • 硬件配置:[920BS]

这个问题是由于多层级定制中复杂属性,即Steps中的实现并非直接替换,而是追加的形式,因此JD仓中的写法定制完之后相当于如下形式:
“GetNode”: {
“Input”: “${Uri/memoryid}”,
“Steps”: [
{
“Type”: “Script”,
“Formula”: “local id = string.lower(Input) local a, b = string.match(id, ‘^(cpuboard%d+)(.*)’) return {a, b}”
},
{
“Type”: “Script”,
“Formula”: “local a = ‘cpuboard1’ local b = string.lower(Input) return {a, b}”
}
]
}
即第二个Script的Input拿的是第一个Script的结果{a, b},因此第二个Script的string.lower执行报错
修改方法为:在当前实现的定制中先通过Remove方法将rackmount仓中该接口下的GetNode删掉,这样才能在执行完Modify方法后达成如下形式的定制:
“GetNode”: {
“Input”: “${Uri/memoryid}”,
“Steps”: [
{
“Type”: “Script”,
“Formula”: “local a = ‘cpuboard1’ local b = string.lower(Input) return {a, b}”
}
]
}

第一个问题也是类似的,需要通过Remove删掉原本rackmount中的实现才能执行Modify