[Backport release-1.5] Fix: failed to assign the default role for the users who log in from dex (#4504)

* Fix: failed to assign the default role for the users who log in from dex

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
(cherry picked from commit ad501b4582)

* Fix: cluster e2e test case

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
(cherry picked from commit 23cd84ba94)

* Fix: the ensure namespace error is ignored

Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
(cherry picked from commit 8beb1c6925)

Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
github-actions[bot]
2022-07-29 17:19:21 +08:00
committed by GitHub
co-authored by barnettZQG
parent fafa18e8db
commit db21d74a52
7 changed files with 68 additions and 41 deletions
+7 -7
View File
@@ -206,23 +206,23 @@ func delete(path string) *http.Response {
}
func decodeResponseBody(resp *http.Response, dst interface{}) error {
if resp.StatusCode != 200 {
return fmt.Errorf("response code is not 200: %d", resp.StatusCode)
}
if resp.Body == nil {
return fmt.Errorf("response body is nil")
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if dst != nil {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
err = json.Unmarshal(body, dst)
if err != nil {
return err
}
return nil
}
if resp.StatusCode != 200 {
return fmt.Errorf("response code is not 200: %d body: %s", resp.StatusCode, string(body))
}
return nil
}