correctly pass the script to the worker
diff --git a/provisioner/dispatcher.go b/provisioner/dispatcher.go
index 44e16e0..fb16458 100644
--- a/provisioner/dispatcher.go
+++ b/provisioner/dispatcher.go
@@ -33,7 +33,8 @@
Work: make(chan WorkRequest),
StatusChan: statusChan,
WorkerQueue: workerQueue,
- QuitChan: make(chan bool)}
+ QuitChan: make(chan bool),
+ }
return worker
}
@@ -48,6 +49,9 @@
case work := <-w.Work:
// Receive a work request.
w.StatusChan <- StatusMsg{&work, w.ID, Running, ""}
+ log.Printf("RUN: %s %s %s %s %s %s",
+ work.Script, work.Info.Id, work.Info.Name,
+ work.Info.Ip, work.Info.Mac, work.Role)
err := exec.Command(work.Script, work.Info.Id, work.Info.Name,
work.Info.Ip, work.Info.Mac, work.Role).Run()
if err != nil {
@@ -92,10 +96,11 @@
return &d
}
-func (d *Dispatcher) Dispatch(info *RequestInfo, role string) error {
+func (d *Dispatcher) Dispatch(info *RequestInfo, role string, script string) error {
d.WorkQueue <- WorkRequest{
- Info: info,
- Role: role,
+ Info: info,
+ Script: script,
+ Role: role,
}
return nil
}
diff --git a/provisioner/handlers.go b/provisioner/handlers.go
index 2ac421d..11df6ee 100644
--- a/provisioner/handlers.go
+++ b/provisioner/handlers.go
@@ -61,7 +61,7 @@
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
- err = c.dispatcher.Dispatch(&info, role)
+ err = c.dispatcher.Dispatch(&info, role, c.config.Script)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return