Skip to content

Commit

Permalink
feature: 放开对于AIX操作系统主机的安装限制(close TencentBlueKing#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Nov 15, 2021
1 parent 21e3fc0 commit 8b540e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 15 additions & 1 deletion apps/node_man/handlers/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def fetch_host_condition(self):
for index, item in enumerate(sublist):
col_map[index].add(item)

os_types_children = [{"name": constants.OS_CHN.get(os, os), "id": os} for os in os_types if os != ""]
os_types_children = self.fetch_os_type(os_types)
statuses_children = [
{"name": constants.PROC_STATUS_CHN.get(status, status), "id": status} for status in statuses if status != ""
]
Expand Down Expand Up @@ -437,6 +437,17 @@ def fetch_plugin_version_condition():

return plugin_result

@staticmethod
def fetch_os_type(os_types=constants.OsType):
os_types_children = []
for os_type in os_types:
if os_type == "":
continue
os_types_children.append(
{"id": os_type, "name": os_type if os_type == constants.OsType.AIX else os_type.capitalize()}
)
return os_types_children

def filter_condition(self, category):
"""
获取过滤条件
Expand All @@ -460,6 +471,9 @@ def filter_condition(self, category):
elif category == "plugin_host":
ret = self.fetch_plugin_host_condition()
return ret
elif category == "os_type":
ret = self.fetch_os_type()
return ret

def search(self, key):
"""
Expand Down
7 changes: 1 addition & 6 deletions apps/node_man/tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,7 @@ def test_fetch_plugin_list_condition_no_permission(self, *args, **kwargs):
{
"name": "操作系统",
"id": "os_type",
"children": [
{"id": "LINUX", "name": "Linux"},
{"id": "WINDOWS", "name": "Windows"},
{"id": "AIX", "name": "AIX"},
{"id": "SOLARIS", "name": "Solaris"},
],
"children": MetaHandler.fetch_os_type(),
},
)
self.assertEqual(
Expand Down

0 comments on commit 8b540e6

Please sign in to comment.