File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
cmd/nvidia-ctk/hook/update-ldcache Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1717package ldcache
1818
1919import (
20+ "errors"
2021 "fmt"
2122 "os"
2223 "path/filepath"
@@ -56,6 +57,9 @@ func (m command) build() *cli.Command {
5657 c := cli.Command {
5758 Name : "update-ldcache" ,
5859 Usage : "Update ldcache in a container by running ldconfig" ,
60+ Before : func (c * cli.Context ) error {
61+ return m .validateFlags (c , & cfg )
62+ },
5963 Action : func (c * cli.Context ) error {
6064 return m .run (c , & cfg )
6165 },
@@ -71,7 +75,7 @@ func (m command) build() *cli.Command {
7175 Name : "ldconfig-path" ,
7276 Usage : "Specify the path to the ldconfig program" ,
7377 Destination : & cfg .ldconfigPath ,
74- DefaultText : "/sbin/ldconfig" ,
78+ Value : "/sbin/ldconfig" ,
7579 },
7680 & cli.StringFlag {
7781 Name : "container-spec" ,
@@ -83,6 +87,13 @@ func (m command) build() *cli.Command {
8387 return & c
8488}
8589
90+ func (m command ) validateFlags (c * cli.Context , cfg * options ) error {
91+ if cfg .ldconfigPath == "" {
92+ return errors .New ("ldconfig-path must be specified" )
93+ }
94+ return nil
95+ }
96+
8697func (m command ) run (c * cli.Context , cfg * options ) error {
8798 s , err := oci .LoadContainerState (cfg .containerSpec )
8899 if err != nil {
You can’t perform that action at this time.
0 commit comments