1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

cloudinit: do not abort on configuration errors

This commit is contained in:
Ivan Mikushin
2015-08-20 19:42:33 +05:00
parent 642c557c73
commit ed09b30692
2 changed files with 6 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ func authorizeSSHKeys(user string, authorizedKeys []string, name string) {
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Fatal(err.Error())
log.WithFields(log.Fields{"err": err, "user": user, "auth_key": authorizedKey}).Error("Error updating SSH authorized_keys")
}
}
}

View File

@@ -100,7 +100,8 @@ func saveFiles(cloudConfigBytes, scriptBytes []byte, metadata datasource.Metadat
func currentDatasource() (datasource.Datasource, error) {
cfg, err := rancherConfig.LoadConfig()
if err != nil {
log.Fatalf("Failed to read rancher config %v", err)
log.WithFields(log.Fields{"err": err}).Error("Failed to read rancher config")
return nil, err
}
dss := getDatasources(cfg)
@@ -275,7 +276,7 @@ func executeCloudConfig() error {
if cc.Hostname != "" {
//set hostname
if err := hostname.SetHostname(cc.Hostname); err != nil {
log.Fatal(err)
log.WithFields(log.Fields{"err": err, "hostname": cc.Hostname}).Error("Error setting hostname")
}
}
@@ -297,7 +298,8 @@ func executeCloudConfig() error {
f := system.File{File: file}
fullPath, err := system.WriteFile(&f, "/")
if err != nil {
log.Fatal(err)
log.WithFields(log.Fields{"err": err, "path": fullPath}).Error("Error writing file")
continue
}
log.Printf("Wrote file %s to filesystem", fullPath)
}