瀏覽代碼

Fix bugs in wizard and cscli (#577)

* fix id generation bug

* fix api client response

Co-authored-by: AlteredCoder <AlteredCoder>
AlteredCoder 4 年之前
父節點
當前提交
81e7db71ed
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      cmd/crowdsec-cli/machines.go
  2. 1 1
      pkg/apiclient/auth.go

+ 1 - 1
cmd/crowdsec-cli/machines.go

@@ -72,8 +72,8 @@ func generateID() (string, error) {
 		}
 		id = string(bID)
 	}
-	id = fmt.Sprintf("%s%s", id, generatePassword(16))
 	id = strings.ReplaceAll(id, "-", "")[:32]
+	id = fmt.Sprintf("%s%s", id, generatePassword(16))
 	return id, nil
 }
 

+ 1 - 1
pkg/apiclient/auth.go

@@ -189,7 +189,7 @@ func (t *JWTTransport) RoundTrip(req *http.Request) (*http.Response, error) {
 	resp, err := t.transport().RoundTrip(req)
 	if log.GetLevel() >= log.TraceLevel {
 		dump, _ := httputil.DumpResponse(resp, true)
-		log.Tracef("resp-jwt: %s (err:%s)", string(dump), err)
+		log.Tracef("resp-jwt: %s (err:%v)", string(dump), err)
 	}
 	if err != nil || resp.StatusCode == 401 {
 		/*we had an error (network error for example, or 401 because token is refused), reset the token ?*/