process runcmd

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2015-04-23 17:40:28 +03:00
parent 0deecce2de
commit 465cb76917

View File

@ -19,7 +19,9 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"os/exec"
"path" "path"
"strings"
"github.com/vtolstov/cloudinit/config" "github.com/vtolstov/cloudinit/config"
"github.com/vtolstov/cloudinit/network" "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) 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 { for _, user := range cfg.Users {
if user.Name == "" { if user.Name == "" {
log.Printf("User object has no 'name' field, skipping") log.Printf("User object has no 'name' field, skipping")