fix script running when specify in user-data

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2015-11-10 13:28:25 +00:00
parent 6cad908751
commit f9f1f229ff

View File

@ -173,25 +173,9 @@ func nullOrEmpty(path string) (bool, error) {
}
func ExecuteScript(scriptPath string) (string, error) {
/*
props := []dbus.Property{
dbus.PropDescription("Unit generated and executed by coreos-cloudinit on behalf of user"),
dbus.PropExecStart([]string{"/bin/bash", scriptPath}, false),
}
base := path.Base(scriptPath)
name := fmt.Sprintf("coreos-cloudinit-%s.service", base)
log.Printf("Creating transient systemd unit '%s'", name)
conn, err := dbus.New()
if err != nil {
return "", err
}
_, err = conn.StartTransientUnit(name, "replace", props...)
return name, err
*/
if err := exec.Command("/bin/sh", "-c", scriptPath).Run(); err == nil {
return scriptPath, nil
}
return "", nil
}