From 465cb76917d81382f2265907366f2b4f42614e04 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 23 Apr 2015 17:40:28 +0300 Subject: [PATCH] process runcmd Signed-off-by: Vasiliy Tolstov --- initialize/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/initialize/config.go b/initialize/config.go index d18512b..9ed20fd 100644 --- a/initialize/config.go +++ b/initialize/config.go @@ -19,7 +19,9 @@ import ( "fmt" "log" "os" + "os/exec" "path" + "strings" "github.com/vtolstov/cloudinit/config" "github.com/vtolstov/cloudinit/network" @@ -70,6 +72,12 @@ func Apply(cfg config.CloudConfig, ifaces []network.InterfaceGenerator, env *Env log.Printf("Set hostname to %s", cfg.Hostname) } + for _, cmdline := range cfg.RunCMD { + prog := strings.Fields(cmdline)[0] + args := strings.Fields(cmdline)[1:] + exec.Command(prog, args...).Run() + } + for _, user := range cfg.Users { if user.Name == "" { log.Printf("User object has no 'name' field, skipping")