1
0
mirror of https://github.com/rancher/os.git synced 2025-09-06 17:22:34 +00:00

refactor a little and keep the datasource errors for later

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-03-01 15:12:56 +10:00
parent 23a4d8ec76
commit 391082fa50
16 changed files with 181 additions and 91 deletions

24
init/init.go Normal file → Executable file
View File

@@ -12,7 +12,6 @@ import (
"syscall"
"github.com/docker/docker/pkg/mount"
"github.com/rancher/os/cmd/cloudinitsave"
"github.com/rancher/os/config"
"github.com/rancher/os/dfs"
"github.com/rancher/os/log"
@@ -294,29 +293,10 @@ func RunInit() error {
log.Error(err)
}
network := false
for _, datasource := range cfg.Rancher.CloudInit.Datasources {
if cloudinitsave.RequiresNetwork(datasource) {
network = true
break
}
if err := runCloudInitServices(cfg); err != nil {
log.Error(err)
}
if network {
if err := runCloudInitServices(cfg); err != nil {
log.Error(err)
}
} else {
if err := cloudinitsave.MountConfigDrive(); err != nil {
log.Error(err)
}
if err := cloudinitsave.SaveCloudConfig(false); err != nil {
log.Error(err)
}
if err := cloudinitsave.UnmountConfigDrive(); err != nil {
log.Error(err)
}
}
return cfg, nil
},
func(cfg *config.CloudConfig) (*config.CloudConfig, error) {