mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
util: use context.Context for logging in ExecCommand
All calls to util.ExecCommand() now pass the context.Context. In some cases this is not possible or needed, and util.ExecCommand() will not log the command. This should make debugging easier when command executions fail. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
bb4f1c7c9d
commit
ddac66d76b
@ -31,12 +31,12 @@ import (
|
||||
type volumeID string
|
||||
|
||||
func execCommandErr(ctx context.Context, program string, args ...string) error {
|
||||
_, _, err := util.ExecCommand(program, args...)
|
||||
_, _, err := util.ExecCommand(ctx, program, args...)
|
||||
return err
|
||||
}
|
||||
|
||||
func execCommandJSON(ctx context.Context, v interface{}, program string, args ...string) error {
|
||||
stdout, _, err := util.ExecCommand(program, args...)
|
||||
stdout, _, err := util.ExecCommand(ctx, program, args...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ func getVolumeRootPathCephDeprecated(volID volumeID) string {
|
||||
|
||||
func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, cr *util.Credentials, volID volumeID) (string, error) {
|
||||
stdout, stderr, err := util.ExecCommand(
|
||||
ctx,
|
||||
"ceph",
|
||||
"fs",
|
||||
"subvolume",
|
||||
|
@ -167,7 +167,7 @@ func mountFuse(ctx context.Context, mountPoint string, cr *util.Credentials, vol
|
||||
args = append(args, "--client_mds_namespace="+volOptions.FsName)
|
||||
}
|
||||
|
||||
_, stderr, err := util.ExecCommand("ceph-fuse", args[:]...)
|
||||
_, stderr, err := util.ExecCommand(ctx, "ceph-fuse", args[:]...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user