Add additional logging to debug PIS update process
All checks were successful
Go Test / test (push) Successful in 2m36s
All checks were successful
Go Test / test (push) Successful in 2m36s
This commit is contained in:
parent
9b5779799f
commit
fc5bb2534a
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
// Version Constants
|
||||
const versionNum string = "2024.10.2"
|
||||
const versionNum string = "2024.11.1"
|
||||
const versionSuffix string = ""
|
||||
const Version string = versionNum + versionSuffix
|
||||
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
// Checks the Gitea API for the latest release and compares to metadata in the database
|
||||
// to determine if a PIS update is required.
|
||||
func Check() {
|
||||
log.Info("PIS Update Check started")
|
||||
repoName := "data"
|
||||
repoOwner := "owlboard"
|
||||
baseUrl := "https://git.fjla.uk"
|
||||
|
@ -21,6 +21,7 @@ const (
|
||||
|
||||
// Downloads the release tarball, extracts then applies to database
|
||||
func runUpdate(tarballUrl string) error {
|
||||
log.Info("PIS Update Process started")
|
||||
err := downloadFile(tarballUrl, destPath)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -31,11 +32,13 @@ func runUpdate(tarballUrl string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info("Saved PIS Release to disk")
|
||||
defer file.Close()
|
||||
|
||||
if err := extractFiles(file, extractPath); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info("Extracted PIS Release")
|
||||
|
||||
// Load YAML to string
|
||||
pisData, err := extractYamlData(extractPath)
|
||||
@ -47,6 +50,7 @@ func runUpdate(tarballUrl string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info("Loaded PIS Files to Slice")
|
||||
|
||||
fmt.Println(&pisSlice)
|
||||
/*
|
||||
@ -78,6 +82,7 @@ func downloadFile(url, filepath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Info("PIS Release downloaded")
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
@ -99,6 +104,7 @@ func extractFiles(gzipStream io.Reader, dest string) error {
|
||||
return err
|
||||
}
|
||||
defer uncompressedStream.Close()
|
||||
log.Info("Extracting PIS File")
|
||||
|
||||
tarReader := tar.NewReader(uncompressedStream)
|
||||
|
||||
@ -189,4 +195,5 @@ func cleanupFiles(paths ...string) {
|
||||
log.Warn("Error removing file", zap.String("path", path), zap.Error(err))
|
||||
}
|
||||
}
|
||||
log.Info("Removed PIS Release files")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user