base64 k8s (yaml) decoder expects padding

This commit is contained in:
Mikaël Cluseau
2026-02-10 21:08:45 +01:00
parent 6d9499ebb1
commit 629bb21f12
4 changed files with 10 additions and 34 deletions

View File

@ -4,7 +4,6 @@ import (
"archive/tar"
"bytes"
"crypto"
"encoding/json"
"fmt"
"io"
"log"
@ -12,26 +11,20 @@ import (
"os"
"github.com/klauspost/compress/zstd"
yaml "gopkg.in/yaml.v2"
"novit.tech/direktil/pkg/cpiocat"
)
func renderBootstrapConfig(w http.ResponseWriter, r *http.Request, ctx *renderContext, asJson bool) (err error) {
func renderBootstrapConfig(w http.ResponseWriter, ctx *renderContext) (err error) {
log.Printf("sending bootstrap config for %q", ctx.Host.Name)
_, cfg, err := ctx.BootstrapConfig()
ba, err := ctx.BootstrapConfig()
if err != nil {
return err
}
if asJson {
err = json.NewEncoder(w).Encode(cfg)
} else {
err = yaml.NewEncoder(w).Encode(cfg)
}
return nil
_, err = w.Write(ba)
return
}
func buildInitrd(out io.Writer, ctx *renderContext) (err error) {
@ -72,7 +65,7 @@ func buildInitrd(out io.Writer, ctx *renderContext) (err error) {
}
// config
cfgBytes, _, err := ctx.BootstrapConfig()
cfgBytes, err := ctx.BootstrapConfig()
if err != nil {
return
}