@@ -24,7 +24,6 @@ import (
2424 "path/filepath"
2525 "strings"
2626
27- log "github.com/sirupsen/logrus"
2827 "github.com/urfave/cli/v2"
2928 "tags.cncf.io/container-device-interface/pkg/cdi"
3029 "tags.cncf.io/container-device-interface/pkg/parser"
@@ -44,8 +43,6 @@ const (
4443
4544 nvidiaContainerToolkitConfigSource = "/etc/nvidia-container-runtime/config.toml"
4645 configFilename = "config.toml"
47-
48- toolkitPidFilename = "toolkit.pid"
4946)
5047
5148type Options struct {
@@ -257,33 +254,6 @@ func ValidateOptions(opts *Options, toolkitRoot string) error {
257254 return nil
258255}
259256
260- // TryDelete attempts to remove the specified toolkit folder.
261- // A toolkit.pid file -- if present -- is skipped.
262- func TryDelete (cli * cli.Context , toolkitRoot string ) error {
263- log .Infof ("Attempting to delete NVIDIA container toolkit from '%v'" , toolkitRoot )
264-
265- contents , err := os .ReadDir (toolkitRoot )
266- if err != nil && errors .Is (err , os .ErrNotExist ) {
267- return nil
268- } else if err != nil {
269- return fmt .Errorf ("failed to read the contents of %v: %w" , toolkitRoot , err )
270- }
271-
272- for _ , content := range contents {
273- if content .Name () == toolkitPidFilename {
274- continue
275- }
276- name := filepath .Join (toolkitRoot , content .Name ())
277- if err := os .RemoveAll (name ); err != nil {
278- log .Warningf ("could not remove %v: %v" , name , err )
279- }
280- }
281- if err := os .RemoveAll (toolkitRoot ); err != nil {
282- log .Warningf ("could not remove %v: %v" , toolkitRoot , err )
283- }
284- return nil
285- }
286-
287257// Install installs the components of the NVIDIA container toolkit.
288258// Any existing installation is removed.
289259func Install (cli * cli.Context , opts * Options , sourceRoot string , toolkitRoot string ) error {
0 commit comments