3 Commits
1.0.2 ... 1.0.4

Author SHA1 Message Date
817b3b32b1 return json even if no packages are queued; fix 404 2025-03-23 22:57:15 +01:00
8be1c59065 handle api return codes 2025-03-23 22:13:01 +01:00
dde049fb75 Update README.md 2025-03-23 16:01:01 +01:00
2 changed files with 15 additions and 1 deletions

View File

@@ -1,3 +1,3 @@
# ALHP.NOGO # ALHP.utils
Utility to check if one of your packages is building Utility to check if one of your packages is building

14
main.go
View File

@@ -86,6 +86,14 @@ func main() {
if *exitCodeFlag { if *exitCodeFlag {
os.Exit(20) os.Exit(20)
} }
} else {
log.Debugf("no packages in queue")
if *jsonFlag {
err = json.NewEncoder(os.Stdout).Encode(JSONOut{
Total: len(packagesInQueue),
Packages: packagesInQueue,
})
}
} }
} }
@@ -127,6 +135,12 @@ func ALHPBuildQueuePkgbase() ([]string, error) {
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode == http.StatusNotFound {
return nil, nil
} else if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("ALHP api returned HTTP %d", resp.StatusCode)
}
bResp, err := io.ReadAll(resp.Body) bResp, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err