mirror of
https://github.com/Octops/quake-kube.git
synced 2026-04-05 17:20:33 +00:00
Add context to content-server assets download error
This commit is contained in:
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ q3: gen
|
||||
gen: ## Generate and embed templates
|
||||
@go run tools/genstatic.go public public
|
||||
|
||||
VERSION ?= v1.0.1
|
||||
VERSION ?= v1.0.2
|
||||
IMAGE ?= docker.io/criticalstack/quake:$(VERSION)
|
||||
|
||||
.PHONY: build
|
||||
|
||||
@ -21,9 +21,10 @@ var opts struct {
|
||||
|
||||
func NewCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "content",
|
||||
Short: "q3 content server",
|
||||
SilenceUsage: true,
|
||||
Use: "content",
|
||||
Short: "q3 content server",
|
||||
SilenceErrors: true,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
if !filepath.IsAbs(opts.AssetsDir) {
|
||||
opts.AssetsDir, err = filepath.Abs(opts.AssetsDir)
|
||||
|
||||
@ -15,7 +15,7 @@ var global struct {
|
||||
Verbosity int
|
||||
}
|
||||
|
||||
func NewRootCommand() *cobra.Command {
|
||||
func main() {
|
||||
cmd := &cobra.Command{
|
||||
Use: "q3",
|
||||
Short: "",
|
||||
@ -28,11 +28,8 @@ func NewRootCommand() *cobra.Command {
|
||||
)
|
||||
|
||||
cmd.PersistentFlags().CountVarP(&global.Verbosity, "verbose", "v", "log output verbosity")
|
||||
return cmd
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := NewRootCommand().Execute(); err != nil {
|
||||
if err := cmd.Execute(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ spec:
|
||||
- --config=/config/config.yaml
|
||||
- --content-server=http://localhost:9090
|
||||
- --agree-eula
|
||||
image: docker.io/criticalstack/quake:v1.0.1
|
||||
image: docker.io/criticalstack/quake:v1.0.2
|
||||
name: server
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
@ -37,7 +37,7 @@ spec:
|
||||
- q3
|
||||
- content
|
||||
- --seed-content-url=http://content.quakejs.com
|
||||
image: docker.io/criticalstack/quake:v1.0.1
|
||||
image: docker.io/criticalstack/quake:v1.0.2
|
||||
name: content-server
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
|
||||
@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
httputil "github.com/criticalstack/quake-kube/internal/util/net/http"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func CopyAssets(u *url.URL, dir string) error {
|
||||
@ -60,7 +61,7 @@ func getManifest(url string) ([]*File, error) {
|
||||
|
||||
files := make([]*File, 0)
|
||||
if err := json.Unmarshal(data, &files); err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrapf(err, "cannot unmarshal %s/assets/manifest.json", url)
|
||||
}
|
||||
return files, nil
|
||||
}
|
||||
|
||||
@ -18,6 +18,10 @@ func GetBody(url string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.Errorf("cannot get url %q: %v", url, http.StatusText(resp.StatusCode))
|
||||
}
|
||||
|
||||
return ioutil.ReadAll(resp.Body)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user