修复连接jms有重定向,报错KeyError: '未分组'的问题

pull/122/head
starsliao 2023-08-10 16:54:26 +08:00
parent 6fdb143f7d
commit 09568620c2
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,8 @@ def create_node(jms_url,headers,now,node_id,cloud,account):
for k,v in cloud_group_dict.items():
if v not in [i['value'] for i in jms_node_list]:
response = requests.request("POST", node_url, headers=headers, data = json.dumps({'value': v}))
if response.status_code != 201:
logger.error(f' 【JMS】创建分组失败可能的原因JumpServer URL 有重定向,请使用直连地址。')
logger.debug(f' 【JMS】新增组===>{v},{response.status_code}')
reget_node_list = requests.request("GET", node_url, headers=headers).json()
new_node_dict = {i['value']:i['id'] for i in reget_node_list}