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:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user