Skip to content

Commit

Permalink
Update to use the new Version stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlovelltroy committed Oct 29, 2024
1 parent 83a196b commit 34233a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ kubernetes/.packaged/
.idea/
*.swp


# Binaries
boot-script-service
bss-init

# Prevent certificates from getting checked in
*.ca
*.cer
Expand Down
3 changes: 1 addition & 2 deletions cmd/boot-script-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import (
"strings"
"time"

base "github.com/Cray-HPE/hms-base"
hmetcd "github.com/Cray-HPE/hms-hmetcd"
"github.com/OpenCHAMI/bss/internal/postgres"
)
Expand Down Expand Up @@ -449,7 +448,7 @@ func main() {
}
parseCmdLine()

sn, snerr := base.GetServiceInstanceName()
sn, snerr := os.Hostname()
if snerr == nil {
serviceName = sn
}
Expand Down
15 changes: 4 additions & 11 deletions cmd/boot-script-service/serviceAPI.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
Expand Down Expand Up @@ -53,16 +54,8 @@ func serviceStatusAPI(w http.ResponseWriter, req *http.Request) {
}
if strings.Contains(strings.ToUpper(req.URL.Path), "VERSION") ||
strings.Contains(strings.ToUpper(req.URL.Path), "ALL") {
dat, err := ioutil.ReadFile(".version")
if err != nil {
dat, err = ioutil.ReadFile("../../.version")
if err != nil {
httpStatus = http.StatusInternalServerError
dat = []byte("error")
log.Printf("Cannot read version file: %s", err)
}
}
bssStatus.Version = strings.TrimSpace(string(dat))

bssStatus.Version = strings.TrimSpace(Version)
}
if strings.Contains(strings.ToUpper(req.URL.Path), "HSM") ||
strings.Contains(strings.ToUpper(req.URL.Path), "ALL") {
Expand All @@ -74,7 +67,7 @@ func serviceStatusAPI(w http.ResponseWriter, req *http.Request) {
bssStatus.HSMStatus = "error"
log.Printf("Cannot connect to HSM: %s", err)
} else {
_, err = ioutil.ReadAll(rsp.Body)
_, err = io.ReadAll(rsp.Body)
if err != nil {
httpStatus = http.StatusInternalServerError
bssStatus.HSMStatus = "error"
Expand Down

0 comments on commit 34233a3

Please sign in to comment.