From f9f1f229ffcb14351ff31f329c5fa8963485bcbd Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 10 Nov 2015 13:28:25 +0000 Subject: [PATCH] fix script running when specify in user-data Signed-off-by: Vasiliy Tolstov --- system/systemd.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/system/systemd.go b/system/systemd.go index cc5e224..710632c 100644 --- a/system/systemd.go +++ b/system/systemd.go @@ -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 }