[no-relnote] Migrate to urfave v3

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This commit is contained in:
Carlos Eduardo Arango Gutierrez
2025-06-25 15:39:37 +02:00
parent ced79e51ed
commit 1676931fe0
151 changed files with 7200 additions and 19290 deletions

View File

@@ -20,13 +20,14 @@ package disabledevicenodemodification
import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"io"
"os"
"strings"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v3"
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
"github.com/NVIDIA/nvidia-container-toolkit/internal/oci"
@@ -47,11 +48,11 @@ func NewCommand(logger logger.Interface) *cli.Command {
c := cli.Command{
Name: "disable-device-node-modification",
Usage: "Ensure that the /proc/driver/nvidia/params file present in the container does not allow device node modifications.",
Before: func(c *cli.Context) error {
return validateFlags(c, &cfg)
Before: func(ctx context.Context, cmd *cli.Command) (context.Context, error) {
return ctx, validateFlags(cmd, &cfg)
},
Action: func(c *cli.Context) error {
return run(c, &cfg)
Action: func(ctx context.Context, cmd *cli.Command) error {
return run(ctx, cmd, &cfg)
},
}
@@ -67,11 +68,11 @@ func NewCommand(logger logger.Interface) *cli.Command {
return &c
}
func validateFlags(c *cli.Context, cfg *options) error {
func validateFlags(c *cli.Command, cfg *options) error {
return nil
}
func run(_ *cli.Context, cfg *options) error {
func run(ctx context.Context, cmd *cli.Command, cfg *options) error {
modifiedParamsFileContents, err := getModifiedNVIDIAParamsContents()
if err != nil {
return fmt.Errorf("failed to get modified params file contents: %w", err)