Fix kubectl create secret/configmap to allow = values

This commit is contained in:
derekwaynecarr
2016-04-29 13:09:46 -04:00
parent c0bcc04b8e
commit 25ed62c3ea
4 changed files with 45 additions and 4 deletions

View File

@@ -229,7 +229,12 @@ func parseFileSource(source string) (keyName, filePath string, err error) {
// parseLiteralSource parses the source key=val pair
func parseLiteralSource(source string) (keyName, value string, err error) {
items := strings.Split(source, "=")
// leading equal is invalid
if strings.Index(source, "=") == 0 {
return "", "", fmt.Errorf("invalid literal source %v, expected key=value", source)
}
// split after the first equal (so values can have the = character)
items := strings.SplitN(source, "=", 2)
if len(items) != 2 {
return "", "", fmt.Errorf("invalid literal source %v, expected key=value", source)
}