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

Split cloud-init into cloud-init-execute and cloud-init-save

This commit is contained in:
Josh Curl
2016-08-04 15:47:12 -07:00
parent e5f1f299f0
commit 889cb9eea8
10 changed files with 185 additions and 138 deletions

View File

@@ -0,0 +1,20 @@
package cloudinitexecute
import (
"os"
"os/exec"
log "github.com/Sirupsen/logrus"
)
func authorizeSSHKeys(user string, authorizedKeys []string, name string) {
for _, authorizedKey := range authorizedKeys {
cmd := exec.Command("update-ssh-keys", user, authorizedKey)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.WithFields(log.Fields{"err": err, "user": user, "auth_key": authorizedKey}).Error("Error updating SSH authorized_keys")
}
}
}