fix: discover scripts (#458)

Co-authored-by: wang-liang0615 <dhuwl0615@163.com>
This commit is contained in:
ivonGwy 2024-03-29 15:48:46 +08:00 committed by GitHub
parent d08827d086
commit 4232094aed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 74 additions and 73 deletions

View File

@ -428,20 +428,20 @@ const cmdb_zh = {
def unique_key(self):
"""
:return: 返回唯一属性的名字
:return: Returns the name of a unique attribute
"""
return
@staticmethod
def attributes():
"""
定义属性字段
:return: 返回属性字段列表, 列表项是(名称, 类型, 描述), 名称必须是英文
类型: String Integer Float Date DateTime Time JSON
例如:
Define attribute fields
:return: Returns a list of attribute fields. The list items are (name, type, description). The name must be in English.
type: String Integer Float Date DateTime Time JSON
For example:
return [
("ci_type", "String", "模型名称"),
("private_ip", "String", "内网IP, 多值逗号分隔")
("ci_type", "String", "CIType name"),
("private_ip", "String", "Internal IP, multiple values separated by commas")
]
"""
return []
@ -449,9 +449,10 @@ const cmdb_zh = {
@staticmethod
def run():
"""
执行入口, 返回采集的属性值
:return: 返回一个列表, 列表项是字典, 字典key是属性名称, value是属性值
例如:
Execution entry, returns collected attribute values
:return:
Returns a list, the list item is a dictionary, the dictionary key is the attribute name, and the value is the attribute value
For example:
return [dict(ci_type="server", private_ip="192.168.1.1")]
"""
return []
@ -462,7 +463,7 @@ const cmdb_zh = {
if isinstance(result, list):
print("AutoDiscovery::Result::{}".format(json.dumps(result)))
else:
print("ERROR: 采集返回必须是列表")
print("ERROR: The collection return must be a list")
`,
server: '物理机',
vserver: '虚拟机',