Commit 6a529f70 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42948 from CaoShuFeng/fromLiteralStrings

Automatic merge from submit-queue (batch tested with PRs 42998, 42902, 42959, 43020, 42948) [cli] fix Generator's error messages Invalid variables are used when format error messages. This change fixes them. **Release note**: ```NONE ```
parents 14c1c9cf b2f530d7
......@@ -52,29 +52,29 @@ func (s ClusterRoleBindingGeneratorV1) Generate(genericParams map[string]interfa
return nil, err
}
delegate := &ClusterRoleBindingGeneratorV1{}
fromFileStrings, found := genericParams["user"]
userStrings, found := genericParams["user"]
if found {
fromFileArray, isArray := fromFileStrings.([]string)
fromFileArray, isArray := userStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", userStrings)
}
delegate.Users = fromFileArray
delete(genericParams, "user")
}
fromLiteralStrings, found := genericParams["group"]
groupStrings, found := genericParams["group"]
if found {
fromLiteralArray, isArray := fromLiteralStrings.([]string)
fromLiteralArray, isArray := groupStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", groupStrings)
}
delegate.Groups = fromLiteralArray
delete(genericParams, "group")
}
fromSAStrings, found := genericParams["serviceaccount"]
saStrings, found := genericParams["serviceaccount"]
if found {
fromLiteralArray, isArray := fromSAStrings.([]string)
fromLiteralArray, isArray := saStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", saStrings)
}
delegate.ServiceAccounts = fromLiteralArray
delete(genericParams, "serviceaccount")
......
......@@ -68,7 +68,7 @@ func (s ConfigMapGeneratorV1) Generate(genericParams map[string]interface{}) (ru
if found {
fromLiteralArray, isArray := fromLiteralStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", fromLiteralStrings)
}
delegate.LiteralSources = fromLiteralArray
delete(genericParams, "from-literal")
......
......@@ -54,29 +54,29 @@ func (s RoleBindingGeneratorV1) Generate(genericParams map[string]interface{}) (
return nil, err
}
delegate := &RoleBindingGeneratorV1{}
fromFileStrings, found := genericParams["user"]
userStrings, found := genericParams["user"]
if found {
fromFileArray, isArray := fromFileStrings.([]string)
fromFileArray, isArray := userStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", userStrings)
}
delegate.Users = fromFileArray
delete(genericParams, "user")
}
fromLiteralStrings, found := genericParams["group"]
groupStrings, found := genericParams["group"]
if found {
fromLiteralArray, isArray := fromLiteralStrings.([]string)
fromLiteralArray, isArray := groupStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", groupStrings)
}
delegate.Groups = fromLiteralArray
delete(genericParams, "group")
}
fromSAStrings, found := genericParams["serviceaccount"]
saStrings, found := genericParams["serviceaccount"]
if found {
fromLiteralArray, isArray := fromSAStrings.([]string)
fromLiteralArray, isArray := saStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", saStrings)
}
delegate.ServiceAccounts = fromLiteralArray
delete(genericParams, "serviceaccount")
......
......@@ -68,7 +68,7 @@ func (s SecretGeneratorV1) Generate(genericParams map[string]interface{}) (runti
if found {
fromLiteralArray, isArray := fromLiteralStrings.([]string)
if !isArray {
return nil, fmt.Errorf("expected []string, found :%v", fromFileStrings)
return nil, fmt.Errorf("expected []string, found :%v", fromLiteralStrings)
}
delegate.LiteralSources = fromLiteralArray
delete(genericParams, "from-literal")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment