1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +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

@@ -28,18 +28,25 @@ const (
SCOPE = "io.rancher.os.scope"
SYSTEM = "system"
OsConfigFile = "/usr/share/ros/os-config.yml"
CloudConfigFile = "/var/lib/rancher/conf/cloud-config.yml"
CloudConfigScriptFile = "/var/lib/rancher/conf/cloud-config-script"
MetaDataFile = "/var/lib/rancher/conf/metadata"
LocalConfigFile = "/var/lib/rancher/conf/cloud-config-local.yml"
PrivateConfigFile = "/var/lib/rancher/conf/cloud-config-private.yml"
OsConfigFile = "/usr/share/ros/os-config.yml"
CloudConfigDir = "/var/lib/rancher/conf/cloud-config.d"
CloudConfigBootFile = "/var/lib/rancher/conf/cloud-config.d/boot.yml"
CloudConfigPrivateFile = "/var/lib/rancher/conf/cloud-config.d/private.yml"
CloudConfigScriptFile = "/var/lib/rancher/conf/cloud-config-script"
MetaDataFile = "/var/lib/rancher/conf/metadata"
CloudConfigFile = "/var/lib/rancher/conf/cloud-config.yml"
)
var (
VERSION string
)
func init() {
if VERSION == "" {
VERSION = "v0.0.0-dev"
}
}
type ContainerConfig struct {
Id string `yaml:"id,omitempty"`
Cmd string `yaml:"run,omitempty"`
@@ -119,8 +126,13 @@ type CloudInit struct {
Datasources []string `yaml:"datasources,omitempty"`
}
func init() {
if VERSION == "" {
VERSION = "v0.0.0-dev"
func (r Repositories) ToArray() []string {
result := make([]string, 0, len(r))
for _, repo := range r {
if repo.Url != "" {
result = append(result, repo.Url)
}
}
return result
}