1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

enhance jmespath random-filter (#4591)

Signed-off-by: Anurag <contact.anurag7@gmail.com>

Signed-off-by: Anurag <contact.anurag7@gmail.com>
This commit is contained in:
Anurag 2022-09-14 11:57:32 +05:30 committed by GitHub
parent e516fb868e
commit cadf577e4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"math/rand"
"path/filepath"
"reflect"
"regexp"
@ -958,10 +958,10 @@ func jpRandom(arguments []interface{}) (interface{}, error) {
if pattern == "" {
return "", errors.New("no pattern provided")
}
rand.Seed(time.Now().UnixNano())
ans, err := regen.Generate(pattern)
if err != nil {
fmt.Println("Invalid Pattern: ", err)
}
log.Println()
return ans, nil
}