update to build the correct container and also fix a few bugs
diff --git a/build.gradle b/build.gradle
index 7e3ea90..f5120d3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -59,7 +59,7 @@
}
task buildProvisionerImage(type: Exec) {
- commandLine "$dockerPath/docker", 'build', '-t', 'cord-provisioner', './ip-allocator'
+ commandLine "$dockerPath/docker", 'build', '-t', 'cord-provisioner', './provisioner'
}
task tagProvisionerImage(type: Exec) {
diff --git a/provisioner/Dockerfile b/provisioner/Dockerfile
index 478bff8..a193758 100644
--- a/provisioner/Dockerfile
+++ b/provisioner/Dockerfile
@@ -41,4 +41,4 @@
WORKDIR $GOPATH
RUN go install github.com/ciena/cord-provisioner
-ENTRYPOINT ["$GOPATH/bin/cord-provisioner"]
+ENTRYPOINT ["/go/bin/cord-provisioner"]
diff --git a/provisioner/handlers.go b/provisioner/handlers.go
index b915674..2ac421d 100644
--- a/provisioner/handlers.go
+++ b/provisioner/handlers.go
@@ -4,7 +4,6 @@
"bufio"
"encoding/json"
"github.com/gorilla/mux"
- "log"
"net/http"
"strings"
)
@@ -48,14 +47,15 @@
var info RequestInfo
decoder := json.NewDecoder(r.Body)
defer r.Body.Close()
- if err := decoder.Decode(&info); err != nil || !c.validateData(&info) {
- log.Printf("ERROR: %v", err)
+ if err := decoder.Decode(&info); err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+ if !c.validateData(&info) {
w.WriteHeader(http.StatusBadRequest)
return
}
- log.Printf("GOT: %v", info)
-
role, err := c.GetRole(&info)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
diff --git a/provisioner/provisioner.go b/provisioner/provisioner.go
index aeb237a..362c06d 100644
--- a/provisioner/provisioner.go
+++ b/provisioner/provisioner.go
@@ -35,8 +35,10 @@
Listen: %s
Port: %d
RoleSelectorURL: %s
- DefaultRole: %s`,
- context.config.Listen, context.config.Port, context.config.RoleSelectorURL, context.config.DefaultRole)
+ DefaultRole: %s
+ Script: %s`,
+ context.config.Listen, context.config.Port, context.config.RoleSelectorURL,
+ context.config.DefaultRole, context.config.Script)
context.storage = NewMemoryStorage()