Conversation
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| printer.Logger.Info("Check if kernel module is still loaded.") | ||
| lsmodCmdArgs := fmt.Sprintf(`lsmod | cut -d' ' -f1 | grep -qx %q`, kmodName) | ||
| _, err = exec.Command("bash", "-c", lsmodCmdArgs).Output() //nolint:gosec // false positive | ||
| f, err := os.Open("/proc/modules") |
There was a problem hiding this comment.
Instead of using lsmod, manually scan /proc/modules.
| for i := 0; i < maxRmmodWait; i++ { | ||
| printer.Logger.Info("Kernel module is still loaded.") | ||
| printer.Logger.Info("Trying to unload it with 'rmmod'.") | ||
| if err = unix.DeleteModule(kmodName, 0); err == nil { |
There was a problem hiding this comment.
Instead of calling rmmod directly, just use unit.DeleteModule.
|
/close This is not worth the trouble IMHO. |
|
@FedeDP: Closed this PR. DetailsIn response to this:
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/test-infra repository. |
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area library
What this PR does / why we need it:
Small cleanups on top of #343 : use
unixgolang library where available.NOTE: reimplementing
insmodormodprobein go, instead of executing it through anexec.Commandis pretty convoluted since they do quite lot of things.See for example how is that implemented in this library: https://github.com/pmorjan/kmod/tree/master
Also, that library itself does not help us much since the job is still pretty complex.
I'd avoid the risk of introducing bugs reimplementing ourselves 2 of the most widely used bash utilities.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: