Skip to content

Commit

Permalink
fix latest build
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Oct 4, 2023
1 parent 7aa0ba7 commit a58f7a2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion artifactory/services/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (ss *SystemService) sendGet(endpoint string) ([]byte, error) {
return nil, err
}
if err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK, http.StatusCreated); err != nil {
return nil, fmt.Errorf("failed while attempting to get Artifactory %s:\n%s", endpoint, err.Error())
return nil, fmt.Errorf("got unexpected server response while attempting to get JFrog Artifactory %s:\n%s", endpoint, err.Error())
}
log.Debug("Artifactory response:", resp.Status)
return body, nil
Expand Down
4 changes: 2 additions & 2 deletions distribution/services/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func (vs *VersionService) GetDistributionVersion() (string, error) {
httpDetails := vs.DistDetails.CreateHttpClientDetails()
resp, body, _, err := vs.client.SendGet(vs.DistDetails.GetUrl()+"api/v1/system/info", true, &httpDetails)
if err != nil {
return "", errors.New("failed while attempting to get Distribution version: " + err.Error())
return "", errors.New("failed while attempting to get JFrog Distribution version: " + err.Error())
}

if err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK); err != nil {
return "", errors.New("failed while attempting to get JFrog Distribution version:\n" + err.Error())
return "", errors.New("got unexpected server response while attempting to get JFrog Distribution version:\n" + err.Error())
}
var version distributionVersion
if err = json.Unmarshal(body, &version); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pipelines/services/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func (ss *SystemService) GetSystemInfo() (*PipelinesSystemInfo, error) {
httpDetails := ss.ServiceDetails.CreateHttpClientDetails()
resp, body, _, err := ss.client.SendGet(ss.ServiceDetails.GetUrl()+"api/v1/system/info", true, &httpDetails)
if err != nil {
return nil, errors.New("failed while attempting to get Pipelines version: " + err.Error())
return nil, errors.New("failed while attempting to get JFrog Pipelines version: " + err.Error())
}
if err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK); err != nil {
if resp.StatusCode == http.StatusNotFound {
return nil, &PipelinesNotAvailableError{InnerError: err}
}
return nil, errors.New("failed while attempting to get JFrog Pipelines version:\n" + err.Error())
return nil, errors.New("got unexpected server response while attempting to get JFrog Pipelines version:\n" + err.Error())
}
var sysInfo PipelinesSystemInfo
if err = json.Unmarshal(body, &sysInfo); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion xray/services/entitlements.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package services

import (
"encoding/json"
"errors"
"fmt"
"net/http"

Expand Down Expand Up @@ -30,10 +31,11 @@ func (es *EntitlementsService) IsEntitled(featureId string) (entitled bool, err
httpDetails := es.XrayDetails.CreateHttpClientDetails()
resp, body, _, err := es.client.SendGet(es.XrayDetails.GetUrl()+"api/v1/entitlements/feature/"+featureId, true, &httpDetails)
if err != nil {
err = errors.New("failed while attempting to get JFrog Xray entitlements response: " + err.Error())
return
}
if err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK); err != nil {
return false, fmt.Errorf("failed while attempting to get JFrog Xray entitlements response for %s:\n%s", featureId, err.Error())
return false, fmt.Errorf("got unexpected server response while attempting to get JFrog Xray entitlements response for %s:\n%s", featureId, err.Error())
}
var userEntitlements entitlements
if err = json.Unmarshal(body, &userEntitlements); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions xray/services/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ func (vs *VersionService) GetVersion() (string, error) {
httpDetails := vs.XrayDetails.CreateHttpClientDetails()
resp, body, _, err := vs.client.SendGet(vs.XrayDetails.GetUrl()+"api/v1/system/version", true, &httpDetails)
if err != nil {
return "", errors.New("failed while attempting to get Xray version: " + err.Error())
return "", errors.New("failed while attempting to get JFrog Xray version: " + err.Error())
}
if err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK); err != nil {
return "", errors.New("failed while attempting to get JFrog Xray version:\n" + err.Error())
return "", errors.New("got unexpected server response while attempting to get JFrog Xray version:\n" + err.Error())
}
var version xrayVersion
if err = json.Unmarshal(body, &version); err != nil {
Expand Down

0 comments on commit a58f7a2

Please sign in to comment.