kubekey icon indicating copy to clipboard operation
kubekey copied to clipboard

fix: replace 'which' with exec.LookPath

Open microyahoo opened this issue 6 months ago • 5 comments

What type of PR is this?

/kind bug

What this PR does / why we need it:

当前通过 which 来判断 baseSoftware 是否存在的方式在下面情况下会表现错误: image 不应该通过是否包含 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.:


microyahoo avatar Jun 16 '25 07:06 microyahoo

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.

kubesphere-prow[bot] avatar Jun 16 '25 07:06 kubesphere-prow[bot]

Welcome @microyahoo! It looks like this is your first PR to kubesphere/kubekey 🎉

kubesphere-prow[bot] avatar Jun 16 '25 07:06 kubesphere-prow[bot]

image

microyahoo avatar Jun 16 '25 08:06 microyahoo

出现 /root/.bashrc: line 26: kubectl command not found 是因为 /root/.bashrc 中加入了 kubectl 相关的命令,执行任何命令应该都会报这个错,应该把 /root/.bashrc 中 kubectl 相关的命令删掉或者注释掉。

另外,如果换成 exec.LookPath,只能检查当前节点,远程ssh节点是检查不到的。

pixiake avatar Jun 20 '25 02:06 pixiake

hi @pixiake, 看起来最近的 CI 错误都和我之前合入的 PR 有关系,我也尝试修改了一下 github workflow,但是没有成功,能不能帮忙修复一下 CI 的问题,顺便帮忙 review 一下 PR,谢谢!

microyahoo avatar Jun 26 '25 15:06 microyahoo

@microyahoo 把这个commit合到你的分支中重新提交试试看 https://github.com/kubesphere/kubekey/commit/91979ab818c15b383df51f03d2ed06ad962c6e51

pixiake avatar Jun 27 '25 06:06 pixiake

@microyahoo 把这个commit合到你的分支中重新提交试试看 91979ab

hi @pixiake, rebase 之后 golangci-lint 还是有点问题,能帮忙再看一下吗?谢谢

microyahoo avatar Jul 01 '25 14:07 microyahoo

/lgtm /approve

pixiake avatar Jul 03 '25 04:07 pixiake

LGTM label has been added.

Git tree hash: cf65978844942f14ebfa7f19ccf1c9ef5b06b0b0

kubesphere-prow[bot] avatar Jul 03 '25 04:07 kubesphere-prow[bot]

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kubesphere-prow[bot] avatar Jul 03 '25 04:07 kubesphere-prow[bot]