1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 06:40:31 +00:00

Reshuffle cloud-config

Read files cloud-config.d in alphanumeric order, then cloud-config.yml
`ros config` writes to cloud-config.yml (and cloud-config.d/private.yml - only private keys)

Add (c *CloudConfig) Save() method, use it to save the changed config

Read and apply metadata as part of LoadConfig()

Simplify ros config export logic
This commit is contained in:
Ivan Mikushin
2015-09-23 16:36:28 +05:00
parent 0ac4c783f9
commit 338abb758f
20 changed files with 658 additions and 695 deletions

View File

@@ -152,7 +152,8 @@ func TestGet(t *testing.T) {
}
for k, v := range tests {
assert.Equal(v, getOrSetVal(k, data, nil))
val, _ := getOrSetVal(k, data, nil)
assert.Equal(v, val)
}
}
@@ -195,8 +196,10 @@ func TestSet(t *testing.T) {
}
for k, v := range tests {
getOrSetVal(k, data, v)
assert.Equal(v, getOrSetVal(k, data, nil))
_, tData := getOrSetVal(k, data, v)
val, _ := getOrSetVal(k, tData, nil)
data = tData
assert.Equal(v, val)
}
assert.Equal(expected, data)
@@ -267,8 +270,8 @@ func TestUserDocker(t *testing.T) {
err = yaml.Unmarshal(bytes, config)
assert.Nil(err)
data := make(map[interface{}]map[interface{}]interface{})
util.Convert(config, data)
data := map[interface{}]map[interface{}]interface{}{}
util.Convert(config, &data)
fmt.Println(data)