fix: grctl update ip failed (#1368)

This commit is contained in:
yangkaa 2022-10-11 00:59:52 +08:00 committed by GitHub
parent 12382fdddc
commit e9acc5c3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -34,7 +34,6 @@ import (
"k8s.io/apimachinery/pkg/util/uuid"
"net/http"
"net/url"
"path"
"strings"
"time"
)
@ -254,7 +253,7 @@ func SendtoConsole(domain, token string, regionInfo *RegionInfo) (err error) {
return err
}
client := &http.Client{}
consoleDomain := path.Join(domain, "openapi/v1/grctl/ip")
consoleDomain := fmt.Sprintf("%s%s", strings.TrimSuffix(domain, "/"), "/openapi/v1/grctl/ip")
request, err := http.NewRequest("POST", consoleDomain,
strings.NewReader(string(reqParam)))
if err != nil {
@ -263,7 +262,11 @@ func SendtoConsole(domain, token string, regionInfo *RegionInfo) (err error) {
}
request.Header.Add("Authorization", token)
request.Header.Add("Content-Type", "application/json")
response, _ := client.Do(request)
response, err := client.Do(request)
if err != nil {
logrus.Error("Request console openapi interface failed", err)
return err
}
defer response.Body.Close()
body, err := ioutil.ReadAll(response.Body)
if err != nil {

View File

@ -4,7 +4,7 @@ ARG RELEASE_DESC
ENV WORK_DIR=/run
RUN apk add --no-cache openssl openssh-client subversion -y
RUN apk add --no-cache openssl openssh-client subversion
COPY rainbond-chaos entrypoint.sh /run/
COPY export-app /src/export-app