fixed generated cloud config
This commit is contained in:
parent
fb1d8d2647
commit
20ac152a2b
1 changed files with 7 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var cloudConfig = []byte("#cloud-config\n")
|
||||||
|
|
||||||
func parseUserData(s string) (u *UserData, err error) {
|
func parseUserData(s string) (u *UserData, err error) {
|
||||||
s, err = url.QueryUnescape(s)
|
s, err = url.QueryUnescape(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -29,7 +31,11 @@ func MarshalUserData(u *UserData) ([]byte, error) {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return yaml.Marshal(u)
|
b, err := yaml.Marshal(u)
|
||||||
|
if err == nil {
|
||||||
|
b = append(cloudConfig, b...)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserData struct {
|
type UserData struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue