Improve error handling in UCIDHCPConf
This commit is contained in:
parent
3282ef5f1b
commit
6f2598aff2
|
@ -36,6 +36,17 @@ func (dh *UCIDHCPConf) Create() *Action {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
for key, value := range conf {
|
for key, value := range conf {
|
||||||
|
fmt.Printf("DEBUG %s == %s\n", key, value)
|
||||||
|
if value == "" {
|
||||||
|
return &Action{
|
||||||
|
CommandResult: &CommandResult{
|
||||||
|
Stdout: "",
|
||||||
|
Stderr: fmt.Sprintf("dhcp.%s can't be empty", key),
|
||||||
|
ReturnCode: 100,
|
||||||
|
},
|
||||||
|
Command: "Empty value error",
|
||||||
|
}
|
||||||
|
}
|
||||||
result := uci.Set(fmt.Sprintf("dhcp.%s.%s", dh.Name, key), value)
|
result := uci.Set(fmt.Sprintf("dhcp.%s.%s", dh.Name, key), value)
|
||||||
if result.ReturnCode != 0 {
|
if result.ReturnCode != 0 {
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue