1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +00:00

Update vendor

This commit is contained in:
Darren Shepherd
2018-01-17 15:59:47 -07:00
parent 2a197d2490
commit f2db89cf88
4 changed files with 23 additions and 5 deletions

View File

@@ -140,7 +140,11 @@ func (c Cond) doInternal(obj runtime.Object, f func() (runtime.Object, error)) (
}
if err != nil {
if _, ok := err.(*controller.ForgetError); !ok {
if _, ok := err.(*controller.ForgetError); ok {
if c.IsFalse(obj) {
c.Unknown(obj)
}
} else {
c.False(obj)
}
c.ReasonAndMessageFromError(obj, err)

View File

@@ -16,7 +16,7 @@ import (
)
var (
resyncPeriod = 5 * time.Minute
resyncPeriod = 2 * time.Hour
)
type HandlerFunc func(key string) error

View File

@@ -10,6 +10,20 @@ import (
"unicode"
)
func Chan(c <-chan map[string]interface{}, f func(map[string]interface{}) map[string]interface{}) chan map[string]interface{} {
result := make(chan map[string]interface{})
go func() {
for data := range c {
modified := f(data)
if modified != nil {
result <- modified
}
}
close(result)
}()
return result
}
func Singular(value interface{}) interface{} {
if slice, ok := value.([]string); ok {
if len(slice) == 0 {
@@ -34,7 +48,7 @@ func ToString(value interface{}) string {
if single == nil {
return ""
}
return fmt.Sprint(single)
return strings.TrimSpace(fmt.Sprint(single))
}
func ToTimestamp(value interface{}) (int64, error) {
@@ -150,7 +164,7 @@ func ToStringSlice(data interface{}) []string {
return v
}
if v, ok := data.([]interface{}); ok {
result := []string{}
var result []string
for _, item := range v {
result = append(result, ToString(item))
}