已开启
“修复映射器检查工具” #1508
zjhhhzj创建于 8 天前
“修复映射器检查工具” #1508
已开启
zjhhhzj创建于 8 天前
5 个文件变更+101-18
Mconanfile.py+1-1文件内容审核中,请稍后刷新重试
@@ -45,11 +45,11 @@ class ErrorlogPrinter:
45 self.error_ruleinfo_table['6-3'] = 'AutoPagingEnabled只允许在redfish接口中配置'45 self.error_ruleinfo_table['6-3'] = 'AutoPagingEnabled只允许在redfish接口中配置'
46 46 
47 def get_relpath_under_rackmount(self, path):47 def get_relpath_under_rackmount(self, path):
48- start_index = path.find('interface_config')48+ start_indexes = [path.find(root) for root in ('interface_config', 'oem')]
49- if start_index != -1:49+ start_indexes = [index for index in start_indexes if index != -1]
50- return path[start_index:]50+ if not start_indexes:
51- else:
52 return ''51 return ''
52+ return path[min(start_indexes):]
53 53 
54 def default_error(self):54 def default_error(self):
55 return '未定义的Rule序号'55 return '未定义的Rule序号'
Mtools/mapper_check/MapperCheck.py+31-9文件内容审核中,请稍后刷新重试
@@ -35,13 +35,14 @@ rackmount
35 35 
36### 运行方法36### 运行方法
37检查工具脚本已集成至构建脚本`build.py`中,执行`python3 build.py`构建时会自动先运行检查工具。若检查失败报错,会终止构建;若无报错,则开始构建。37检查工具脚本已集成至构建脚本`build.py`中,执行`python3 build.py`构建时会自动先运行检查工具。若检查失败报错,会终止构建;若无报错,则开始构建。
38+通过Conan构建时,检查工具会根据`oem`选项同时扫描`oem/<oem>`下对应的映射配置。
38 39 
39### 文件结构40### 文件结构
40执行检查及构建时,请按照上方的文件结构,尽量不要做改动!!41执行检查及构建时,请按照上方的文件结构,尽量不要做改动!!
41 42 
42`build.py``mapper_check`文件下引入了`MapperCheck`模块,而`MapperCheck`模块检查时会依赖于`data_mapping_schema.json`语法检查配置文件,代码中规定了该配置文件的相对位置在`mapper_check`文件下,因此请勿移动`build.py``MapperCheck.py``data_mapping_schema.json`的位置。43`build.py``mapper_check`文件下引入了`MapperCheck`模块,而`MapperCheck`模块检查时会依赖于`data_mapping_schema.json`语法检查配置文件,代码中规定了该配置文件的相对位置在`mapper_check`文件下,因此请勿移动`build.py``MapperCheck.py``data_mapping_schema.json`的位置。
43 44 
44-同样的,在检查命令json配置、命令调用的插件、脚本合法性过程中,依赖于各组件`mapping_config`(cli的为`ipmcget`和`ipmcset`)下的配置文件、`plugins`下的插件和`script`下的脚本,而在代码中规定了这些文件的相对位都在`interface_config`下的各自组件下,因此请勿移动这些文件的相对位置。45+同样的,在检查命令json配置、命令调用的插件、脚本合法性过程中,依赖于各组件`mapping_config`(cli的为`ipmcget`和`ipmcset`)下的配置文件、`plugins`下的插件和`script`下的脚本。基础配位于`interface_config`下,OEM映射配置位于`oem/<oem>`下,请勿移动这些文件的相对位置。
45 46 
46此外,获取绝对位置时会搜索`/rackmount`所在位置,因此也请不要将代码移出`rackmount`仓。47此外,获取绝对位置时会搜索`/rackmount`所在位置,因此也请不要将代码移出`rackmount`仓。
47 48 
@@ -1069,9 +1069,69 @@
1069 },1069 },
1070 "ReqBody": {1070 "ReqBody": {
1071 "type": "object",1071 "type": "object",
1072- "items": {1072+ "properties": {
1073- "$ref": "#/definitions/PropertiesItem"1073+ "Name": {
1074- }1074+ "type": "string"
1075+ },
1076+ "Type": {
1077+ "oneOf": [
1078+ {
1079+ "type": "string"
1080+ },
1081+ {
1082+ "type": "array",
1083+ "items": {
1084+ "type": "string"
1085+ }
1086+ }
1087+ ]
1088+ },
1089+ "Required": {
1090+ "type": "boolean"
1091+ },
1092+ "Sensitive": {
1093+ "type": "boolean"
1094+ },
1095+ "LockdownAllow": {
1096+ "type": "boolean"
1097+ },
1098+ "Validator": {
1099+ "type": "array"
1100+ },
1101+ "minItems": {
1102+ "type": "integer"
1103+ },
1104+ "maxItems": {
1105+ "type": "integer"
1106+ },
1107+ "uniqueItems": {
1108+ "type": "boolean"
1109+ },
1110+ "Description": {
1111+ "type": "string"
1112+ },
1113+ "DataType": false,
1114+ "Properties": {
1115+ "type": "object",
1116+ "additionalProperties": {
1117+ "$ref": "#/definitions/ReqBody"
1118+ }
1119+ },
1120+ "Items": {
1121+ "oneOf": [
1122+ {
1123+ "$ref": "#/definitions/ReqBody"
1124+ },
1125+ {
1126+ "type": "array",
1127+ "items": {
1128+ "$ref": "#/definitions/ReqBody"
1129+ }
1130+ }
1131+ ]
1132+ }
1133+ },
1134+ "additionalProperties": false
1075 },1135 },
1076 "RspBody": {1136 "RspBody": {
1077 "oneOf": [1137 "oneOf": [