fix: replace 'which' with exec.LookPath
What type of PR is this?
/kind bug
What this PR does / why we need it:
当前通过 which 来判断 baseSoftware 是否存在的方式在下面情况下会表现错误:
不应该通过是否包含 not found 来判断 software 是否存在,而应该使用系统调用。
Which issue(s) this PR fixes:
Fixes #
Special notes for reviewers:
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.:
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Welcome @microyahoo! It looks like this is your first PR to kubesphere/kubekey 🎉
出现 /root/.bashrc: line 26: kubectl command not found 是因为 /root/.bashrc 中加入了 kubectl 相关的命令,执行任何命令应该都会报这个错,应该把 /root/.bashrc 中 kubectl 相关的命令删掉或者注释掉。
另外,如果换成 exec.LookPath,只能检查当前节点,远程ssh节点是检查不到的。
hi @pixiake, 看起来最近的 CI 错误都和我之前合入的 PR 有关系,我也尝试修改了一下 github workflow,但是没有成功,能不能帮忙修复一下 CI 的问题,顺便帮忙 review 一下 PR,谢谢!
@microyahoo 把这个commit合到你的分支中重新提交试试看 https://github.com/kubesphere/kubekey/commit/91979ab818c15b383df51f03d2ed06ad962c6e51
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
/lgtm /approve
LGTM label has been added.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: microyahoo, pixiake
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [pixiake]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment