mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
Make "metadata: yaml" actually output yaml
The existing code made json... Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
2f01ab25ed
commit
411a21ae07
@ -15,6 +15,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultNameForStdin = "moby"
|
const defaultNameForStdin = "moby"
|
||||||
@ -389,8 +390,10 @@ func tarAppend(iw *tar.Writer, tr *tar.Reader) error {
|
|||||||
// this allows inserting metadata into a file in the image
|
// this allows inserting metadata into a file in the image
|
||||||
func metadata(m Moby, md string) ([]byte, error) {
|
func metadata(m Moby, md string) ([]byte, error) {
|
||||||
switch md {
|
switch md {
|
||||||
case "yaml":
|
case "json":
|
||||||
return json.MarshalIndent(m, "", " ")
|
return json.MarshalIndent(m, "", " ")
|
||||||
|
case "yaml":
|
||||||
|
return yaml.Marshal(m)
|
||||||
default:
|
default:
|
||||||
return []byte{}, fmt.Errorf("Unsupported metadata type: %s", md)
|
return []byte{}, fmt.Errorf("Unsupported metadata type: %s", md)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user