mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
add not found error for ipset set and entry delete
This commit is contained in:
@@ -322,4 +322,20 @@ func validatePortRange(portRange string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsNotFoundError returns true if the error indicates "not found". It parses
|
||||
// the error string looking for known values, which is imperfect but works in
|
||||
// practice.
|
||||
func IsNotFoundError(err error) bool {
|
||||
es := err.Error()
|
||||
if strings.Contains(es, "does not exist") {
|
||||
// set with the same name already exists
|
||||
return true
|
||||
}
|
||||
if strings.Contains(es, "element is missing") {
|
||||
// entry is missing from the set
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var _ = Interface(&runner{})
|
||||
|
||||
Reference in New Issue
Block a user