pkg/skel: improve error message for missing CNI_COMMAND env var

This makes the error message for missing CNI_COMMAND consistent with
that of other required environment variables.
This commit is contained in:
Gabe Rosenhouse
2016-07-13 22:54:22 -04:00
parent f2b6ec0375
commit eda79f7645
2 changed files with 7 additions and 5 deletions

View File

@ -106,9 +106,11 @@ func (t *dispatcher) getCmdArgsFromEnv() (string, *CmdArgs, error) {
argsMissing := false
for _, v := range vars {
*v.val = t.Getenv(v.name)
if v.reqForCmd[cmd] && *v.val == "" {
fmt.Fprintf(t.Stderr, "%v env variable missing\n", v.name)
argsMissing = true
if *v.val == "" {
if v.reqForCmd[cmd] || v.name == "CNI_COMMAND" {
fmt.Fprintf(t.Stderr, "%v env variable missing\n", v.name)
argsMissing = true
}
}
}