mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-19 13:34:21 +01:00
packaging: merge packaging repository
git-subtree-dir: tools/packaging git-subtree-mainline:f818b46a41git-subtree-split:1f22d72d5dSigned-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
26
tools/packaging/cmd/kata-pkgsync/cli/utils.go
Normal file
26
tools/packaging/cmd/kata-pkgsync/cli/utils.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2019 SUSE LLC
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func yamlUnmarshal(yamlFile string, cfg interface{}) error {
|
||||
source, err := ioutil.ReadFile(yamlFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = yaml.Unmarshal(source, cfg)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("cannot unmarshal %s", yamlFile))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user