Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: 执行方案步骤引用命名空间变量,如果目标主机包含ipv6主机,Job任务卡住 #1687

Closed
wangyu096 opened this issue Jan 10, 2023 · 2 comments
Assignees
Labels
done 已上线到正式环境并验收通过 kind/bug 程序故障Bug,漏洞 stage/test Test environment in tencent has been deploy

Comments

@wangyu096
Copy link
Collaborator

Version / Branch / tag

3.7.x

出了什么问题?(What Happened?)
执行方案步骤内容:

#!/bin/bash

# job_import {{host}}
# job_import {{JOB_LAST_ALL}}
# job_import {{JOB_LAST_FAIL}}
# job_import {{JOB_NAMESPACE_ALL}}
# job_import {{JOB_NAMESPACE_self_value}}

echo ${host}
echo ${JOB_LAST_FAIL}
echo ${JOB_LAST_ALL}
echo ${JOB_NAMESPACE_self_value}
echo ${JOB_NAMESPACE_ALL}

主机包含ipv6地址,执行执行方案的时候,如果步骤里边使用JOB_NAMESPACE命名空间变量,后台报错

image

如何复现?(How to reproduce?)

见问题描述

预期结果(What you expect?)

  1. 不报错
  2. 输出的JOB_NAMESPACE_ALL 变量的值,ipv4地址优先
@wangyu096 wangyu096 added the kind/bug 程序故障Bug,漏洞 label Jan 10, 2023
@wangyu096 wangyu096 self-assigned this Jan 10, 2023
@wangyu096
Copy link
Collaborator Author

原因分析

由于主机不包含ipv4,但是程序处理中使用的是ipv4,造成代码报错

@wangyu096
Copy link
Collaborator Author

修改方案

  1. 后端使用hostId来表示命名空间变量的主机信息,并兼容老的历史数据使用ipv4的方式
  2. 前端需要配合后端修改,查询执行详情-变量的API, 需要传入hostId,并兼容ip的方式。原来这个API是根据主机ip来获取变量的,现在ipv6环境需要使用hostId,所以后端提供了一个新的API。然后为了兼容老的历史数据,使用ip查询的功能还不能直接下线,前端需要根据后端是否返回hostId,来决定调用哪个API

企业微信截图_d0536843-0543-469c-befc-9524b49771ee

企业微信截图_d0536843-0543-469c-befc-9524b49771ee

wangyu096 added a commit that referenced this issue Jan 11, 2023
bugfix: 执行方案步骤引用命名空间变量,如果目标主机包含ipv6主机,Job任务卡住 #1687
@bkjob-bot bkjob-bot added the stage/test Test environment in tencent has been deploy label Feb 15, 2023
@bkjob-bot bkjob-bot added the done 已上线到正式环境并验收通过 label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done 已上线到正式环境并验收通过 kind/bug 程序故障Bug,漏洞 stage/test Test environment in tencent has been deploy
Projects
None yet
Development

No branches or pull requests

2 participants