Skip to content

Commit

Permalink
Add Control Plane API call to return the Snowplow Mini version (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
aldemirenes committed Oct 10, 2017
1 parent b29b3bc commit a6c27c9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions provisioning/resources/control-plane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func main() {
http.HandleFunc("/local-iglu-apikey", addLocalIgluApikey)
http.HandleFunc("/credentials", changeUsernameAndPassword)
http.HandleFunc("/domain-name", addDomainName)
http.HandleFunc("/version", getSpminiVersion)
log.Fatal(http.ListenAndServe(":10000", nil))
}

Expand Down Expand Up @@ -296,3 +297,18 @@ func addDomainName(resp http.ResponseWriter, req *http.Request) {
http.Error(resp, "", 404)
}
}

func getSpminiVersion(resp http.ResponseWriter, req *http.Request) {
if req.Method == "GET" {
versionBytes, err := ioutil.ReadFile(config.VersionFilePath)
if err != nil {
http.Error(resp, err.Error(), 500)
return
}
versionStr := string(versionBytes)
resp.WriteHeader(http.StatusOK)
io.WriteString(resp, versionStr)
} else {
http.Error(resp, "", 404)
}
}
6 changes: 6 additions & 0 deletions provisioning/roles/sp_mini_3_setup_apps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
src: "{{playbook_dir}}/resources/control-plane/snowplow-mini-control-plane-api"
dest: "{{executables_dir}}"

- name: Copy VERSION file to /home/ubuntu/snowplow for Control API
become: yes
synchronize:
src: "{{playbook_dir}}/../VERSION"
dest: "{{main_dir}}"

- name: Check Kinesis Packages
stat:
path: "{{staging_dir}}/{{kinesis_package}}"
Expand Down

0 comments on commit a6c27c9

Please sign in to comment.